/* ============================================
   L'OREENE — ADMIN PANEL
   ============================================ */

.admin-body {
  background: #f6f4ef;
  min-height: 100vh;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  background: var(--c-ink);
  color: #c8bfb2;
  padding: 36px 26px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-sidebar .logo {
  color: var(--c-bg);
  text-align: left;
  margin-bottom: 50px;
  grid-column: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.admin-sidebar .logo img {
  height: 70px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  background: transparent;
}
.admin-sidebar .logo small {
  display: block;
  font-family: var(--ff-sans);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--c-gold-light);
  margin-top: 6px;
  font-weight: 400;
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #c8bfb2;
  border-radius: 4px;
  transition: all .3s var(--ease);
}
.admin-nav a:hover { background: rgba(255,255,255,0.04); color: var(--c-bg); }
.admin-nav a.active { background: rgba(184, 153, 104, 0.12); color: var(--c-gold-light); }
.admin-nav a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; }

.admin-sidebar-foot {
  margin-top: auto;
  padding-top: 30px;
  border-top: 1px solid rgba(220, 211, 195, 0.1);
  font-size: 12px;
  color: #80766a;
}
.admin-sidebar-foot a { color: var(--c-gold-light); display: inline-block; margin-top: 8px; }

/* Main */
.admin-main { padding: 40px 50px; }
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 20px;
}
.admin-topbar h1 {
  font-family: var(--ff-display);
  font-size: 2.2rem;
  font-weight: 400;
}
.admin-topbar p { color: var(--c-muted); font-size: 14px; margin-top: 6px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--c-ink);
  color: var(--c-bg);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
  transition: background .3s var(--ease);
  cursor: pointer;
  border: none;
}
.btn-primary:hover { background: var(--c-gold-deep); color: var(--c-bg); }
.btn-primary svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

.btn-ghost-admin {
  padding: 12px 22px;
  border: 1px solid var(--c-line);
  background: var(--c-bg);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--c-ink-soft);
  transition: all .3s var(--ease);
  cursor: pointer;
}
.btn-ghost-admin:hover { border-color: var(--c-ink); color: var(--c-ink); }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}
.stat-card {
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card .label {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--c-muted);
  font-weight: 500;
}
.stat-card .value {
  font-family: var(--ff-display);
  font-size: 2rem;
  color: var(--c-ink);
  font-weight: 400;
}
.stat-card .value small { font-size: 0.8rem; color: var(--c-muted); margin-left: 4px; }
.stat-card.gold { border-left: 3px solid var(--c-gold-deep); }

/* Table */
.table-wrap {
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  overflow: hidden;
}
.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--c-line);
  gap: 16px;
  flex-wrap: wrap;
}
.table-head h2 { font-family: var(--ff-display); font-size: 1.4rem; font-weight: 400; }
.search-input {
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--c-line);
  background: var(--c-bg-alt) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%238a8178" stroke-width="1.5"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>') no-repeat 14px center;
  font-size: 13px;
  color: var(--c-ink);
  outline: none;
  min-width: 260px;
  transition: border-color .3s var(--ease);
}
.search-input:focus { border-color: var(--c-gold-deep); }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--c-muted);
  padding: 16px 24px;
  background: var(--c-bg-alt);
  border-bottom: 1px solid var(--c-line);
}
tbody td {
  padding: 18px 24px;
  border-bottom: 1px solid var(--c-line);
  vertical-align: middle;
  font-size: 14px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .2s var(--ease); }
tbody tr:hover { background: var(--c-bg-alt); }

.cell-product { display: flex; align-items: center; gap: 16px; }
.cell-thumb {
  width: 56px; height: 56px;
  background: var(--c-cream);
  overflow: hidden;
  flex-shrink: 0;
}
.cell-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cell-name { font-family: var(--ff-display); font-size: 1.1rem; font-weight: 400; color: var(--c-ink); }
.cell-sub { font-size: 12px; color: var(--c-muted); margin-top: 2px; }

.badge {
  display: inline-block;
  padding: 5px 12px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  background: var(--c-bg-alt);
  color: var(--c-ink-soft);
  border: 1px solid var(--c-line);
}
.badge.gold { color: var(--c-gold-deep); border-color: var(--c-gold-light); background: #faf4e9; }
.badge.success { color: #4a7a3a; border-color: #c7d9b8; background: #eef5e8; }
.badge.danger { color: #8a3a2a; border-color: #e3c6bf; background: #f6e7e3; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.action-btn {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--c-line);
  background: var(--c-bg);
  transition: all .25s var(--ease);
  cursor: pointer;
}
.action-btn:hover { border-color: var(--c-ink); color: var(--c-ink); background: var(--c-bg-alt); }
.action-btn.danger:hover { border-color: #8a3a2a; color: #8a3a2a; }
.action-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.5; }

/* Modal / Drawer form */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 22, 19, 0.5);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.drawer-panel {
  position: relative;
  background: var(--c-bg);
  width: 100%;
  max-width: 640px;
  height: 100%;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .45s var(--ease);
  padding: 40px 44px;
}
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-overlay { opacity: 1; }
.drawer.open .drawer-panel { transform: translateX(0); }

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 36px;
}
.drawer-head h2 {
  font-family: var(--ff-display);
  font-size: 1.8rem;
  font-weight: 400;
}
.drawer-head p { color: var(--c-muted); font-size: 13px; margin-top: 6px; }
.drawer-close {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .3s var(--ease);
  cursor: pointer;
}
.drawer-close:hover { background: var(--c-cream); }
.drawer-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; }

.field { margin-bottom: 24px; }
.field label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--c-muted);
  margin-bottom: 10px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--c-line);
  background: var(--c-white);
  font-family: inherit;
  font-size: 14px;
  color: var(--c-ink);
  outline: none;
  transition: border-color .3s var(--ease);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--c-gold-deep); }

.fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.image-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--c-line);
  background: var(--c-bg-alt);
}
.image-picker label {
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--c-cream);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  margin: 0;
  border: 2px solid transparent;
  transition: border-color .2s var(--ease);
}
.image-picker label img { width: 100%; height: 100%; object-fit: cover; }
.image-picker input { display: none; }
.image-picker input:checked + img { }
.image-picker label:has(input:checked) {
  border-color: var(--c-gold-deep);
}
.image-picker label:has(input:checked)::after {
  content: '✓';
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  background: var(--c-gold-deep);
  color: var(--c-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.custom-url {
  margin-top: 10px;
  font-size: 12px;
  color: var(--c-muted);
}

.drawer-foot {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--c-line);
}

/* Auth screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--c-bg);
}
.auth-card {
  background: var(--c-white);
  padding: 60px 50px;
  max-width: 440px;
  width: 100%;
  border: 1px solid var(--c-line);
  text-align: center;
}
.auth-card .logo {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  grid-column: auto;
}
.auth-card .logo img { height: 100px; width: auto; object-fit: contain; background: transparent; }
.auth-card .eyebrow { margin-bottom: 30px; display: inline-block; }
.auth-card h2 { font-family: var(--ff-display); font-size: 1.6rem; margin-bottom: 8px; font-weight: 400; }
.auth-card p { color: var(--c-muted); font-size: 13px; margin-bottom: 30px; }
.auth-card .field { text-align: left; }
.auth-card .btn-primary { width: 100%; justify-content: center; margin-top: 10px; }
.auth-hint { margin-top: 20px; font-size: 11px; color: var(--c-muted); letter-spacing: 0.08em; }
.auth-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: #f6e7e3;
  border: 1px solid #e3c6bf;
  color: #8a3a2a;
  font-size: 12px;
  display: none;
}
.auth-error.visible { display: block; }

/* Toast */
.toast {
  position: fixed;
  bottom: 30px; right: 30px;
  background: var(--c-ink);
  color: var(--c-bg);
  padding: 16px 24px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  z-index: 2000;
  transform: translateY(20px);
  opacity: 0;
  transition: all .4s var(--ease);
  border-left: 3px solid var(--c-gold);
}
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.success { border-left-color: #7fb069; }
.toast.error { border-left-color: #c54b3a; }

/* Mobile */
@media (max-width: 960px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    padding: 20px;
    overflow-x: auto;
  }
  .admin-sidebar .logo { margin-bottom: 0; margin-right: 20px; white-space: nowrap; }
  .admin-nav { flex-direction: row; }
  .admin-nav a { padding: 10px 14px; }
  .admin-sidebar-foot { display: none; }
  .admin-main { padding: 30px 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .drawer-panel { padding: 30px 22px; }
  .fields-row { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 720px; }
}
