/* ADMIN PORTAL CSS */
.admin-body { background: #f0f2f5; margin: 0; padding: 0; }
.admin-login-screen { position: fixed; inset: 0; background: var(--dark); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.login-card { background: #fff; border-radius: 16px; padding: 48px 40px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-card h2 { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: 6px; }
.login-card input { width: 100%; padding: 13px 16px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.9rem; margin-bottom: 12px; display: block; }

/* LAYOUT */
#admin-app { display: flex; min-height: 100vh; }
.admin-sidebar { width: 230px; background: var(--dark); color: var(--white); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-logo { padding: 24px 20px; border-bottom: 1px solid #333; text-align: center; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.snav-item { width: 100%; text-align: left; padding: 12px 16px; border: none; background: none; color: rgba(255,255,255,0.7); font-size: 0.85rem; font-family: var(--font-body); cursor: pointer; border-radius: 8px; transition: all 0.2s; }
.snav-item:hover, .snav-item.active { background: rgba(201,168,76,0.15); color: var(--gold); }
.sidebar-bottom { padding: 16px 12px; border-top: 1px solid #333; display: flex; flex-direction: column; gap: 4px; }

.admin-main { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; }
.admin-header { background: var(--white); padding: 18px 32px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.admin-header h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; }
.avatar { width: 36px; height: 36px; background: var(--gold); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; color: var(--dark); }

.admin-section { padding: 28px 32px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card { background: var(--white); border-radius: 12px; padding: 22px; display: flex; align-items: center; gap: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; color: var(--dark); }

/* DASH GRID */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.dash-card { background: var(--white); border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.dash-card h3 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 16px; }

/* TABLES */
.table-wrap { background: var(--white); border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.data-table thead { background: #f8f9fa; }
.data-table th { padding: 12px 16px; text-align: left; font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.data-table tr:hover td { background: #fafafa; }
.data-table img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }

/* SECTION ACTIONS */
.section-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-actions h2 { font-family: var(--font-display); font-size: 1.5rem; }
.search-bar { margin-bottom: 16px; }
.search-bar input { padding: 11px 16px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.88rem; width: 320px; }
.filter-row { display: flex; gap: 12px; margin-bottom: 16px; }
.filter-row select, .filter-row input { padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.85rem; }
.filter-row input { flex: 1; max-width: 300px; }

/* STATUS BADGES */
.status-paid { background: #d4edda; color: #155724; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.status-pending { background: #fff3cd; color: #856404; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.status-pickup { background: #cce5ff; color: #004085; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.status-delivery { background: #f8d7da; color: #721c24; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.stock-ok { color: var(--green); font-weight: 600; }
.stock-low { color: #e67e22; font-weight: 600; }
.stock-oos { color: var(--red); font-weight: 600; }

/* ADMIN MODAL */
.adm-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: none; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.adm-modal-overlay.open { display: flex; }
.adm-modal { background: var(--white); border-radius: 12px; width: 100%; max-height: none; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.adm-modal.large { max-width: 820px; }
.adm-modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.adm-modal-header h3 { font-family: var(--font-display); font-size: 1.3rem; }
.adm-modal-header button { background: none; border: none; font-size: 1.3rem; cursor: pointer; }
.adm-modal-body { padding: 24px; }
.adm-modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* PRODUCT FORM */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.form-col label { display: block; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; margin-top: 14px; color: var(--text-muted); }
.form-col input, .form-col select, .form-col textarea { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.88rem; font-family: var(--font-body); }
.form-col textarea { resize: vertical; }
.checkbox-row { display: flex; gap: 20px; margin-top: 14px; font-size: 0.88rem; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; }
.img-preview-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.img-preview-grid img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; border: 2px solid var(--border); }

/* SETTINGS */
.settings-form { max-width: 440px; }
.setting-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.setting-row label { width: 200px; font-size: 0.85rem; font-weight: 600; }
.setting-row input { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.88rem; }

/* LOW STOCK */
.low-stock-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.low-stock-item img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.low-stock-item .ls-name { font-size: 0.88rem; font-weight: 600; flex: 1; }
.low-stock-item .ls-qty { font-size: 0.82rem; color: var(--red); font-weight: 700; }

/* ACTION BTNS */
.act-btn { padding: 5px 10px; border-radius: 4px; border: none; cursor: pointer; font-size: 0.75rem; font-weight: 600; margin: 0 2px; }
.edit-btn { background: #e3f2fd; color: #1565c0; }
.del-btn { background: #fde8e8; color: #c0392b; }
.oos-toggle-btn { background: #fff3e0; color: #e65100; }

/* ANALYTICS */
.cat-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.cat-bar-name { width: 140px; font-size: 0.85rem; font-weight: 600; }
.cat-bar-fill { height: 22px; background: var(--gold); border-radius: 4px; }
.cat-bar-val { font-size: 0.82rem; color: var(--text-muted); }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .admin-sidebar { width: 60px; }
  .snav-item { padding: 12px; font-size: 1.2rem; overflow: hidden; }
  .snav-item:not(:first-child)::after { display: none; }
}

/* ===========================
   ADMIN UPDATES — 2026
   =========================== */

/* SIDEBAR — svg icons */
.snav-item { display: flex; align-items: center; gap: 10px; }
.snav-item svg { flex-shrink: 0; opacity: 0.7; }
.snav-item:hover svg, .snav-item.active svg { opacity: 1; }

/* STATUS BADGE — unified */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; text-transform: capitalize; }
.status-badge.paid { background: #d4edda; color: #155724; }
.status-badge.Processing { background: #fff3cd; color: #856404; }
.status-badge.Shipped { background: #cce5ff; color: #004085; }
.status-badge.Delivered { background: #d4edda; color: #155724; }
.status-badge.Cancelled { background: #fde8e8; color: #c0392b; }
.status-badge.delivery { background: #f8d7da; color: #721c24; }
.status-badge.pickup { background: #cce5ff; color: #004085; }

/* ACTION BUTTONS */
.adm-action-btn { padding: 5px 12px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.75rem; font-weight: 600; transition: all 0.15s; }
.adm-action-btn.edit { background: #e3f2fd; color: #1565c0; }
.adm-action-btn.edit:hover { background: #1565c0; color: #fff; }
.adm-action-btn.delete { background: #fde8e8; color: #c0392b; }
.adm-action-btn.delete:hover { background: #c0392b; color: #fff; }

/* CATEGORIES ADMIN GRID */
.cat-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.cat-admin-card { background: var(--white); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.07); transition: transform 0.2s; }
.cat-admin-card:hover { transform: translateY(-3px); }
.cat-admin-card img { width: 100%; height: 130px; object-fit: cover; }
.cat-admin-info { padding: 14px; }
.cat-admin-info strong { display: block; font-size: 0.9rem; margin-bottom: 2px; }
.cat-admin-info .cat-btn-row { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.cat-admin-info .cat-btn-row .adm-action-btn { flex: 1; min-width: 60px; text-align: center; }

/* LOW STOCK ROW */
.low-stock-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 0.85rem; }

/* FLASH SALE ADMIN */
.product-checkbox-list { max-height: 280px; overflow-y: auto; border: 1.5px solid var(--border); border-radius: 8px; padding: 8px; }
.product-check-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 0.84rem; transition: background 0.15s; }
.product-check-item:hover { background: #f5f1ea; }
.product-check-item input[type=checkbox] { accent-color: var(--gold); flex-shrink: 0; }
.fs-current-card { background: #f5f1ea; border-radius: 10px; padding: 18px; border-left: 4px solid var(--gold); }
.fs-current-card h4 { font-family: var(--font-display); font-size: 1.1rem; }
.fs-status-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.fs-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* FLASH SALE ACTIONS */
.flash-sale-actions button svg { vertical-align: middle; }

/* ANNOUNCEMENT PREVIEW */
.ann-preview { background: #f5f1ea; border-radius: 8px; padding: 16px; margin-top: 16px; }
.ann-preview-bar { background: var(--dark); color: var(--gold); padding: 10px 16px; border-radius: 6px; font-size: 0.85rem; margin-top: 8px; }

/* ANALYTICS */
.analytics-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.analytics-row span:first-child { width: 180px; font-size: 0.85rem; font-weight: 600; flex-shrink: 0; }
.analytics-bar-wrap { flex: 1; background: #f0f0f0; border-radius: 10px; height: 10px; overflow: hidden; }
.analytics-bar { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 10px; transition: width 0.8s ease; }

/* ADMIN MODAL — flex display fix */
.adm-modal-overlay { display: none; }
.adm-modal-overlay[style*="flex"] { display: flex !important; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.adm-modal { max-width: 520px; }
.adm-modal.large { max-width: 820px; }
.adm-modal-body label { display: block; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px; margin-top: 14px; }
.adm-modal-body input, .adm-modal-body select, .adm-modal-body textarea { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.88rem; font-family: var(--font-body); }

/* TOAST */
.adm-toast { position: fixed; bottom: 30px; right: 30px; background: var(--dark); color: var(--white); padding: 13px 24px; border-radius: 8px; font-size: 0.88rem; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.3s; border-left: 4px solid var(--gold); }
.adm-toast.show { opacity: 1; }

/* PRODUCT FORM category select fill */
#pf-cat { background: white; }

/* ── Image Upload UI ───────────────────────────────────────────── */
.img-upload-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.img-tab {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  color: #555;
}
.img-tab.active {
  background: #1a1209;
  color: #C9A84C;
  border-color: #C9A84C;
}
.img-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ddd;
  border-radius: 10px;
  padding: 22px 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #fafafa;
  text-align: center;
  gap: 4px;
  min-height: 100px;
}
.img-upload-area:hover {
  border-color: #C9A84C;
  background: #fffdf5;
}
.img-upload-area p { margin: 0; line-height: 1.4; }
.img-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

/* ============================================================
   ADMIN MOBILE RESPONSIVE — complete overhaul
   ============================================================ */

/* Hamburger button — only shows on mobile */
.admin-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--dark);
  flex-shrink: 0;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 149;
}
.sidebar-overlay.open { display: block; }

@media (max-width: 900px) {
  /* Layout: stack sidebar over content */
  #admin-app { position: relative; }

  .admin-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    width: 100%;
    min-width: 0;
  }

  .admin-header {
    padding: 14px 16px;
    gap: 10px;
  }

  .admin-hamburger { display: flex; }

  .admin-header h1 { font-size: 1.2rem; }
  .admin-user span { display: none; } /* hide "Admin" text */

  /* Stats: 2 col on tablet */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-icon { width: 42px; height: 42px; font-size: 1.2rem; }
  .stat-value { font-size: 1.3rem; }

  /* Dash grid: stack */
  .dash-grid { grid-template-columns: 1fr; gap: 14px; }

  /* Tables: horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 560px; }
  .data-table th, .data-table td { padding: 10px 12px; font-size: 0.8rem; }

  /* Section padding */
  .admin-section { padding: 20px 16px; }
  .section-actions { flex-wrap: wrap; gap: 10px; }
  .section-actions h2 { font-size: 1.2rem; }
  .search-bar input { width: 100%; box-sizing: border-box; }

  /* Flash sale product checkbox list */
  .product-checkbox-list { max-height: 200px; }

  /* Categories grid */
  .cat-admin-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }

  /* Modal overrides — let overlay scroll, don't clip the modal body */
  .adm-modal-body { max-height: none; overflow-y: visible; }
}

@media (max-width: 600px) {
  /* Stats: 2 cols tight */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 12px; gap: 10px; flex-direction: column; text-align: center; }
  .stat-icon { margin: 0 auto; }
  .stat-value { font-size: 1.2rem; }
  .stat-label { font-size: 0.7rem; }

  /* Tables on phone: even smaller min-width */
  .data-table { min-width: 480px; font-size: 0.76rem; }
  .data-table img { width: 36px; height: 36px; }

  /* Section */
  .admin-section { padding: 16px 12px; }

  /* Categories: 2 col */
  .cat-admin-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cat-admin-card img { height: 100px; }

  /* Form grids */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Promo, announcement, flash sections */
  .adm-form-section { padding: 16px; }
  .adm-form-section input,
  .adm-form-section textarea,
  .adm-form-section select { font-size: 0.88rem; }

  /* Action buttons in table rows — stack them */
  .adm-action-btn { padding: 4px 8px; font-size: 0.68rem; }

  /* Modal */
  .adm-modal { width: calc(100vw - 24px); padding: 20px 16px; }
  .adm-modal-body { max-height: none; padding: 16px; }
}

/* Notification panel — prevent overflow on mobile */
@media (max-width: 500px) {
  #notif-panel { right: -10px; width: calc(100vw - 20px); }
  .adm-modal-overlay { padding: 8px; }
  .adm-modal { padding: 16px 14px; }
}
