/* ═══════════════════════════════════════════
   AlwanMart — Global Mobile-First Design System
   Font: Sora (display) + DM Sans (body)
   Theme: Deep Space Dark + Coral Red accent
═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800;900&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg:        #080b14;
  --bg2:       #0d1120;
  --bg3:       #121828;
  --card:      #141926;
  --card2:     #1a2235;
  --border:    rgba(255,255,255,0.06);
  --border2:   rgba(255,255,255,0.12);
  --accent:    #ff4757;
  --accent2:   #ff6b35;
  --gold:      #ffd32a;
  --success:   #2ed573;
  --warning:   #ffa502;
  --danger:    #ff4757;
  --info:      #1e90ff;
  --cyan:      #00d2d3;
  --purple:    #8c7ae6;
  --text:      #eef0f7;
  --text2:     #a8b2d0;
  --muted:     #5a6480;
  --panel:        #1a2235;
  --panel-border: rgba(255,255,255,0.08);
  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow:    0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.6);
}

/* ── Reset ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html { scroll-behavior:smooth; font-size:16px; }
body { font-family:'DM Sans',sans-serif; background:var(--bg); color:var(--text); overflow-x:hidden; -webkit-font-smoothing:antialiased; }
a { text-decoration:none; color:inherit; }
button { font-family:'DM Sans',sans-serif; cursor:pointer; }
img { max-width:100%; }

/* ── Typography ── */
h1,h2,h3,h4,h5 { font-family:'Sora',sans-serif; font-weight:800; }
.display { font-size:clamp(2rem,5vw,4rem); line-height:1.1; letter-spacing:-1.5px; }
.title   { font-size:clamp(1.25rem,3vw,2rem); line-height:1.2; letter-spacing:-0.5px; }
.label   { font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--muted); }

/* ── Glass Card ── */
.glass {
  background: rgba(20,25,38,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Gradient Text ── */
.grad-text {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 50px; font-weight: 700; font-size: 14px;
  border: none; transition: all 0.2s; cursor: pointer; font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg,var(--accent),var(--accent2)); color: white; box-shadow: 0 4px 20px rgba(255,71,87,0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(255,71,87,0.4); }
.btn-secondary { background: rgba(255,255,255,0.06); border: 1px solid var(--border2); color: var(--text2); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.btn-success { background: linear-gradient(135deg,#2ed573,#17c45e); color: #000; box-shadow: 0 4px 20px rgba(46,213,115,0.3); }
.btn-danger  { background: linear-gradient(135deg,#ff4757,#c0002a); color: white; }
.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ── Form inputs ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); }
.form-input {
  width: 100%; padding: 13px 16px;
  background: var(--card2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 15px;
  font-family: inherit; outline: none; transition: border 0.2s;
  -webkit-appearance: none;
}
.form-input:focus { border-color: var(--accent); background: var(--card); }
.form-input::placeholder { color: var(--muted); font-size: 14px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%235a6480'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }

/* ── Badge / Chip ── */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 50px; font-size: 11px; font-weight: 700; }
.chip-red    { background: rgba(255,71,87,0.15);  color: var(--accent); }
.chip-green  { background: rgba(46,213,115,0.15); color: var(--success); }
.chip-yellow { background: rgba(255,165,2,0.15);  color: var(--warning); }
.chip-blue   { background: rgba(30,144,255,0.15); color: var(--info); }
.chip-cyan   { background: rgba(0,210,211,0.15);  color: var(--cyan); }
.chip-purple { background: rgba(140,122,230,0.15);color: var(--purple); }

/* ── Stat Box ── */
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; text-align: center;
}
.stat-num  { font-family:'Sora',sans-serif; font-size: 28px; font-weight: 900; line-height: 1; }
.stat-label{ font-size: 11px; color: var(--muted); margin-top: 5px; text-transform: uppercase; letter-spacing: 0.6px; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Section title ── */
.sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.sec-head h2 { font-family:'Sora',sans-serif; font-size: 18px; font-weight: 800; }
.sec-head a  { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.sec-head a:hover { color: var(--accent); }

/* ── Toast ── */
.am-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--card); border: 1px solid var(--success); color: var(--success);
  padding: 10px 22px; border-radius: 50px; font-size: 13px; font-weight: 600;
  z-index: 9999; opacity: 0; transition: all 0.3s; pointer-events: none; white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.am-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Spinner ── */
.am-spinner-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 9998; display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px; backdrop-filter: blur(4px);
}
.am-spinner-overlay.show { display: flex; }
.am-spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,71,87,0.15);
  border-top: 4px solid var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ── */
.am-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  z-index: 1000; display: none; align-items: flex-end;
  backdrop-filter: blur(4px);
}
.am-modal-overlay.open { display: flex; }
.am-modal-sheet {
  background: var(--bg2); border-radius: 24px 24px 0 0;
  padding: 24px 20px max(24px,env(safe-area-inset-bottom));
  width: 100%; max-width: 540px; margin: 0 auto;
  border-top: 1px solid var(--border2);
  max-height: 92vh; overflow-y: auto;
}
.am-modal-handle { width: 36px; height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px; margin: 0 auto 20px; }
.am-modal-title { font-family:'Sora',sans-serif; font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 18px; }

/* ── Skeleton ── */
.skeleton { background: linear-gradient(90deg,var(--card) 25%,var(--card2) 50%,var(--card) 75%); background-size: 200%; animation: shimmer 1.5s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ── Safe area ── */
.safe-bottom { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.safe-top    { padding-top: max(0px, env(safe-area-inset-top)); }

/* ── Bottom Nav ── */
.am-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(13,17,32,0.97); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; z-index: 100;
  padding-bottom: max(8px,env(safe-area-inset-bottom));
}
.am-nav-tab {
  flex: 1; padding: 10px 6px 8px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; border: none; background: none;
  color: var(--muted); font-size: 9px; font-weight: 600; font-family: inherit;
  transition: color 0.2s; position: relative;
}
.am-nav-tab i { font-size: 20px; }
.am-nav-tab.active { color: var(--accent); }
.am-nav-tab.active i { transform: scale(1.1); }
.am-nav-badge {
  position: absolute; top: 6px; right: calc(50% - 20px);
  background: var(--accent); color: white; border-radius: 50%;
  width: 16px; height: 16px; font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

/* ── Responsive Grids ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
@media(max-width:480px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ── Utility ── */
.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.p-16   { padding: 16px; }
.p-20   { padding: 20px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-success{ color: var(--success); }
.text-accent { color: var(--accent); }
.text-warning{ color: var(--warning); }
.fw-800  { font-weight: 800; }
.fw-700  { font-weight: 700; }
.fs-12   { font-size: 12px; }
.fs-13   { font-size: 13px; }
.fs-14   { font-size: 14px; }
.overflow-hidden { overflow: hidden; }
.rounded { border-radius: var(--radius); }
.w-full  { width: 100%; }

/* ══ CONTRAST FIXES ══ */
input, textarea { color: var(--text) !important; }
input::placeholder, textarea::placeholder { color: var(--muted) !important; }
select { color: var(--text) !important; color-scheme: dark; }
select option { background: var(--bg2) !important; color: var(--text) !important; }
.form-input { color: var(--text) !important; }
.form-input::placeholder { color: var(--muted) !important; }
label, .form-label, .label { color: var(--text2) !important; }
td { color: var(--text) !important; }
th { color: var(--muted) !important; }


/* ════════════════════════════════════════════
   ADMIN PANEL — MOBILE RESPONSIVE FIXES
   Applied globally across all admin pages
════════════════════════════════════════════ */

/* ── Tables: horizontal scroll on mobile ── */
.table-wrap, .table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}

table {
  min-width: 600px;
  width: 100%;
  border-collapse: collapse;
}

/* ── Admin page title bar ── */
@media(max-width: 768px) {
  .page-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  .page-head .btn, .page-head button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Tables */
  table { min-width: 500px; font-size: 12px; }
  th, td { padding: 8px 10px !important; }

  /* Cards */
  .card { border-radius: 12px !important; }
  .card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Modals */
  .modal-box, .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 10px auto !important;
    padding: 16px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  /* Forms in modals */
  .modal-box .form-row,
  .modal-content .form-row {
    grid-template-columns: 1fr !important;
  }

  /* Buttons row */
  .btn-row, .action-row {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .btn-row .btn, .action-row .btn {
    width: 100% !important;
  }

  /* Filter/search bar */
  .filter-bar, .search-bar {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .filter-bar input, .filter-bar select,
  .search-bar input, .search-bar select {
    width: 100% !important;
  }

  /* Order detail grid */
  .order-grid, .detail-grid {
    grid-template-columns: 1fr !important;
  }

  /* Topbar */
  .topbar {
    padding: 0 12px !important;
    height: 52px !important;
  }
  .topbar h2 { font-size: 14px !important; }

  /* Content padding */
  .content { padding: 12px !important; }

  /* Hide less important table columns */
  .hide-mobile { display: none !important; }

  /* Full width inputs */
  .fi, input[type="text"], input[type="email"],
  input[type="number"], input[type="password"],
  select, textarea {
    width: 100% !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
  }

  /* Tab navigation */
  .tabs, .tab-bar {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

@media(max-width: 480px) {
  /* Stats single column on very small screens */
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .stat-card { padding: 12px !important; }
  .stat-value { font-size: 20px !important; }
  .stat-label { font-size: 10px !important; }

  /* Table even more compact */
  table { font-size: 11px !important; }
  th, td { padding: 6px 8px !important; }

  /* Hide even more columns */
  .hide-sm { display: none !important; }

  /* Full screen modals on small phones */
  .modal-box, .modal-content {
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 16px 16px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    margin: 0 !important;
  }
}

/* ── Vendor Portal Mobile ── */
@media(max-width: 768px) {
  .vendor-grid, .product-grid {
    grid-template-columns: 1fr !important;
  }
  .vendor-sidebar {
    display: none !important;
  }
  .vendor-main {
    width: 100% !important;
    margin-left: 0 !important;
  }
}

/* STORE PAGES Mobile Responsive */
@media(max-width: 768px) {
  /* Product grid */
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* Checkout */
  .checkout-grid {
    grid-template-columns: 1fr !important;
  }
  .checkout-summary {
    order: -1 !important;
  }

  /* Shop sidebar */
  .shop-sidebar {
    display: none !important;
  }
  .shop-main {
    width: 100% !important;
  }
}

@media(max-width: 380px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }
  .product-card .product-name {
    font-size: 11px !important;
  }
  .product-card .product-price {
    font-size: 13px !important;
  }
}

/* ── Rider App Mobile ── */
@media(max-width: 480px) {
  .rider-card { padding: 14px !important; }
  .rider-order-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .rider-order-actions a,
  .rider-order-actions button {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* ── Touch friendly buttons ── */
@media(max-width: 768px) {
  .btn, button, a.btn {
    min-height: 42px !important;
    touch-action: manipulation !important;
  }
  .btn-sm {
    min-height: 34px !important;
    padding: 6px 12px !important;
  }
}

/* ── Fix horizontal scroll on body ── */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}
