/* ===========================================================================
   admin.css — Espace d'administration cert.sophiemanessiez.com
   =========================================================================== */

:root {
  --bg:        #fafaf8;
  --surface:   #ffffff;
  --border:    #e5e2dc;
  --text:      #1c1c1c;
  --muted:     #8c8a83;
  --accent:    #1c1c1c;
  --accent-2:  #846a3a;          /* terre / ocre */
  --success:   #2f6b3b;
  --danger:    #b03030;
  --warning:   #b07a1c;
  --radius:    6px;
  --radius-lg: 10px;
  --shadow:    0 1px 3px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.08);
  --font:      -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono:      ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .9em; background: rgba(0,0,0,.04); padding: .1em .35em; border-radius: 3px; }
small { color: var(--muted); }

h1 { font-size: 1.7rem; font-weight: 600; margin: 0 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem;   font-weight: 600; margin: 0 0 .5rem; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: .8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  justify-content: space-between;
}
.topbar .brand {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  text-decoration: none;
  color: var(--text);
}
.topbar .brand strong { font-size: 1.05rem; letter-spacing: -.01em; }
.topbar .brand span { color: var(--muted); font-size: .85rem; }
.topnav {
  display: flex; align-items: center; gap: .8rem;
  font-size: .9rem;
}
.topnav a { color: var(--text); padding: .3rem .5rem; border-radius: var(--radius); }
.topnav a:hover { background: rgba(0,0,0,.04); text-decoration: none; }
.topnav .sep { color: var(--border); }
.topnav .user { color: var(--muted); font-size: .85rem; }
.topnav .logout { color: var(--danger); }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 4rem;
}

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-box {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 380px;
}
.login-box h1 {
  margin: 0 0 .25rem;
  text-align: center;
  font-size: 1.25rem;
}
.login-sub {
  text-align: center;
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: .85rem;
}
.login-box label { display: block; margin: .8rem 0 .25rem; font-size: .85rem; font-weight: 500; }
.login-box input { width: 100%; }
.login-box button { width: 100%; margin-top: 1.5rem; padding: .75rem; }

/* ---------- Flash messages ---------- */
.flash {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin: 0 0 1rem;
  font-size: .9rem;
  border: 1px solid;
}
.flash code { background: rgba(0,0,0,.06); }
.flash-success { background: #f2f8f3; border-color: #c9e0ce; color: #1f4a2a; }
.flash-error   { background: #fcf2f2; border-color: #e8c8c8; color: #7a1f1f; }
.flash-info    { background: #f3f6fb; border-color: #d2dde9; color: #1f3a5a; }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  text-align: center;
}
.stat-num {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--accent);
}
.stat-label {
  font-size: .8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: .15rem;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  flex-wrap: wrap;
}
.filters {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.filters input[type=search] { min-width: 260px; }
.toolbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Forms ---------- */
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], select, textarea {
  font: inherit;
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: -1px;
  border-color: var(--accent-2);
}
textarea { width: 100%; min-height: 80px; font-family: var(--font); resize: vertical; }
label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  margin: .9rem 0 .25rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.req { color: var(--danger); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.row-3 > div > input, .row-3 > div > select,
.row-4 > div > input, .row-4 > div > select { width: 100%; }
.dim-imp { display: block; margin-top: .15rem; font-size: .75rem; }
@media (max-width: 800px) {
  .row-3, .row-4 { grid-template-columns: 1fr 1fr; }
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem 1.5rem;
  margin: 0 0 1.2rem;
  background: var(--surface);
}
fieldset > input, fieldset > textarea, fieldset > select { width: 100%; }
fieldset > .row-2 > div > input,
fieldset > .row-2 > div > select { width: 100%; }
legend {
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0 .5rem;
  color: var(--muted);
}

.form-inline label { margin-top: .75rem; }
.form-inline input { width: 100%; }

.form-actions {
  margin-top: 1.2rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* ---------- Buttons ---------- */
button, .btn-primary, .btn-secondary, .btn-link, .btn-danger {
  font: inherit;
  display: inline-block;
  padding: .55rem 1.1rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background .12s ease;
}
button:hover, .btn-secondary:hover { background: #f0ede7; text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #000; text-decoration: none; }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #8c1f1f; text-decoration: none; }
.btn-link {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: .55rem .5rem;
}
.btn-link:hover { color: var(--text); background: transparent; text-decoration: underline; }

/* ---------- Tableau "grid" ---------- */
.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.grid th, .grid td {
  text-align: left;
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.grid th {
  background: #f3f0ea;
  font-weight: 600;
  font-size: .8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.grid tr:last-child td { border-bottom: 0; }
.grid tr:hover td { background: #fbf9f5; }

.thumb-cell { width: 56px; }
.thumb-cell img {
  width: 48px; height: 48px; object-fit: cover;
  border-radius: 4px; display: block;
}
.thumb-empty {
  width: 48px; height: 48px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  background: #f4f1ec;
}

.actions a {
  display: inline-block;
  font-size: .8rem;
  padding: .2rem .5rem;
  border-radius: 3px;
  margin-right: .25rem;
  background: rgba(0,0,0,.04);
}

/* ---------- Badges statut ---------- */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .02em;
}
.badge-disponible { background: #e7f1eb; color: #1f4a2a; }
.badge-acquise    { background: #efe6d4; color: #5a3f15; }
.badge-exposee    { background: #e6eef6; color: #1f3d5a; }
.badge-pretee     { background: #f0ebf6; color: #432a5a; }
.badge-restauree  { background: #fcf5e1; color: #5a4015; }
.badge-detruite   { background: #f7e1e1; color: #6b1f1f; }
.badge-perdue     { background: #ececec; color: #444; }

/* ---------- Page-head ---------- */
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.page-head h1 small { font-weight: 400; color: var(--muted); margin-left: .5rem; }
.page-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Edit grid (form + side panels) ---------- */
.edit-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .edit-grid { grid-template-columns: 1fr; }
  .row-2     { grid-template-columns: 1fr; }
}

.side { display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 1rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}
.muted { color: var(--muted); }

/* ---------- Photos ---------- */
.photos-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.photos-list li {
  display: flex;
  gap: .75rem;
  padding: .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.photos-list img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.photo-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .85rem;
}
.photo-meta input[type=text] { width: 100%; padding: .25rem .4rem; font-size: .85rem; }
.photo-meta label { margin: 0; font-size: .75rem; text-transform: none; display: inline; color: var(--text); cursor: pointer; }
.photo-meta button { padding: .15rem .4rem; font-size: .75rem; align-self: flex-start; color: var(--danger); border-color: #e8c8c8; }
.photo-uploading { padding: .5rem; color: var(--muted); font-style: italic; font-size: .85rem; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s ease;
}
.dropzone.drag-over { background: #f0ede7; border-color: var(--accent-2); }
.dropzone p { margin: .2rem 0; }
.dropzone .hint { font-size: .75rem; opacity: .8; }

/* ---------- Historique (admin) ---------- */
.history {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: .85rem;
}
.history li {
  padding: .6rem 0;
  border-bottom: 1px dashed var(--border);
}
.history li:last-child { border-bottom: 0; }
.hev-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
}
.hev-head small { color: var(--muted); }

/* ---------- Hints contextuels au statut ---------- */
.status-hint {
  margin: 1rem 0 0;
  padding: .7rem 1rem;
  background: #f3f6fb;
  border-left: 3px solid #6a8bbf;
  color: #1f3a5a;
  border-radius: 4px;
  font-size: .85rem;
}
.status-hint strong { display: block; margin-bottom: .15rem; }
.status-hint em { font-style: italic; }
.status-hint.warning {
  background: #fcf2f2;
  border-left-color: var(--danger);
  color: #7a1f1f;
}
[hidden] { display: none !important; }

/* ---------- Onglets FR / EN ---------- */
.tabs {
  display: flex;
  gap: 0;
  margin: 0 0 1rem;
  border-bottom: 1px solid var(--border);
}
.tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: .6rem 1.2rem;
  color: var(--muted);
  font-size: .9rem;
  border-radius: 0;
  cursor: pointer;
}
.tab:hover {
  background: transparent;
  color: var(--text);
  text-decoration: none;
}
.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent-2);
  font-weight: 600;
}
.tab-pane { padding-top: .3rem; }

/* ---------- Localisations ---------- */
.loc-current {
  background: #f3f0ea;
  border-left: 3px solid var(--accent-2);
  padding: .6rem .8rem;
  margin: 0 0 1rem;
  border-radius: 4px;
  font-size: .9rem;
}
.loc-add {
  margin: 0 0 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .8rem;
}
.loc-add > summary {
  cursor: pointer;
  font-size: .9rem;
  color: var(--muted);
  font-weight: 500;
}
.loc-add > summary:hover { color: var(--text); }
.loc-form { padding: .8rem 0 0; }
.loc-form input, .loc-form select, .loc-form textarea { width: 100%; }
.loc-form .inline { display: flex; align-items: center; gap: .4rem; font-size: .85rem; margin-top: .6rem; }
.loc-form .inline input { width: auto; }

.loc-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  font-size: .85rem;
}
.loc-list > li {
  padding: .6rem 0;
  border-bottom: 1px dashed var(--border);
}
.loc-list > li:last-child { border-bottom: 0; }
.loc-line { margin-bottom: .15rem; }
.loc-line .badge { margin-right: .3rem; }
.loc-notes {
  font-style: italic;
  color: var(--muted);
  margin-top: .2rem;
}
.loc-actions {
  margin-top: .25rem;
  display: flex;
  gap: .5rem;
}
.loc-actions button { font-size: .75rem; padding: .15rem .4rem; }

/* Badges de localisations */
.badge-loc-atelier        { background: #efe6d4; color: #5a3f15; }
.badge-loc-exposition     { background: #e6eef6; color: #1f3d5a; }
.badge-loc-galerie        { background: #f0ebf6; color: #432a5a; }
.badge-loc-stockage       { background: #ececec; color: #444; }
.badge-loc-pret           { background: #f7e9dc; color: #6b3a15; }
.badge-loc-chez_acquereur { background: #e7f1eb; color: #1f4a2a; }
.badge-loc-transport      { background: #fcf5e1; color: #5a4015; }
.badge-loc-autre          { background: #ececec; color: #444; }
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .02em;
}

/* ---------- Empty state ---------- */
.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}
.empty p { margin: 0 0 1rem; }
