/* ===================================================
   SOPHY - Admin Dashboard Styling
   Full Management Portal for Products & Orders
   =================================================== */

:root {
  --admin-bg: #f8fafc;
  --sidebar-bg: #1e131d;
  --sidebar-hover: #352132;
  --accent-burgundy: #721224;
  --accent-burgundy-dark: #590d1c;
  --accent-burgundy-light: #991b1b;
  --accent-pink: #721224;
  --accent-dark: #590d1c;
  --admin-card: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text: #1e293b;
  --admin-muted: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--admin-bg);
  color: var(--admin-text);
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-burgundy), var(--accent-burgundy-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fae8b2;
  box-shadow: 0 4px 12px rgba(114, 18, 36, 0.4);
}

.brand-info h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  letter-spacing: 1.5px;
  color: #fff;
}

.brand-info span {
  font-size: 0.72rem;
  color: #fae8b2;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-menu {
  list-style: none;
  padding: 20px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item button,
.menu-item a {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.menu-item button:hover,
.menu-item a:hover {
  background-color: var(--sidebar-hover);
  color: #fff;
  transform: translateX(3px);
}

.menu-item.active button {
  background: linear-gradient(135deg, var(--accent-burgundy) 0%, var(--accent-burgundy-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(114, 18, 36, 0.35);
}

.sidebar-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.view-store-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.view-store-link:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffb8cc;
}

/* Main Content Area */
.admin-main {
  margin-left: 260px;
  flex: 1;
  padding: 30px;
  max-width: 1300px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title-box h1 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--admin-text);
}

.page-title-box p {
  font-size: 0.88rem;
  color: var(--admin-muted);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #721224 0%, #590d1c 100%);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(114, 18, 36, 0.35);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(114, 18, 36, 0.45);
  background: linear-gradient(135deg, #8b182e 0%, #721224 100%);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.icon-pink, .icon-burgundy { background: #fdf2f4; color: #721224; }
.icon-purple { background: #f3e8ff; color: #9333ea; }
.icon-emerald { background: #ecfdf5; color: #059669; }
.icon-amber { background: #fffbeb; color: #d97706; }

.stat-info h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--admin-text);
}

.stat-info p {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-muted);
}

/* Content Container Card */
.content-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 30px;
}

.card-header-bar {
  padding: 18px 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.filter-input {
  padding: 8px 14px;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  outline: none;
}

.filter-input:focus {
  border-color: #721224;
  box-shadow: 0 0 0 3px rgba(114, 18, 36, 0.12);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  background: #f8fafc;
  padding: 14px 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--admin-muted);
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.88rem;
  vertical-align: middle;
}

.admin-table tr:hover {
  background-color: #fdf5f6;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid #f2cbd2;
  background: #f9f9f9;
}

.product-name-text {
  font-weight: 700;
  color: var(--admin-text);
}

.product-cat-text {
  font-size: 0.76rem;
  color: var(--admin-muted);
}

.stock-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.stock-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--success);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.table-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-in-stock { background: #dcfce7; color: #15803d; }
.badge-out-stock { background: #fee2e2; color: #b91c1c; }
.badge-order-new { background: #e0f2fe; color: #0369a1; }
.badge-order-confirmed { background: #dcfce7; color: #15803d; }
.badge-order-shipped { background: #fef3c7; color: #b45309; }

/* Action Buttons */
.action-btn-group {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--admin-border);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-muted);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--admin-text);
}

.btn-icon.edit-btn:hover {
  color: #2563eb;
  border-color: #93c5fd;
  background: #eff6ff;
}

.btn-icon.delete-btn:hover {
  color: var(--danger);
  border-color: #fca5a5;
  background: #fef2f2;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalScale 0.25s ease-out;
  overflow: hidden;
  margin: auto;
}

.modal-container form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #ffffff;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--admin-text);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--admin-muted);
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 180px);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1.5px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.btn-save-sync {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: all 0.2s ease;
}

.btn-save-sync:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-save-sync:disabled {
  opacity: 0.85;
  cursor: wait;
  transform: none;
}

.sync-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #059669;
  font-weight: 700;
  background: #ecfdf5;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #a7f3d0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--admin-text);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--admin-border);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

.form-control:focus {
  border-color: #721224;
  box-shadow: 0 0 0 3px rgba(114, 18, 36, 0.15);
}

/* Image Upload Preview Box & 3 Photos Slots */
.supabase-storage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.product-photos-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 10px;
}

@media (max-width: 680px) {
  .product-photos-slots-grid {
    grid-template-columns: 1fr;
  }
}

.photo-upload-slot {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.photo-upload-slot:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.photo-slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.photo-slot-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.photo-slot-badge.cover {
  color: #721224;
  background: #fdf2f4;
  border: 1px solid #fbd0da;
}

.photo-slot-clear-btn {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  line-height: 1;
}

.photo-slot-clear-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  transform: translateY(-1px);
}

.slot-floating-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.95);
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.slot-floating-delete-btn:hover {
  background: #b91c1c;
  transform: scale(1.12);
  box-shadow: 0 6px 14px rgba(220, 38, 38, 0.45);
}

.slot-floating-delete-btn:active {
  transform: scale(0.92);
}

.photo-slot-preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.photo-slot-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.photo-slot-preview-box:hover img {
  transform: scale(1.05);
}

.photo-slot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 0.76rem;
  font-weight: 600;
  width: 100%;
  height: 100%;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  background: #fbfcfe;
  transition: all 0.2s ease;
}

.photo-slot-preview-box:hover .photo-slot-placeholder {
  border-color: #721224;
  color: #721224;
  background: #fdf2f4;
}

.photo-slot-placeholder i {
  font-size: 1.25rem;
}

.photo-slot-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 41, 59, 0.65);
  backdrop-filter: blur(2px);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.photo-slot-preview-box:hover .photo-slot-overlay {
  opacity: 1;
}

.photo-slot-spinner {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #721224;
  font-size: 0.78rem;
  font-weight: 700;
  z-index: 5;
}

.photo-slot-spinner.active {
  display: flex !important;
}

.btn-slot-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-slot-upload:hover {
  background: #721224;
  border-color: #721224;
  color: #ffffff;
}

.photo-slot-url {
  font-size: 0.74rem !important;
  padding: 5px 8px !important;
  height: auto !important;
  background: #fafafa !important;
  border-radius: 6px !important;
}

.image-upload-preview {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px dashed #f2cbd2;
  border-radius: var(--radius-md);
  background: #fdf5f6;
}

.preview-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid #f2cbd2;
  background: #fff;
}

.btn-secondary {
  padding: 10px 18px;
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #f1f5f9;
}

/* Section Windows Management */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 18px;
}

.section-admin-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.25s ease;
  position: relative;
}

.section-admin-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(114, 18, 36, 0.08);
  border-color: #f2cbd2;
}

.section-admin-card.is-inactive {
  opacity: 0.65;
  background: #f8fafc;
  border-style: dashed;
}

.section-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.section-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #721224, #991b1b);
  color: #fae8b2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 12px rgba(114, 18, 36, 0.25);
  flex-shrink: 0;
}

.section-card-meta {
  flex: 1;
  min-width: 0;
}

.section-card-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-word;
}

.section-card-subtitle {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 8px;
}

.section-chips-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sec-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sec-pill-order {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.sec-pill-count {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.sec-pill-active {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.sec-pill-inactive {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.section-products-preview {
  background: #fdf8f8;
  border: 1px dashed #f5d0d6;
  border-radius: var(--radius-md);
  padding: 12px;
}

.section-products-preview-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: #721224;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-thumbs-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.section-thumb-item {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
}

.section-no-prods-msg {
  font-size: 0.78rem;
  color: #94a3b8;
  font-style: italic;
}

.section-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.btn-sec-action {
  flex: 1;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-sec-action:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-sec-edit {
  color: #721224;
  border-color: #fca5a5;
  background: #fff5f5;
}
.btn-sec-edit:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.btn-sec-addprod {
  color: #1e40af;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.btn-sec-addprod:hover {
  background: #dbeafe;
}

.btn-sec-delete {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #dc2626;
  border-color: #fecaca;
  background: #fff;
}
.btn-sec-delete:hover {
  background: #fee2e2;
}

/* Icon preset picker chips */
.icon-preset-chip {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  transition: all 0.15s ease;
}
.icon-preset-chip:hover, .icon-preset-chip.selected {
  background: #721224;
  color: #fae8b2;
  border-color: #721224;
}

/* Toast */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.25s ease;
  pointer-events: none;
}

.admin-toast.active {
  opacity: 1;
  transform: translateY(0);
}

/* ===================================================
   RESPONSIVE MOBILE ENGINE (ANDROID & IOS FLUID FIT)
   =================================================== */

/* Mobile Top Header (App Bar) */
.mobile-admin-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: linear-gradient(135deg, #1e131d 0%, #2b1322 100%);
  border-bottom: 1.5px solid rgba(212, 175, 55, 0.28);
  padding: 0 12px;
  align-items: center;
  justify-content: space-between;
  z-index: 1040;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.mobile-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: #fae8b2;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-menu-btn:active {
  background: rgba(212, 175, 55, 0.2);
  transform: scale(0.95);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-brand-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: #fae8b2;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-action-btn.primary {
  background: linear-gradient(135deg, var(--accent-burgundy), var(--accent-burgundy-dark));
  border-color: rgba(212, 175, 55, 0.4);
  color: #fff;
  box-shadow: 0 2px 10px rgba(114, 18, 36, 0.4);
}

/* Sidebar Mobile Backdrop */
.admin-sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1080;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.admin-sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Bottom Navigation Bar */
.admin-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(28, 17, 26, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1.5px solid rgba(212, 175, 55, 0.22);
  z-index: 1040;
  padding: 0 4px calc(env(safe-area-inset-bottom, 0px) + 2px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #a49197;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  min-height: 48px;
}

.bottom-nav-item i {
  font-size: 1.12rem;
  margin-bottom: 2px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.bottom-nav-item.active {
  color: #ffd700 !important;
  font-weight: 800;
}

.bottom-nav-item.active i {
  transform: translateY(-2px) scale(1.12);
  color: #ffd700 !important;
}

.bnav-badge {
  position: absolute;
  top: 4px;
  right: 18%;
  background: #dc2626;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1.5px solid #1e131d;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Fluid Adaptive Media Queries */
@media (max-width: 900px) {
  body {
    display: block;
    overflow-x: hidden;
    width: 100vw;
  }

  .mobile-admin-header {
    display: flex;
  }

  .admin-bottom-nav {
    display: flex;
  }

  /* Slide-in Mobile Drawer Sidebar */
  .admin-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 290px;
    max-width: 82vw;
    z-index: 1090;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.7);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  /* Main area adjusts to not be covered by fixed bars */
  .admin-main {
    margin-left: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 68px 12px 76px 12px !important;
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* Top bar elements */
  .admin-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--admin-border);
  }

  .admin-topbar .page-title-box h1 {
    font-size: 1.45rem;
  }
  .admin-topbar .page-title-box p {
    font-size: 0.82rem;
  }

  .topbar-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-actions button {
    flex: 1 1 auto;
    min-width: 140px;
    padding: 10px 14px;
    font-size: 0.84rem;
  }

  /* 2x2 Stats Grid on mobile Android */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
  }

  .stat-card {
    padding: 12px 14px;
    border-radius: 12px;
    gap: 10px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.05rem;
  }

  .stat-info h3 {
    font-size: 1.3rem;
  }

  .stat-info p {
    font-size: 0.74rem;
  }

  /* Card Headers & Filter Controls */
  .card-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 12px;
  }

  .card-header-bar .filter-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .filter-input {
    width: 100% !important;
  }

  /* Tables: clean touch horizontal scroll wrapper */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    border: 1px solid var(--admin-border);
    margin-bottom: 12px;
  }

  .admin-table {
    min-width: 640px;
  }

  .admin-table th, .admin-table td {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  /* Section cards grid */
  .sections-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* Modals: mobile viewport auto-fit */
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-container {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 88vh !important;
    border-radius: 18px 18px 0 0 !important;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
  }

  .modal-header {
    padding: 14px 16px;
    flex-shrink: 0;
  }

  .modal-body {
    padding: 14px 16px !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(88vh - 120px) !important;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-shrink: 0;
    gap: 8px;
  }

  .form-grid-2 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* 3-column price grid on small screens */
  .price-3col-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
}

@media (max-width: 480px) {
  .admin-main {
    padding: 64px 8px 74px 8px !important;
  }

  .stat-card {
    padding: 10px 12px;
  }

  .stat-info h3 {
    font-size: 1.15rem;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer button {
    width: 100% !important;
  }

  .btn-save-sync, .btn-primary {
    width: 100%;
    justify-content: center;
  }
}

