/* ===================================================
   MGL Shuddha — Admin Panel CSS
   =================================================== */

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

:root {
  --maroon:       #5C0A17;
  --maroon-dark:  #3E0610;
  --maroon-light: #8C1528;
  --gold:         #C9A84C;
  --gold-light:   #E8C96A;
  --gold-pale:    #F5E9C8;
  --cream:        #FAF6F0;
  --white:        #FFFFFF;
  --sidebar-bg:   #1A0508;
  --sidebar-w:    240px;
  --topbar-h:     60px;
  --text-dark:    #1A1A1A;
  --text-mid:     #4A4A4A;
  --text-muted:   #7A7A7A;
  --border:       #E5DDD0;
  --bg:           #F5F0EB;
  --success:      #2D7A3A;
  --success-bg:   #EAF5EC;
  --error:        #C0392B;
  --error-bg:     #FDECEA;
  --warning:      #D97706;
  --warning-bg:   #FEF3C7;
  --info:         #1D6FA4;
  --info-bg:      #EBF4FB;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-display: 'Cormorant Garamond', serif;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.14);
  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-lg:    12px;
  --radius-full:  9999px;
  --transition:   0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text-dark); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── LAYOUT ── */
.admin-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.admin-main    { display: flex; flex-direction: column; overflow-x: hidden; }
.admin-content { flex: 1; padding: 24px; }

/* ── SIDEBAR ── */
.admin-sidebar {
  background: var(--sidebar-bg);
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  z-index: 400;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-brand {
  padding: 20px 18px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.sidebar-brand-badge {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--maroon); border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.85rem; font-weight: 700; color: var(--gold);
  flex-shrink: 0;
}
.sidebar-brand-name { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--white); line-height: 1.2; }
.sidebar-brand-sub  { font-size: 0.62rem; color: rgba(255,255,255,0.4); letter-spacing: 0.06em; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-section-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.3); padding: 12px 18px 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  font-size: 0.83rem; font-weight: 500;
  color: rgba(255,255,255,0.6);
  transition: all var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}
.sidebar-link:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.sidebar-link.active { color: var(--gold-light); background: rgba(201,168,76,0.1); border-left-color: var(--gold); }
.sidebar-link i { width: 18px; text-align: center; font-size: 0.9rem; flex-shrink: 0; }
.sidebar-link .badge-count {
  margin-left: auto; background: var(--maroon); color: var(--white);
  font-size: 0.62rem; font-weight: 700; padding: 1px 7px; border-radius: var(--radius-full);
}
.sidebar-link .badge-count.orange { background: var(--warning); }

.sidebar-footer {
  padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.07); flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: rgba(255,255,255,0.05); cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,0.09); }
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--maroon); border: 1.5px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--gold); flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.8rem; font-weight: 600; color: var(--white); }
.sidebar-user-role { font-size: 0.65rem; color: rgba(255,255,255,0.4); }

/* ── TOPBAR ── */
.admin-topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 300;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-page-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--maroon); }
.topbar-breadcrumb { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.topbar-breadcrumb .sep { color: var(--text-light); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1rem;
  transition: all var(--transition); position: relative;
}
.topbar-icon-btn:hover { background: var(--cream); color: var(--maroon); }
.topbar-notif-badge {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--error);
  border: 2px solid var(--white);
}
.topbar-divider { width: 1px; height: 24px; background: var(--border); }
.view-site-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-full);
  font-size: 0.78rem; font-weight: 600; color: var(--maroon);
  border: 1.5px solid var(--border); transition: all var(--transition);
}
.view-site-btn:hover { border-color: var(--maroon); background: var(--cream); }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 20px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card-icon {
  width: 46px; height: 46px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.stat-card-icon.maroon  { background: rgba(92,10,23,0.1);  color: var(--maroon); }
.stat-card-icon.gold    { background: var(--gold-pale);      color: #8B6914; }
.stat-card-icon.green   { background: var(--success-bg);     color: var(--success); }
.stat-card-icon.blue    { background: var(--info-bg);        color: var(--info); }
.stat-card-icon.orange  { background: var(--warning-bg);     color: var(--warning); }
.stat-card-body { flex: 1; }
.stat-card-value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--text-dark); line-height: 1; margin-bottom: 4px; }
.stat-card-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }
.stat-card-trend { font-size: 0.72rem; display: flex; align-items: center; gap: 4px; }
.stat-card-trend.up   { color: var(--success); }
.stat-card-trend.down { color: var(--error); }

/* ── PANEL / CARD ── */
.admin-card {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 24px;
}
.admin-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 12px;
}
.admin-card-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--maroon);
}
.admin-card-title i { font-size: 0.95rem; color: var(--gold); }
.admin-card-body { padding: 20px; }
.admin-card-body.no-pad { padding: 0; }

/* ── TABLES ── */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.admin-table th {
  padding: 11px 16px; text-align: left;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); background: var(--cream);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.admin-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-dark); vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(92,10,23,0.02); }
.admin-table .td-img { width: 42px; height: 42px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--cream); flex-shrink: 0; }
.admin-table .td-img img { width: 100%; height: 100%; object-fit: cover; }
.admin-table .td-name { font-weight: 600; }
.admin-table .td-sub  { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.admin-table .td-actions { display: flex; align-items: center; gap: 6px; }

/* ── STATUS BADGES ── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap;
}
.status-badge.active, .status-badge.delivered, .status-badge.paid, .status-badge.approved {
  background: var(--success-bg); color: var(--success);
}
.status-badge.inactive, .status-badge.cancelled, .status-badge.failed, .status-badge.rejected {
  background: var(--error-bg); color: var(--error);
}
.status-badge.pending, .status-badge.processing {
  background: var(--warning-bg); color: var(--warning);
}
.status-badge.confirmed, .status-badge.shipped {
  background: var(--info-bg); color: var(--info);
}
.status-badge.placed {
  background: var(--gold-pale); color: #7A5C00;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 20px; border-radius: var(--radius-full);
  font-size: 0.82rem; font-weight: 600; transition: all var(--transition);
  white-space: nowrap; cursor: pointer; line-height: 1;
}
.btn-primary { background: var(--maroon); color: var(--white); border: 2px solid var(--maroon); }
.btn-primary:hover { background: var(--maroon-dark); border-color: var(--maroon-dark); }
.btn-outline { background: transparent; color: var(--maroon); border: 2px solid var(--maroon); }
.btn-outline:hover { background: var(--maroon); color: var(--white); }
.btn-gold { background: var(--gold); color: var(--maroon-dark); border: 2px solid var(--gold); font-weight: 700; }
.btn-gold:hover { background: var(--gold-light); }
.btn-ghost { background: var(--cream); color: var(--text-dark); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--maroon); color: var(--maroon); }
.btn-danger { background: var(--error); color: var(--white); border: 2px solid var(--error); }
.btn-danger:hover { background: #A93226; }
.btn-sm { padding: 6px 14px; font-size: 0.75rem; }
.btn-xs { padding: 4px 10px; font-size: 0.7rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { width: 32px; height: 32px; border-radius: var(--radius-md); padding: 0; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-dark); margin-bottom: 6px; }
.form-label .req { color: var(--error); }
.form-control {
  width: 100%; padding: 9px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  font-size: 0.85rem; color: var(--text-dark); background: var(--white);
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { border-color: var(--maroon); box-shadow: 0 0 0 3px rgba(92,10,23,0.08); }
.form-control::placeholder { color: #BBBBBB; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237A7A7A' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 0.72rem; color: var(--error); margin-top: 5px; display: flex; align-items: center; gap: 4px; }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 42px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border); border-radius: var(--radius-full);
  cursor: pointer; transition: background var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--white); top: 3px; left: 3px;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--maroon); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-label { font-size: 0.82rem; font-weight: 500; color: var(--text-dark); }

/* Image upload */
.img-upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 24px; text-align: center; cursor: pointer;
  transition: all var(--transition);
}
.img-upload-zone:hover { border-color: var(--maroon); background: rgba(92,10,23,0.02); }
.img-upload-zone.dragover { border-color: var(--maroon); background: rgba(92,10,23,0.04); }
.img-upload-zone i { font-size: 2rem; color: var(--text-light); display: block; margin-bottom: 8px; }
.img-upload-zone p { font-size: 0.8rem; color: var(--text-muted); }
.img-preview { position: relative; display: inline-block; }
.img-preview img { width: 100px; height: 100px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border); }
.img-preview-remove { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--error); color: var(--white); font-size: 0.65rem; display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* Search bar */
.admin-search {
  display: flex; align-items: center; gap: 0;
  border: 1.5px solid var(--border); border-radius: var(--radius-full);
  overflow: hidden; background: var(--white);
  transition: border-color var(--transition);
}
.admin-search:focus-within { border-color: var(--maroon); }
.admin-search input { border: none; padding: 8px 14px; font-size: 0.83rem; outline: none; flex: 1; background: transparent; }
.admin-search button { padding: 0 14px; color: var(--text-muted); font-size: 0.9rem; transition: color var(--transition); }
.admin-search button:hover { color: var(--maroon); }

/* Pagination */
.admin-pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.admin-pagination-info { font-size: 0.78rem; color: var(--text-muted); }
.admin-pagination-btns { display: flex; gap: 4px; }
.pg-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 600; color: var(--text-mid); background: var(--white); cursor: pointer; transition: all var(--transition); }
.pg-btn:hover, .pg-btn.active { background: var(--maroon); color: var(--white); border-color: var(--maroon); }
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal-box { background: var(--white); border-radius: var(--radius-xl); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-box.lg { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--maroon); }
.modal-close { width: 32px; height: 32px; border-radius: var(--radius-md); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all var(--transition); }
.modal-close:hover { background: var(--error-bg); color: var(--error); border-color: var(--error); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* Toast */
.admin-toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.admin-toast {
  background: var(--white); border-radius: var(--radius-lg); padding: 12px 16px;
  box-shadow: var(--shadow-lg); border-left: 4px solid var(--maroon);
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 340px;
  animation: toastIn 0.3s ease;
}
.admin-toast.success { border-color: var(--success); }
.admin-toast.error   { border-color: var(--error); }
.admin-toast.warning { border-color: var(--warning); }
.admin-toast i { font-size: 1rem; }
.admin-toast.success i { color: var(--success); }
.admin-toast.error   i { color: var(--error); }
.admin-toast.warning i { color: var(--warning); }
.admin-toast span { flex: 1; font-size: 0.83rem; font-weight: 500; }
@keyframes toastIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

/* Tabs */
.admin-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.admin-tab-btn {
  padding: 10px 20px; font-size: 0.83rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer;
  transition: all var(--transition); white-space: nowrap;
}
.admin-tab-btn:hover { color: var(--maroon); }
.admin-tab-btn.active { color: var(--maroon); border-bottom-color: var(--maroon); }
.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, #f0ebe4 25%, #f9f5ef 50%, #f0ebe4 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 3.5rem; color: #ddd; display: block; margin-bottom: 14px; }
.empty-state h3 { font-family: var(--font-display); font-size: 1.3rem; color: var(--text-mid); margin-bottom: 8px; }
.empty-state p  { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 20px; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-full); font-size: 0.72rem; font-weight: 600; background: var(--cream); border: 1px solid var(--border); color: var(--text-mid); }
.chip.active { background: var(--success-bg); color: var(--success); border-color: rgba(45,122,58,0.2); }
.chip.inactive { background: var(--error-bg); color: var(--error); border-color: rgba(192,57,43,0.2); }

/* Responsive */
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 991px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-main { margin-left: 0 !important; }
}
@media (max-width: 767px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .admin-content { padding: 16px; }
  .modal-box { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 85vh; margin-top: auto; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}
