/* ==========================================================================
   Administration - Le Piedestal
   Feuille de style autonome, dans la continuite du site public.
   ========================================================================== */

:root {
  --void: #0d0c0b;
  --void-2: #141311;
  --panel: #1a1816;
  --panel-2: #211e1b;
  --hairline: rgba(255, 246, 222, 0.11);
  --pearl: #f4efe3;
  --mut: #a49b8b;
  --mut-dim: #6f6759;
  --gold: #cda44d;
  --gold-soft: rgba(205, 164, 77, 0.16);
  --ok: #5fae72;
  --warn: #d99b3c;
  --err: #cf5b4e;
  --info: #5b8fcf;
  --etsy: #f1641e;
  --ebay: #4a7dff;
  --radius: 4px;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--pearl);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
}

a {
  color: var(--gold);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 0.6rem;
  letter-spacing: 0.01em;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

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

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--void-2);
  border-right: 1px solid var(--hairline);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--pearl);
  padding: 0 1.4rem 1.2rem;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 1rem;
  display: block;
}
.sidebar .brand span {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 0.2rem;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}
.sidebar nav a {
  padding: 0.62rem 1.4rem;
  color: var(--mut);
  font-size: 0.82rem;
  border-left: 2px solid transparent;
}
.sidebar nav a:hover {
  color: var(--pearl);
  background: var(--panel);
  text-decoration: none;
}
.sidebar nav a.is-active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: var(--gold-soft);
}
.sidebar nav .nav-sep {
  margin-top: 1rem;
  padding: 0 1.4rem 0.35rem;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mut-dim);
}
.sidebar-foot {
  padding: 1rem 1.4rem 0;
  border-top: 1px solid var(--hairline);
  font-size: 0.75rem;
  color: var(--mut-dim);
}
.sidebar-foot strong {
  display: block;
  color: var(--pearl);
  font-weight: 500;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 1.8rem 2.2rem 4rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.page-head p.sub {
  color: var(--mut);
  margin: 0.2rem 0 0;
  font-size: 0.86rem;
}

/* ---------------------------------- Boutons ------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.55rem 1.05rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--pearl);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-decoration: none;
}
.btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  text-decoration: none;
}
.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--void);
}
.btn-gold:hover {
  background: #d9b263;
  border-color: #d9b263;
  color: var(--void);
}
.btn-danger {
  border-color: rgba(207, 91, 78, 0.5);
  color: var(--err);
}
.btn-danger:hover {
  background: rgba(207, 91, 78, 0.12);
  border-color: var(--err);
  color: var(--err);
}
.btn-sm {
  padding: 0.34rem 0.7rem;
  font-size: 0.72rem;
}
.btn:disabled,
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------------------------------- Cartes -------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1.4rem;
}
.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}
.card .card-help {
  color: var(--mut);
  font-size: 0.82rem;
  margin: -0.2rem 0 1.1rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.stat .label {
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mut-dim);
}
.stat .value {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.1;
  margin-top: 0.3rem;
}
.stat .value.sm {
  font-size: 1.3rem;
}

/* ---------------------------------- Formulaires --------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field.full {
  grid-column: 1 / -1;
}
label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mut);
}
.field .hint {
  font-size: 0.75rem;
  color: var(--mut-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="date"],
select,
textarea {
  width: 100%;
  background: var(--void-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--pearl);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  padding: 0.55rem 0.7rem;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
}
textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}
input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 2px;
  background: var(--void-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}
input[type="file"] {
  font-size: 0.82rem;
  color: var(--mut);
}
.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-direction: row;
}
.check label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--pearl);
}
.form-actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--hairline);
}

/* ---------------------------------- Tableaux ------------------------------ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--panel);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.data th {
  text-align: left;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mut-dim);
  font-weight: 600;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
table.data td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(255, 246, 222, 0.05);
  vertical-align: middle;
}
table.data tr:last-child td {
  border-bottom: none;
}
table.data tbody tr:hover {
  background: var(--panel-2);
}
table.data td.actions {
  white-space: nowrap;
  text-align: right;
}
table.data td.actions a,
table.data td.actions button {
  margin-left: 0.3rem;
}
.thumb-cell {
  width: 52px;
  height: 52px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--void-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb-cell svg {
  width: 70%;
}

/* ---------------------------------- Badges -------------------------------- */
.badge {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.22rem 0.5rem;
  border-radius: 2px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok      { color: var(--ok);   border-color: rgba(95, 174, 114, 0.45); background: rgba(95, 174, 114, 0.1); }
.badge-warn    { color: var(--warn); border-color: rgba(217, 155, 60, 0.45); background: rgba(217, 155, 60, 0.1); }
.badge-err     { color: var(--err);  border-color: rgba(207, 91, 78, 0.45);  background: rgba(207, 91, 78, 0.1); }
.badge-mut     { color: var(--mut);  border-color: var(--hairline);          background: var(--void-2); }
.badge-info    { color: var(--info); border-color: rgba(91, 143, 207, 0.45); background: rgba(91, 143, 207, 0.1); }
.badge-etsy    { color: var(--etsy); border-color: rgba(241, 100, 30, 0.45); background: rgba(241, 100, 30, 0.1); }
.badge-ebay    { color: var(--ebay); border-color: rgba(74, 125, 255, 0.45); background: rgba(74, 125, 255, 0.1); }

/* ---------------------------------- Messages ------------------------------ */
.flash {
  border: 1px solid var(--hairline);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.86rem;
  background: var(--panel);
}
.flash-success { border-left-color: var(--ok);   color: #b8e0c3; }
.flash-error   { border-left-color: var(--err);  color: #eeb4ad; }
.flash-warning { border-left-color: var(--warn); color: #edd0a2; }
.flash-info    { border-left-color: var(--info); color: #b9d1ee; }

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--mut);
}

/* ---------------------------------- Filtres / barre outils ---------------- */
.toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.1rem;
}
.toolbar input[type="search"],
.toolbar select {
  width: auto;
  min-width: 160px;
}

/* ---------------------------------- Galerie d'images admin ---------------- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.9rem;
}
.image-item {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--void-2);
}
.image-item.is-main {
  border-color: var(--gold);
}
.image-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.image-item .image-actions {
  display: flex;
  gap: 0.3rem;
  padding: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}
.image-item .main-flag {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------------------------------- Page de connexion --------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(circle at 50% 20%, rgba(205, 164, 77, 0.07), transparent 55%), var(--void);
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 2.2rem 2rem;
}
.login-box .brand {
  font-family: var(--font-display);
  font-size: 1.8rem;
  text-align: center;
  display: block;
  margin-bottom: 0.2rem;
  color: var(--pearl);
}
.login-box .brand-sub {
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.8rem;
}
.login-box .field {
  margin-bottom: 1rem;
}
.login-box .btn {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}
.login-foot {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.78rem;
  color: var(--mut-dim);
}

/* ---------------------------------- Divers -------------------------------- */
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}
.muted {
  color: var(--mut);
}
.dim {
  color: var(--mut-dim);
}
.nowrap {
  white-space: nowrap;
}
.right {
  text-align: right;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
}
details.log-detail summary {
  cursor: pointer;
  color: var(--mut);
  font-size: 0.8rem;
}
details.log-detail pre {
  background: var(--void-2);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 0.7rem;
  overflow-x: auto;
  font-size: 0.75rem;
  max-height: 320px;
}

@media (max-width: 900px) {
  .admin-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
  }
  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar nav .nav-sep {
    display: none;
  }
  .content {
    padding: 1.4rem 1.1rem 3rem;
  }
  .split {
    grid-template-columns: 1fr;
  }
}
