/* Flex US Phones - Global Styles */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f97316;
  --dark-950: #020617;
  --dark-900: #0f172a;
  --dark-800: #1e293b;
  --dark-700: #334155;
  --dark-600: #475569;
  --glass: rgba(255,255,255,0.05);
  --glass-border: rgba(255,255,255,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: #020617; color: #f1f5f9; overflow-x: hidden; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #2563eb; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #1d4ed8; }

/* Selection */
::selection { background: rgba(37,99,235,0.3); color: #fff; }

/* Animations - optimized with will-change only where needed */
@keyframes float { 0%,100% { transform: translateY(0px); } 50% { transform: translateY(-8px); } }
@keyframes shimmer { 0% { background-position: -1000px 0; } 100% { background-position: 1000px 0; } }
@keyframes slideInUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes spin { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }
/* Simplified gradient - no animation on hero-gradient to save CPU */

/* Glass morphism - reduced backdrop-filter for performance */
.glass { background: rgba(255,255,255,0.05); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.08); }
.glass-dark { background: rgba(0,0,0,0.4); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.06); }

/* Gradient text */
.gradient-text { background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.gradient-text-gold { background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Navigation */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(2,6,23,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}
#navbar.scrolled {
  background: rgba(2,6,23,0.97);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.nav-link {
  position: relative; color: #94a3b8;
  transition: color 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
}
.nav-link::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  transform: scaleX(0); transition: transform 0.2s;
}
.nav-link:hover, .nav-link.active { color: #f8fafc; }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

/* Hero - static gradient for performance (no animation) */
.hero-gradient {
  background: linear-gradient(135deg, #020617 0%, #0f172a 30%, #1e3a8a 60%, #1d4ed8 80%, #0f172a 100%);
}
.hero-phone { animation: float 6s ease-in-out infinite; will-change: transform; }
.hero-glow {
  position: absolute; width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(37,99,235,0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* Product Cards - use contain for better compositing */
.product-card {
  background: rgba(30,41,59,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  contain: layout style;
}
.product-card:hover {
  transform: translateY(-6px);
  border-color: rgba(37,99,235,0.4);
  box-shadow: 0 16px 40px rgba(37,99,235,0.2);
}
.product-card .product-image {
  position: relative; overflow: hidden; height: 220px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
}
.product-card .product-image img {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform 0.3s ease;
  padding: 16px;
  loading: lazy;
}
.product-card:hover .product-image img { transform: scale(1.06); }
.product-card .badge {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
}
.badge-new { background: linear-gradient(135deg, #2563eb, #7c3aed); color: white; }
.badge-hot { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.badge-refurb { background: linear-gradient(135deg, #059669, #047857); color: white; }
.badge-sale { background: linear-gradient(135deg, #f97316, #ea580c); color: white; }
.badge-installment { background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: white; }

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white; border: none; border-radius: 10px;
  font-weight: 600; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-accent {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white; border: none; border-radius: 10px;
  font-weight: 600; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(249,115,22,0.4); }

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: #cbd5e1; border-radius: 10px;
  font-weight: 600; cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn-outline:hover { border-color: #2563eb; color: #60a5fa; background: rgba(37,99,235,0.1); }

/* Forms */
.form-input {
  background: rgba(30,41,59,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  color: #f1f5f9; border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s; width: 100%;
  padding: 12px 16px; font-size: 14px;
  font-family: inherit;
}
.form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
  background: rgba(30,41,59,0.95);
}
.form-input::placeholder { color: #475569; }
.form-label { font-size: 13px; font-weight: 500; color: #94a3b8; display: block; margin-bottom: 6px; }
.form-error { color: #f87171; font-size: 12px; margin-top: 4px; }

/* Sidebar / Panels */
.sidebar {
  width: 260px; min-height: 100vh;
  background: rgba(15,23,42,0.98);
  border-right: 1px solid rgba(255,255,255,0.06);
  position: fixed; left: 0; top: 0;
  z-index: 50; overflow-y: auto;
  transition: transform 0.3s ease;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: 10px;
  color: #94a3b8; font-size: 13.5px; font-weight: 500;
  transition: background 0.2s, color 0.2s; cursor: pointer;
  text-decoration: none;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(37,99,235,0.15);
  color: #60a5fa;
  border-left: 3px solid #2563eb;
  padding-left: 13px;
}
.sidebar-link i { width: 18px; text-align: center; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: rgba(30,41,59,0.8);
  color: #64748b; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.data-table td {
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13.5px; color: #cbd5e1;
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(37,99,235,0.05); }

/* Status badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
}
.status-pending { background: rgba(234,179,8,0.15); color: #fbbf24; border: 1px solid rgba(234,179,8,0.2); }
.status-approved, .status-confirmed, .status-active, .status-completed, .status-delivered, .status-paid { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.status-rejected, .status-cancelled, .status-failed { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.status-processing, .status-shipped, .status-under_review { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s;
  padding: 16px;
}
.modal-content {
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  max-width: 600px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  animation: slideInUp 0.2s;
  position: relative;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, rgba(30,41,59,0.8) 25%, rgba(51,65,85,0.5) 50%, rgba(30,41,59,0.8) 75%);
  background-size: 1000px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* Toast notifications */
.toast-container { position: fixed; top: 80px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1e293b; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  animation: slideInUp 0.25s; min-width: 280px; max-width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.toast-success { border-left: 3px solid #4ade80; }
.toast-error { border-left: 3px solid #f87171; }
.toast-info { border-left: 3px solid #60a5fa; }
.toast-warning { border-left: 3px solid #fbbf24; }

/* Payment / Crypto styles */
.qr-container { background: white; border-radius: 16px; padding: 16px; display: inline-block; }
.crypto-address {
  background: rgba(30,41,59,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 12px 16px;
  font-family: 'Courier New', monospace;
  font-size: 13px; word-break: break-all;
  color: #7dd3fc;
}

/* Filters sidebar */
.filter-panel { background: rgba(15,23,42,0.95); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; padding: 20px; }
.filter-group { margin-bottom: 20px; }
.filter-group label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; }
.filter-checkbox { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.filter-checkbox input { accent-color: #2563eb; }
.filter-checkbox span { font-size: 13px; color: #94a3b8; }

/* Rating stars */
.stars { color: #fbbf24; }
.star-empty { color: #334155; }

/* Price range slider */
input[type="range"] { accent-color: #2563eb; }

/* Page transitions */
.page { animation: fadeIn 0.25s; }

/* Cart counter */
.cart-count {
  position: absolute; top: -8px; right: -8px;
  background: #ef4444; color: white;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Installment calculator */
.calc-card {
  background: linear-gradient(135deg, rgba(37,99,235,0.1), rgba(124,58,237,0.1));
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 16px;
}

/* Country flags */
.flag { font-size: 18px; }

/* Upload area */
.upload-zone {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 12px; padding: 20px 12px;
  text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden; word-break: break-word;
}
.upload-zone:hover, .upload-zone.dragover { border-color: #2563eb; background: rgba(37,99,235,0.05); }

/* Admin stats cards */
.stat-card {
  background: rgba(30,41,59,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px; padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: rgba(37,99,235,0.3); transform: translateY(-2px); }

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .modal-content { max-height: 95vh; border-radius: 16px; }
  .product-card .product-image { height: 180px; }
  /* Disable blur effects on mobile for performance */
  .glass { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255,255,255,0.08); }
  .glass-dark { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(0,0,0,0.5); }
  #navbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(2,6,23,0.97); }
}

/* Dropdown */
.dropdown {
  position: absolute; background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; min-width: 200px;
  box-shadow: 0 16px 32px rgba(0,0,0,0.4);
  z-index: 100; animation: slideInUp 0.15s;
}
.dropdown-item { padding: 10px 16px; color: #94a3b8; cursor: pointer; transition: background 0.15s, color 0.15s; font-size: 13.5px; }
.dropdown-item:hover { background: rgba(37,99,235,0.1); color: #60a5fa; }

/* QR Code display */
.qr-display { background: white; padding: 12px; border-radius: 12px; display: inline-block; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

/* Step indicator */
.steps { display: flex; gap: 0; }
.step { flex: 1; text-align: center; position: relative; padding-bottom: 24px; }
.step::after { content: ''; position: absolute; top: 16px; left: 50%; width: 100%; height: 2px; background: rgba(255,255,255,0.1); }
.step:last-child::after { display: none; }
.step.active::after { background: #2563eb; }
.step-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px; font-size: 14px;
  position: relative; z-index: 1;
  background: rgba(255,255,255,0.1); color: #64748b;
}
.step.active .step-icon { background: #2563eb; color: white; }
.step.done .step-icon { background: #4ade80; color: #0f172a; }



/* ─── MOBILE OVERFLOW FIXES ─────────────────────────────────── */
@media (max-width: 640px) {
  .glass { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255,255,255,0.08); }
  .glass-dark { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(0,0,0,0.5); }
  #navbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(2,6,23,0.97); }
  .modal-content { max-height: 95vh; border-radius: 16px; }
  .product-card .product-image { height: 180px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  /* Prevent text overflow in forms */
  .form-input { font-size: 16px; } /* Prevent iOS zoom */
  input[type="text"], input[type="email"], input[type="number"], input[type="password"], select, textarea { font-size: 16px; }
  /* Prevent upload zone overflow */
  .upload-zone p { word-break: break-word; overflow-wrap: break-word; }
  /* Guarantor section */
  #guarantor-section { display: block !important; }
  #guarantor-section.hidden { display: none !important; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
}

/* Fix text overflow globally */
.truncate-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-words { word-break: break-word; overflow-wrap: break-word; }

/* Navbar overflow fix */
#navbar .flex.items-center.gap-3 { flex-wrap: nowrap; overflow: hidden; }
#nav-auth { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
