/* =====================================================
   IBADAT COUTURE — Admin Panel CSS
   Brand palette:
     Charcoal:  #1A1A1A
     Gold:      #8B6F47
     Cream:     #FAFAF8
     Sand:      #C9B99A
     Border:    #E8E0D5
   ===================================================== */

/* --- Reset & Fonts ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand-black:  #1A1A1A;
  --brand-gold:   #8B6F47;
  --brand-gold2:  #725936;
  --brand-sand:   #C9B99A;
  --brand-cream:  #FAFAF8;
  --brand-border: #E8E0D5;
  --sidebar-w:    240px;
  --topbar-h:     60px;

  --font-serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);

  --success: #16a34a;
  --error:   #dc2626;
  --warning: #d97706;
  --info:    #0369a1;
}

html { font-size: 15px; }

body {
  font-family: var(--font-sans);
  background: #f5f3f0;
  color: var(--brand-black);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font: inherit; }
input, select, textarea { font: inherit; }

/* --- Layout ----------------------------------------- */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --------------------------------------- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--brand-black);
  color: #d4cec8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--brand-gold);
  flex-shrink: 0;
}

.sidebar-brand-name {
  display: block;
  font-family: var(--font-serif);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand-sub {
  display: block;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--brand-sand);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-section-label {
  display: block;
  padding: 12px 18px 4px;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: rgba(255,255,255,.3);
  font-weight: 500;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  font-size: .78rem;
  font-weight: 400;
  color: #b0a99f;
  transition: background .15s, color .15s;
  border-radius: 0;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.sidebar-link.active {
  border-left: 2.5px solid var(--brand-gold);
  color: var(--brand-sand);
}

.sidebar-link svg { flex-shrink: 0; opacity: .7; }
.sidebar-link.active svg, .sidebar-link:hover svg { opacity: 1; }

.sidebar-link-logout {
  color: #f87171;
  margin-top: 6px;
}

.sidebar-link-logout:hover { background: rgba(239,68,68,.12); color: #f87171; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: .68rem;
  color: rgba(255,255,255,.35);
}

/* --- Main Content ----------------------------------- */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Topbar ---------------------------------------- */
.admin-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  flex: 1;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--brand-black);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--brand-black);
  padding: 4px;
}

.admin-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-gold);
  color: #fff;
  font-weight: 600;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

/* --- Content Area ---------------------------------- */
.admin-content {
  padding: 28px 28px 40px;
  flex: 1;
}

/* --- Cards / Panels -------------------------------- */
.card {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--brand-black);
  letter-spacing: .03em;
}

.card-body { padding: 22px; }

/* --- Stat Cards ------------------------------------ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: #888;
  font-weight: 500;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--brand-black);
  line-height: 1.1;
  margin: 4px 0 2px;
}
.stat-value.is-currency {
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.stat-sub { font-size: .7rem; color: #999; }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-icon-gold { background: rgba(139,111,71,.12); color: var(--brand-gold); }
.stat-icon-green { background: rgba(22,163,74,.1); color: var(--success); }
.stat-icon-red   { background: rgba(220,38,38,.1); color: var(--error); }
.stat-icon-blue  { background: rgba(3,105,161,.1); color: var(--info); }
.stat-icon-purple { background: rgba(124,58,237,.1); color: #7c3aed; }

/* --- Buttons --------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .04em;
  border: none;
  transition: all .18s;
  cursor: pointer;
  text-decoration: none;
}

.btn-sm  { padding: 6px 13px; font-size: .72rem; }
.btn-lg  { padding: 12px 26px; font-size: .85rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-primary {
  background: var(--brand-gold);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-gold2); }

.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--brand-border);
  color: var(--brand-black);
}
.btn-outline:hover { border-color: var(--brand-gold); color: var(--brand-gold); }

.btn-ghost {
  background: transparent;
  color: #666;
  padding: 6px 10px;
  gap: 5px;
  font-size: .72rem;
}
.btn-ghost:hover { color: var(--brand-gold); }

/* --- Forms ----------------------------------------- */
.form-grid { display: grid; gap: 18px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-span-2 { grid-column: span 2; }
.form-span-3 { grid-column: span 3; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: .72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #555;
}

.form-label span { color: var(--error); margin-left: 2px; }

.form-control {
  padding: 9px 13px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: .82rem;
  color: var(--brand-black);
  transition: border .18s, box-shadow .18s;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(139,111,71,.12);
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint {
  font-size: .67rem;
  color: #999;
}

.form-error-msg {
  font-size: .68rem;
  color: var(--error);
}

/* Checkbox row */
.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand-gold); }
.checkbox-group label { font-size: .8rem; color: #555; cursor: pointer; }

/* Size pills selector */
.size-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.size-pill {
  padding: 5px 12px;
  border: 1px solid var(--brand-border);
  border-radius: 20px;
  font-size: .72rem;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
  background: #fff;
}
.size-pill.selected {
  background: var(--brand-gold);
  border-color: var(--brand-gold);
  color: #fff;
}

/* Image upload zone */
.upload-zone {
  border: 2px dashed var(--brand-border);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover { border-color: var(--brand-gold); background: rgba(139,111,71,.03); }
.upload-zone input[type="file"] { display: none; }
.upload-zone-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-zone-text { font-size: .8rem; color: #888; }

.image-preview-wrap { position: relative; display: inline-block; }
.image-preview { width: 100px; height: 100px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--brand-border); }
.image-preview-del {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px;
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: .7rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

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

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}

.admin-table thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #888;
  font-weight: 500;
  border-bottom: 2px solid var(--brand-border);
  white-space: nowrap;
}

.admin-table tbody tr {
  border-bottom: 1px solid #f0ece7;
  transition: background .12s;
}
.admin-table tbody tr:hover { background: #faf8f5; }

.admin-table td {
  padding: 11px 14px;
  vertical-align: middle;
}

.product-thumb {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-border);
}

/* --- Badges / Pills -------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.badge-active   { background: rgba(22,163,74,.12); color: #15803d; }
.badge-draft    { background: rgba(107,114,128,.12); color: #4b5563; }
.badge-wh       { background: rgba(30,64,175,.1); color: #1d4ed8; }
.badge-rts      { background: rgba(139,111,71,.15); color: var(--brand-gold); }
.badge-both     { background: rgba(22,163,74,.1); color: #15803d; }
.badge-low      { background: rgba(220,38,38,.12); color: var(--error); }

/* --- Flash Messages -------------------------------- */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  margin: 14px 28px 0;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 500;
  animation: fadeSlideIn .25s ease;
}

.flash-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: .6;
}
.flash-close:hover { opacity: 1; }

/* --- Search / Filter Bar --------------------------- */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #aaa;
}
.search-input-wrap .form-control { padding-left: 34px; }

/* --- Pagination ------------------------------------ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 0 6px;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-border);
  font-size: .75rem;
  color: var(--brand-black);
  background: #fff;
  transition: all .15s;
}

.pagination a:hover { border-color: var(--brand-gold); color: var(--brand-gold); }
.pagination span.current { background: var(--brand-gold); border-color: var(--brand-gold); color: #fff; }
.pagination span.dots { border: none; background: none; pointer-events: none; color: #aaa; }

/* --- Delete Confirm Modal -------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn .2s ease;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal-icon { font-size: 2.5rem; margin-bottom: 12px; }
.modal-title { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.modal-desc  { font-size: .82rem; color: #666; margin-bottom: 24px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* --- Login Page ------------------------------------ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1A1A1A 0%, #2d2420 60%, #1A1A1A 100%);
  padding: 20px;
}

.login-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 42px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 30px;
}

.login-logo img {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brand-gold);
}

.login-brand-text { text-align: center; }
.login-brand-name {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-black);
}
.login-brand-sub {
  font-size: .62rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--brand-gold);
}

.login-heading {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand-black);
  margin-bottom: 24px;
  text-align: center;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Dashboard Page -------------------------------- */
.page-heading {
  margin-bottom: 24px;
}
.page-heading h1 {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--brand-black);
  letter-spacing: .03em;
}
.page-heading p { font-size: .8rem; color: #888; margin-top: 3px; }

/* --- Misc helpers ---------------------------------- */
.text-gold { color: var(--brand-gold); }
.text-muted { color: #888; }
.text-sm { font-size: .75rem; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.empty-state {
  padding: 60px 20px;
  text-align: center;
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-family: var(--font-serif); font-size: 1.1rem; margin-bottom: 6px; }
.empty-state p  { font-size: .8rem; color: #999; }

/* --- Animations ------------------------------------ */
@keyframes fadeIn       { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeSlideIn  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* --- Responsive ------------------------------------ */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }

  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .form-span-2, .form-span-3 { grid-column: span 1; }
}

@media (max-width: 600px) {
  .admin-content { padding: 18px 16px 30px; }
  .admin-topbar  { padding: 0 16px; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
}

/* --- Stock page colour legend ---------------------- */
.stock-bar-wrap { height: 8px; background: #f0ece7; border-radius: 4px; overflow: hidden; width: 100%; min-width: 80px; }
.stock-bar { height: 100%; border-radius: 4px; background: var(--brand-gold); transition: width .3s; }
.stock-bar.low { background: var(--error); }
.stock-bar.ok  { background: var(--success); }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle {
  position: relative;
  display: inline-block;
  width: 36px; height: 20px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #ddd;
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--brand-gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }
