/* ============================================================
   STOREFLOW — PRODUCTION DESIGN SYSTEM
   ============================================================ */

/* --- DESIGN TOKENS --- */
:root {
  --bg-body: #0f172a;
  --bg-sidebar: #0b1120;
  --bg-card: #1e293b;
  --bg-card-hover: #253348;
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-subtle: rgba(148, 163, 184, 0.1);

  --primary: #22c55e;
  --primary-hover: #16a34a;
  --primary-glow: rgba(34, 197, 94, 0.25);
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-glow: rgba(139, 92, 246, 0.25);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.2);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px var(--primary-glow);
  --transition: all 0.2s ease;

  --sidebar-width: 260px;
}

/* --- GOOGLE FONTS --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- RESET & BASE --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; }

/* ============================================================
   LAYOUT — Sidebar + Main
   ============================================================ */
.app {
  display: flex;
  min-height: 100vh;
}

.main {
  flex: 1;
  padding: 32px 40px 60px;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  max-width: 100%;
  animation: fadeInPage 0.3s ease;
}

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SIDEBAR — Reusable component (injected by sidebar.js)
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-top { flex: 1; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 32px;
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-logo:hover { opacity: 0.8; }
.logo-icon { font-size: 26px; }
.logo-text {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
}
.nav-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
}
.nav-link.active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--primary);
  font-weight: 600;
}
.nav-link.active .nav-icon { transform: scale(1.1); }
.nav-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-label { white-space: nowrap; }

/* Sidebar Bottom — User + Logout */
.sidebar-bottom {
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 16px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-email {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.sidebar-plan-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.sidebar-plan-label.premium {
  color: var(--accent);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: var(--transition);
}
.sidebar-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
}

/* ============================================================
   MOBILE HEADER + RESPONSIVE SIDEBAR
   ============================================================ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 20px;
  align-items: center;
  justify-content: space-between;
  z-index: 200;
}
.mobile-logo {
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mobile-logo-icon { font-size: 22px; }

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
  backdrop-filter: blur(4px);
}
.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 150;
  }
  .sidebar.open { transform: translateX(0); }
  .main {
    margin-left: 0;
    padding: 80px 20px 40px;
  }
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.header {
  margin-bottom: 28px;
}
.header h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 6px 0;
  letter-spacing: -0.5px;
}
.header p, .header .sub-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}
.header .main-message {
  font-size: 15px;
  font-weight: 500;
  margin: 8px 0 4px 0;
  color: var(--text-secondary);
}

/* ============================================================
   BUTTONS — Unified system
   ============================================================ */
.btn, .primary, .secondary, .upgrade-btn, button.primary, button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.primary, button.primary {
  background: var(--primary);
  color: white;
}
.primary:hover, button.primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}
.primary:active, button.primary:active { transform: translateY(0); }
.primary:disabled, button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.secondary, button.secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.secondary:hover, button.secondary:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.upgrade-btn {
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: white;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.upgrade-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.upgrade-btn:active { transform: translateY(0); }
.upgrade-btn.premium { width: 100%; margin-top: 16px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}
.stat-card:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-card h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px 0;
}
.stat-card p {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}
.stat-card #revenue { color: var(--primary); }
.stat-card #orderCount { color: var(--accent); }

/* ============================================================
   ANALYTICS SECTION
   ============================================================ */
.analytics-section {
  background: var(--bg-card);
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin: 32px 0;
}
.analytics-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 20px 0;
}
.chart-wrapper {
  background: rgba(0,0,0,0.2);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  height: 300px;
  margin-bottom: 12px;
  position: relative;
}
.chart-wrapper canvas { max-height: 100%; }
.chart-label {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

/* ============================================================
   SUBSCRIPTION HERO CARD
   ============================================================ */
.sub-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  gap: 24px;
  flex-wrap: wrap;
}
.sub-hero h2 { font-size: 24px; font-weight: 800; margin: 0 0 4px 0; }
.sub-hero p { margin: 0; color: var(--text-secondary); font-size: 13px; }

/* ============================================================
   PLANS COMPARISON
   ============================================================ */
.plans-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.plan-card {
  padding: 28px;
  border-radius: var(--radius-lg);
  position: relative;
  transition: var(--transition);
}
.plan-card.free {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.plan-card.free:hover {
  border-color: var(--border-color);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.plan-card.premium {
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  border: none;
  transform: scale(1.02);
  box-shadow: 0 8px 32px var(--accent-glow);
}
.plan-card.premium:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 40px var(--accent-glow);
}
.plan-card h3 { font-size: 20px; font-weight: 700; margin: 0 0 12px 0; }
.plan-price {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--primary);
}
.plan-card.premium .plan-price { color: #fff; }
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}
.plan-features li {
  padding: 8px 0;
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.plan-features li:last-child { border-bottom: none; }
.premium-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #000;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
  white-space: nowrap;
}

/* Expiry Warning */
.expiry-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
  padding: 14px 20px;
  margin: 16px 0;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
}
.expiry-warning.hidden { display: none; }

/* ============================================================
   QUICK ACTIONS
   ============================================================ */
.quick-actions {
  display: flex;
  gap: 12px;
  margin: 24px 0;
  flex-wrap: wrap;
}

/* ============================================================
   STORES GRID
   ============================================================ */
.stores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.store-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}
.store-card:hover {
  border-color: var(--border-color);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.store-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.store-icon {
  font-size: 24px;
  background: rgba(139, 92, 246, 0.1);
  padding: 10px;
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.store-header h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px 0; }
.store-header p { margin: 0; color: var(--text-muted); font-size: 13px; }

.store-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.store-actions button {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: var(--transition);
  min-width: 70px;
}
.open-btn { background: var(--accent); color: white; }
.open-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.view-btn { background: var(--bg-body); color: var(--text-secondary); border: 1px solid var(--border-color) !important; }
.view-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.orders-btn { background: rgba(34, 197, 94, 0.1); color: var(--primary); border: 1px solid rgba(34, 197, 94, 0.2) !important; }
.orders-btn:hover { background: rgba(34, 197, 94, 0.2); }
.delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  flex: 0 0 auto;
  min-width: auto;
  padding: 9px 12px;
}
.delete-btn:hover { background: rgba(239, 68, 68, 0.2); }

/* ============================================================
   PRODUCTS GRID
   ============================================================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: var(--transition);
}
.product-card:hover {
  border-color: var(--border-color);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.product-card img,
.product-card .product-image img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-body);
}
.product-card .product-image { position: relative; }
.product-card .product-info,
.product-card > h3,
.product-card > p {
  padding: 0 20px;
}
.product-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 14px 0 6px 0;
  padding: 0 20px;
}
.product-card p,
.product-card .price {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 4px 0;
  padding: 0 20px;
}
.product-card .product-description {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}
.product-card .product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px 0;
  font-size: 12px;
}
.stock-badge { font-weight: 600; }
.store-badge { color: var(--text-muted); }
.product-card .product-actions {
  display: flex;
  gap: 8px;
  padding: 0 20px 16px;
}
.product-card .product-actions button,
.product-card button {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.product-card button.edit-btn {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent);
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.product-card button.edit-btn:hover { background: rgba(139, 92, 246, 0.2); }

/* WhatsApp Button */
.whatsapp-btn {
  width: calc(100% - 40px);
  margin: 0 20px 16px;
  background: var(--primary);
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition: var(--transition);
}
.whatsapp-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-1px);
}
.whatsapp-btn.disabled, .whatsapp-btn:disabled {
  background: var(--bg-card-hover);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}
.whatsapp-btn.disabled:hover, .whatsapp-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ============================================================
   ORDERS
   ============================================================ */
.orders-list { margin-top: 24px; }
.order-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}
.order-card:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
}
.order-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.order-header h3 { font-size: 16px; font-weight: 600; margin: 0; }
.order-price { font-weight: 700; color: var(--primary); font-size: 16px; white-space: nowrap; }

.status {
  padding: 5px 12px;
  border-radius: var(--radius-xl);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.status.pending {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.status.completed, .status.confirmed {
  background: rgba(34, 197, 94, 0.12);
  color: var(--primary);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.order-details {
  background: rgba(0,0,0,0.15);
  padding: 14px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  border-left: 3px solid var(--accent);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}
.detail-row:last-child { margin-bottom: 0; }
.detail-row .label { color: var(--text-muted); }
.detail-row .value { font-weight: 600; color: var(--text-primary); }
.order-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.action-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
}
.done-btn { background: var(--primary); color: white; }
.done-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.verify-btn { background: var(--warning); color: white; }
.verify-btn:hover { background: #d97706; }

/* Payment Status Colors */
.payment-status-awaiting_verification { color: var(--warning); font-weight: 700; }
.payment-status-paid { color: var(--primary); font-weight: 700; }
.payment-status-unpaid { color: var(--accent); font-weight: 700; }
.payment-status-failed { color: var(--danger); font-weight: 700; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-color);
  margin-top: 32px;
}
.empty-state h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px 0;
}
.empty-state p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}
.empty-state button {
  background: var(--primary);
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
}
.empty-state button:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-2px);
}

/* ============================================================
   LOADING STATE
   ============================================================ */
.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 40px;
  font-size: 14px;
}
.loading::before {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 16px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   MODALS — Unified
   ============================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal:not(.hidden) { display: flex; }
.modal.hidden { display: none; }

.modal-content, .modal-box {
  background: var(--bg-card);
  padding: 32px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalSlideUp 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-content h2, .modal-content h3, .modal-content h4,
.modal-box h3 {
  font-weight: 700;
  margin: 0 0 20px 0;
  color: var(--text-primary);
}
.modal input, .modal select, .modal textarea {
  width: 100%;
  padding: 12px 14px;
  margin: 0 0 12px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  box-sizing: border-box;
  transition: var(--transition);
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.modal input::placeholder, .modal textarea::placeholder {
  color: var(--text-muted);
}
.modal-content .primary, .modal-content .secondary {
  width: 100%;
  margin-top: 8px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.modal-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}
.modal-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.modal-input::placeholder { color: var(--text-muted); }
.modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(148, 163, 184, 0.1);
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.close-btn:hover { background: rgba(148, 163, 184, 0.2); color: var(--text-primary); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 48px 40px;
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-container .login-logo {
  font-size: 40px;
  margin-bottom: 8px;
}
.login-container h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}
.subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 14px;
}
.login-container input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  box-sizing: border-box;
  transition: var(--transition);
}
.login-container input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.login-container input::placeholder { color: var(--text-muted); }
.login-container button {
  width: 100%;
  padding: 14px;
  margin-bottom: 10px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: var(--transition);
}
.login-container button:first-of-type {
  background: var(--primary);
  color: white;
}
.login-container button:first-of-type:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--primary-glow);
}
.login-container button:last-of-type {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.login-container button:last-of-type:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}
.login-container button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  pointer-events: none;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-section {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}
.settings-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px 0;
}
.setting-item {
  margin-bottom: 16px;
}
.setting-item:last-child { margin-bottom: 0; }
.setting-item label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.setting-item p {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}
.store-id-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.store-id-box code {
  background: var(--bg-body);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.copy-btn {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent);
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.copy-btn:hover { background: rgba(139, 92, 246, 0.2); }
.stat-box {
  background: var(--bg-body);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.badge-label { font-weight: 700; font-size: 14px; }
.link-row {
  display: flex;
  gap: 10px;
}
.link-input {
  flex: 1;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
}
.link-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============================================================
   PUBLIC STORE PAGE
   ============================================================ */
.store-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
.store-page .store-header {
  text-align: center;
  margin-bottom: 32px;
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.store-page .store-header h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px 0;
}
.store-phone {
  color: var(--text-muted);
  font-size: 14px;
}

/* Public store product card adjustments */
.store-page .product-card {
  text-align: left;
}
.store-page .product-card img {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin-bottom: 0;
}
.store-page .whatsapp-btn {
  margin: 12px 20px 16px;
  width: calc(100% - 40px);
}

/* ============================================================
   ORDER CONFIRMATION (store page modal)
   ============================================================ */
.order-details {
  background: rgba(139, 92, 246, 0.06);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border-left: 3px solid var(--accent);
}
.detail-item { margin-bottom: 10px; }
.detail-item:last-child { margin-bottom: 0; }
.detail-item label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--warning);
  margin: 14px 0;
  text-align: center;
}

/* ============================================================
   WARNING BANNERS
   ============================================================ */
.warning-banner {
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--radius-xl);
  font-size: 12px;
  font-weight: 600;
}
.status-badge.active { background: rgba(34,197,94,0.12); color: var(--primary); border: 1px solid rgba(34,197,94,0.3); }
.status-badge.grace { background: rgba(245,158,11,0.12); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.status-badge.expired { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.status-badge.free { background: rgba(148,163,184,0.1); color: var(--text-muted); border: 1px solid rgba(148,163,184,0.2); }

/* ============================================================
   ADMIN STYLES (Payments)
   ============================================================ */
.payment-status {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.payment-status.pending { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.payment-status.approved { background: rgba(34,197,94,0.12); color: var(--primary); border: 1px solid rgba(34,197,94,0.3); }
.payment-status.rejected { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.payment-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.approve-btn, .reject-btn, .extend-btn {
  flex: 1;
  min-width: 100px;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}
.approve-btn { background: var(--primary); color: white; }
.approve-btn:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); }
.approve-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.reject-btn { background: var(--danger); color: white; }
.reject-btn:hover:not(:disabled) { background: var(--danger-hover); transform: translateY(-1px); }
.reject-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.extend-btn { background: var(--warning); color: white; }
.extend-btn:hover { background: #d97706; transform: translateY(-1px); }
.payment-card { animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.payment-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:16px; padding-bottom:14px; border-bottom:1px solid var(--border-subtle); }
.payment-header h3 { margin:0; font-size:16px; }
.payment-details { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; margin-bottom:16px; }
.payment-detail { display:flex; flex-direction:column; }
.payment-detail label { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.4px; margin-bottom:4px; }
#pendingCount { display:inline-block; background:var(--warning); color:white; padding:3px 10px; border-radius:var(--radius-xl); font-size:13px; font-weight:700; }
#paymentSearch { transition:var(--transition); }
#paymentSearch:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-glow); }
#paymentSearch::placeholder { color:var(--text-muted); }

/* ============================================================
   PREMIUM / REAL-TIME SYNC
   ============================================================ */
.premium-only:disabled, .premium-only.locked {
  opacity: 0.6;
  cursor: not-allowed !important;
  background: var(--bg-card) !important;
  color: var(--text-muted) !important;
}
.premium-only:disabled::after, .premium-only.locked::after { content: " 🔒"; }
.premium-section { transition: opacity 0.3s ease; }
#premiumUpgradeNotification { display: none; }
.realtime-status {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-right: 6px;
  vertical-align: middle;
}
.realtime-status.inactive { background: var(--text-muted); }

/* Upgrade Benefits (modal) */
.upgrade-benefits {
  background: rgba(139, 92, 246, 0.06);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 92, 246, 0.15);
  margin-bottom: 20px;
}

/* Plan Limits */
.plan-limits-info {
  background: rgba(139,92,246,0.06);
  border: 1px solid rgba(139,92,246,0.15);
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 12px;
}
.plan-limits-info strong { color: var(--accent); }

/* Comparison Table */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.comparison-table th, .comparison-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border-subtle); }
.comparison-table th { background: rgba(139,92,246,0.08); font-weight: 600; color: var(--accent); text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; }
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table td { font-size: 14px; }
.comparison-table .check { color: var(--primary); font-weight: 700; }
.comparison-table .cross { color: var(--danger); font-weight: 700; }

/* Warning Box */
.warning-box {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--warning);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.warning-box.hidden { display: none; }
.warning-box p { margin: 0; font-size: 14px; font-weight: 500; }
.warning-icon { font-size: 20px; flex-shrink: 0; }

/* ============================================================
   EXPIRY OVERLAY
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
.overlay.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.overlay-box {
  background: var(--bg-card);
  padding: 40px;
  border-radius: var(--radius-lg);
  text-align: center;
  max-width: 400px;
  width: 100%;
  border: 1px solid var(--border-color);
  animation: modalSlideUp 0.4s ease;
}
.overlay-box h2 { margin: 0 0 12px 0; font-size: 22px; color: var(--warning); }
.overlay-box p { margin: 8px 0; color: var(--text-secondary); font-size: 14px; }
.overlay-box .primary {
  background: var(--warning);
  color: white;
  border: none;
  padding: 12px 28px;
  font-size: 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition);
  margin-top: 12px;
}
.overlay-box .primary:hover { background: #d97706; transform: translateY(-1px); }
.overlay-box .secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 12px 28px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}
.overlay-box .secondary:hover { border-color: var(--text-secondary); color: var(--text-primary); }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.hidden { display: none !important; }
.text-green { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* Section heading inside main */
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px 0;
}

/* ============================================================
   TOAST NOTIFICATION SYSTEM
   ============================================================ */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastSlideIn 0.35s ease, toastFadeOut 0.35s ease forwards;
  animation-delay: 0s, var(--toast-duration, 3s);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
}
.toast.success {
  background: linear-gradient(135deg, rgba(34,197,94,0.95), rgba(22,163,74,0.95));
}
.toast.error {
  background: linear-gradient(135deg, rgba(239,68,68,0.95), rgba(220,38,38,0.95));
}
.toast.info {
  background: linear-gradient(135deg, rgba(139,92,246,0.95), rgba(109,40,217,0.95));
}
.toast.warning {
  background: linear-gradient(135deg, rgba(245,158,11,0.95), rgba(217,119,6,0.95));
}
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: var(--transition);
}
.toast-close:hover { color: white; }
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastFadeOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ============================================================
   SKELETON LOADING (Pulse)
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   MOBILE RESPONSIVE POLISH
   ============================================================ */
@media (max-width: 768px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-card p { font-size: 20px; }
  .plans-comparison { grid-template-columns: 1fr; gap: 16px; }
  .plan-card.premium { transform: none; }
  .plan-card.premium:hover { transform: translateY(-4px); }
  .sub-hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  .sub-hero .upgrade-btn { width: 100%; }
  .quick-actions { flex-direction: column; }
  .quick-actions button { width: 100%; }
  .stores-grid { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: 1fr; }
  .store-actions { flex-wrap: wrap; }
  .store-actions button { min-width: calc(50% - 4px); }
  .order-header { flex-direction: column; }
  .order-actions { flex-wrap: wrap; }
  .action-btn { min-width: calc(50% - 4px); }
  .header h1 { font-size: 22px; }
  .modal-content, .modal-box { padding: 24px; }
  .chart-wrapper { height: 220px; }
  .analytics-section { padding: 20px; }
  .link-row { flex-direction: column; }
  .toast-container { top: 12px; right: 12px; left: 12px; }
  .toast { min-width: auto; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .main { padding: 70px 16px 40px; }
}

/* No Store Notice (settings fallback) */
.no-store-notice {
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-color);
  margin-top: 24px;
}
.no-store-notice h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px 0;
}
.no-store-notice p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}
