/* ===================================================================
   MUSK AL MADINA PAKISTAN - MERCHANT ADMIN DASHBOARD STYLES
   Imperial Dark Theme with Champagne Gold Accents & Glassmorphism
   =================================================================== */

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

:root {
  --admin-bg: #070c09;
  --admin-sidebar: #0a130f;
  --admin-card: rgba(14, 25, 20, 0.75);
  --admin-card-hover: rgba(19, 36, 28, 0.9);
  --admin-border: rgba(212, 175, 55, 0.2);
  --admin-border-bright: rgba(212, 175, 55, 0.5);

  --gold-primary: #d4af37;
  --gold-light: #f3e5ab;
  --gold-gradient: linear-gradient(135deg, #f7e7b4 0%, #d4af37 50%, #aa820a 100%);
  --gold-glow: rgba(212, 175, 55, 0.25);

  --text-main: #f8f6f0;
  --text-muted: #aab5b0;
  --text-dim: #708079;

  --status-pending: #f39c12;
  --status-dispatched: #3498db;
  --status-delivered: #2ecc71;
  --status-cancelled: #e74c3c;

  --font-royal: 'Cinzel', serif;
  --font-sans: 'Plus Jakarta Sans', sans-serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--admin-bg);
  color: var(--text-main);
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(20, 114, 83, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(212, 175, 55, 0.08) 0%, transparent 45%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ===================================================================
   Admin Layout: Sidebar + Main Content Area
   =================================================================== */
.admin-sidebar {
  width: 270px;
  min-width: 270px;
  background: var(--admin-sidebar);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  padding: 1.75rem 1.25rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 1.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--admin-border);
}

.brand-icon-sq {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gold-primary);
  background: radial-gradient(circle, #183327 0%, #08110c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-light);
  font-size: 1.3rem;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.brand-title {
  font-family: var(--font-royal);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.2;
}

.brand-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 1.5px;
}

/* Navigation items */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  border-color: rgba(212, 175, 55, 0.15);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(20, 114, 83, 0.35) 0%, rgba(212, 175, 55, 0.15) 100%);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.nav-icon {
  font-size: 1.15rem;
}

.nav-badge {
  margin-left: auto;
  background: var(--gold-gradient);
  color: #060908;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Sidebar Footer */
.sidebar-footer {
  padding-top: 1.5rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-store-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--gold-primary);
  color: var(--gold-light);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  background: rgba(212, 175, 55, 0.08);
}

.btn-store-link:hover {
  background: var(--gold-gradient);
  color: #060908;
}

/* ===================================================================
   Main Content Area
   =================================================================== */
.admin-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 12, 9, 0.9);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--admin-border);
  padding: 1.25rem 2.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title-wrap h1 {
  font-family: var(--font-royal);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.header-title-wrap p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--status-delivered);
  background: rgba(46, 204, 113, 0.1);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(46, 204, 113, 0.25);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-delivered);
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.admin-body {
  padding: 2.25rem;
  flex-grow: 1;
}

/* Tab Panels */
.tab-content {
  display: none;
  animation: fadeInTab 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   Overview & Metric Cards
   =================================================================== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.25rem;
}

.metric-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--admin-border-bright);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  background: var(--admin-card-hover);
}

.metric-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold-gradient);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.metric-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: var(--text-dim);
}

.metric-icon {
  font-size: 1.4rem;
}

.metric-value {
  font-family: var(--font-royal);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--gold-light);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===================================================================
   Tables, Lists & Cards
   =================================================================== */
.admin-card-panel {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  backdrop-filter: blur(12px);
  margin-bottom: 2rem;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.panel-title {
  font-family: var(--font-royal);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.admin-search-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  width: 220px;
  transition: all 0.2s ease;
}

.admin-search-input:focus {
  border-color: var(--gold-primary);
  width: 260px;
  background: rgba(255, 255, 255, 0.08);
}

/* Table styling */
.admin-table-wrap {
  overflow-x: auto;
}

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

.admin-table th {
  padding: 0.85rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.75px;
  border-bottom: 1px solid var(--admin-border);
  background: rgba(255, 255, 255, 0.02);
}

.admin-table td {
  padding: 1rem;
  font-size: 0.88rem;
  color: var(--text-main);
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pending {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.35);
}

.status-dispatched {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
  border: 1px solid rgba(52, 152, 219, 0.35);
}

.status-delivered {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.35);
}

.status-cancelled {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.35);
}

/* Action Buttons */
.btn-gold-sm {
  background: var(--gold-gradient);
  color: #060908;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-gold-sm:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-outline-sm {
  border: 1px solid var(--admin-border);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-outline-sm:hover {
  border-color: var(--gold-primary);
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.1);
}

.btn-danger-sm {
  border: 1px solid rgba(231, 76, 60, 0.4);
  color: var(--status-cancelled);
  font-size: 0.8rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-danger-sm:hover {
  background: rgba(231, 76, 60, 0.15);
}

/* Product Card Grid in Admin */
.admin-product-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--admin-border);
}

/* ===================================================================
   Forms & Modals
   =================================================================== */
.admin-form-group {
  margin-bottom: 1.25rem;
}

.admin-form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-form-input, .admin-form-select, .admin-form-textarea {
  width: 100%;
  background: #0d1a14;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: #fff;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

/* Fix for native option tags on Windows Chrome/Edge */
select, .admin-form-select {
  background-color: #0b1712 !important;
  color: #f8f6f0 !important;
}

select option, .admin-form-select option {
  background-color: #0b1712 !important;
  color: #f8f6f0 !important;
  padding: 10px 14px !important;
  font-size: 0.9rem !important;
}

select option:hover, select option:focus, select option:checked,
.admin-form-select option:hover, .admin-form-select option:focus, .admin-form-select option:checked {
  background-color: #17382b !important;
  color: #f7e7b4 !important;
}

/* Custom Radio & Segmented Button Groups */
.admin-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.admin-radio-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  background: #0a1510;
  border: 1.5px solid var(--admin-border);
  color: #e0e8e4;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.admin-radio-btn:hover {
  border-color: var(--gold-primary);
  background: #142820;
  color: #fff;
}

.admin-radio-btn.active {
  background: linear-gradient(135deg, rgba(20, 114, 83, 0.45) 0%, rgba(212, 175, 55, 0.25) 100%);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
  font-weight: 700;
}

.admin-radio-dot {
  width: 13px;
  height: 13px;
  min-width: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--admin-border);
  background: transparent;
  display: inline-block;
  position: relative;
  transition: all 0.2s ease;
}

.admin-radio-btn.active .admin-radio-dot {
  border-color: var(--gold-primary);
  background: var(--gold-primary);
  box-shadow: 0 0 6px var(--gold-primary);
}

/* Image Upload Component */
.image-upload-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px dashed var(--admin-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all 0.2s ease;
  text-align: center;
}

.image-upload-wrapper:hover, .image-upload-wrapper.dragover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.05);
}

.upload-drop-area {
  cursor: pointer;
  padding: 1rem 0.5rem;
}

.upload-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.upload-title {
  font-weight: 700;
  color: #fff;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.upload-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.image-preview-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
  background: #08110d;
  border: 1px solid var(--admin-border-bright);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  text-align: left;
}

.preview-thumb-img {
  width: 72px;
  height: 72px;
  min-width: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1.5px solid var(--gold-primary);
  background: #000;
}

.preview-info {
  flex-grow: 1;
}

.preview-file-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  margin-bottom: 0.2rem;
}

.preview-file-size {
  font-size: 0.72rem;
  color: var(--gold-light);
}

.btn-remove-preview {
  color: var(--status-cancelled);
  font-size: 0.75rem;
  border: 1px solid rgba(231, 76, 60, 0.3);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: rgba(231, 76, 60, 0.1);
  transition: all 0.2s ease;
}

.btn-remove-preview:hover {
  background: rgba(231, 76, 60, 0.25);
  color: #fff;
}

.preset-gallery-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  text-align: left;
}

.preset-gallery-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

.preset-thumb-btn {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  border: 2px solid var(--admin-border);
  overflow: hidden;
  cursor: pointer;
  background: #000;
  transition: all 0.2s ease;
  position: relative;
  padding: 0;
}

.preset-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preset-thumb-btn:hover {
  transform: scale(1.05);
  border-color: var(--gold-light);
}

.preset-thumb-btn.active {
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.admin-form-input:focus, .admin-form-select:focus, .admin-form-textarea:focus {
  border-color: var(--gold-primary);
  background: #11221a;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* Modal Windows */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.admin-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.admin-modal-box {
  background: #09120e;
  border: 1px solid var(--admin-border-bright);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 2.25rem;
  position: relative;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.9);
}

.admin-modal-title {
  font-family: var(--font-royal);
  font-size: 1.4rem;
  color: var(--gold-light);
  margin-bottom: 0.25rem;
}

.admin-modal-sub {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.admin-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--admin-border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.admin-modal-close:hover {
  color: #fff;
  border-color: #fff;
}

/* Toast Notifications in Admin */
.admin-toast-box {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
}

.admin-toast {
  background: #0d1e16;
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideToast 0.3s ease;
}

@keyframes slideToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
  .admin-sidebar { width: 220px; min-width: 220px; }
}

@media (max-width: 768px) {
  body { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--admin-border); }
  .metrics-row { grid-template-columns: 1fr; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-body { padding: 1.25rem; }
}
