/* ==========================================================================
   OCS SARL — Espace administrateur
   ========================================================================== */
:root{
  --primary: #14538A;
  --primary-dark: #0B3556;
  --primary-light: #E8F0F7;
  --accent: #E8A317;
  --accent-dark: #C4870D;
  --danger: #C6362E;
  --danger-light: #FBEAE9;
  --success: #2E7D4F;
  --success-light: #E9F5EE;

  --bg: #F4F7FA;
  --surface: #FFFFFF;
  --border: #E3E8EE;
  --text: #1C2733;
  --text-soft: #57626E;
  --text-faint: #8895A3;

  --font-heading: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20,40,60,0.06);
  --shadow-md: 0 8px 24px -8px rgba(20,40,60,0.18);
}

*, *::before, *::after{ box-sizing: border-box; }
body{
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 15px; line-height: 1.6;
}
h1,h2,h3,h4{ font-family: var(--font-heading); color: var(--primary-dark); margin: 0 0 0.5em; font-weight: 700; }
a{ color: var(--primary); text-decoration: none; }
a:hover{ text-decoration: underline; }
p{ margin: 0 0 1em; color: var(--text-soft); }
img{ max-width: 100%; display: block; }
:focus-visible{ outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ---- Disposition générale : barre latérale ---- */
.admin-shell{ display: flex; min-height: 100vh; }

.admin-sidebar{
  width: 240px; flex-shrink: 0; background: var(--primary-dark); color: rgba(255,255,255,0.85);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform 0.25s ease;
}
.sidebar-brand{ display: flex; align-items: center; gap: 10px; padding: 22px 20px; color: #fff; font-family: var(--font-heading); font-weight: 700; }
.sidebar-brand:hover{ text-decoration: none; }
.sidebar-brand img{ width: 34px; height: 34px; border-radius: 50%; }
.sidebar-brand em{ font-style: normal; color: var(--accent); }

.sidebar-nav{ flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-link{ display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); color: rgba(255,255,255,0.72); font-weight: 600; font-size: 0.92rem; }
.sidebar-link .icon{ width: 19px; height: 19px; flex-shrink: 0; }
.sidebar-link:hover{ background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar-link.active{ background: var(--accent); color: #221a06; }

.sidebar-footer{ padding: 14px 10px; border-top: 1px solid rgba(255,255,255,0.14); display: flex; flex-direction: column; gap: 2px; }
.sidebar-footer a{ display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-sm); color: rgba(255,255,255,0.65); font-size: 0.85rem; font-weight: 600; }
.sidebar-footer a:hover{ background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar-footer .icon{ width: 16px; height: 16px; }

.admin-main{ flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-width: 0; }

.admin-topbar{ height: 64px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 40; }
.sidebar-toggle{ display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 4px; }
.admin-topbar-title{ font-family: var(--font-heading); font-weight: 700; color: var(--primary-dark); flex: 1; }
.user-chip{ display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-soft); }
.user-chip .icon{ width: 20px; height: 20px; color: var(--primary); }

.admin-wrap{ max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; width: 100%; }

.sidebar-overlay{ display: none; position: fixed; inset: 0; background: rgba(11,53,86,0.5); z-index: 90; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.sidebar-overlay.visible{ opacity: 1; pointer-events: auto; }

@media (max-width: 900px){
  .admin-sidebar{ transform: translateX(-100%); }
  .admin-sidebar.open{ transform: translateX(0); }
  .admin-main{ margin-left: 0; }
  .sidebar-toggle{ display: flex; align-items: center; justify-content: center; }
  .sidebar-overlay{ display: block; }
}

/* ---- Miniatures dans les tableaux ---- */
.row-thumb{ width: 48px; height: 48px; border-radius: var(--r-sm); object-fit: cover; }
.row-thumb-empty{ width: 48px; height: 48px; border-radius: var(--r-sm); background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--text-faint); }

/* ---- Sélecteur d'images multiples (formulaire publication) ---- */
.image-thumb-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin-bottom: 14px; }
.image-thumb{ position: relative; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; cursor: default; }
.image-thumb img{ width: 100%; height: 90px; object-fit: cover; display: block; }
.image-thumb-remove{ display: flex; align-items: center; gap: 6px; padding: 7px 8px; font-size: 0.74rem; color: var(--danger); background: var(--danger-light); }
.image-thumb-remove input{ width: auto; }
.file-chosen{ display: block; font-size: 0.8rem; color: var(--text-soft); margin-top: 6px; }

/* ---- Zone de glisser-déposer ---- */
.dropzone{
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: 36px 20px;
  cursor: pointer;
  color: var(--text-soft);
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragover{
  border-color: var(--primary);
  background: var(--primary-light);
}
.dropzone .icon{ color: var(--primary); }
.dropzone-text{ font-size: 0.9rem; }
.dropzone-text strong{ color: var(--primary); }
.dropzone input[type=file]{
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- Barre de progression d'envoi ---- */
.upload-progress{ display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.upload-progress-bar{ flex: 1; height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.upload-progress-fill{ height: 100%; width: 0%; background: var(--primary); border-radius: 999px; transition: width 0.15s ease; }
.upload-progress-label{ font-size: 0.8rem; font-weight: 700; color: var(--primary); min-width: 42px; text-align: right; }

/* ---- Aperçu de l'image de fond du hero ---- */
.hero-preview-frame{ position: relative; max-width: 480px; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.hero-preview-frame img{ width: 100%; height: 220px; object-fit: cover; display: block; }
.hero-preview-overlay{
  position: absolute; inset: 0;
  background: linear-gradient(125deg, rgba(11,53,86,0.75) 0%, rgba(20,83,138,0.6) 62%, rgba(27,110,140,0.55) 100%);
}
.admin-page-head{ display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

/* ---- Cards / panels ---- */
.panel{ background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.panel h2{ font-size: 1.05rem; margin-bottom: 16px; }

.stat-cards{ display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card{ background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.stat-card .num{ font-family: var(--font-heading); font-size: 1.9rem; font-weight: 800; color: var(--primary); display: block; }
.stat-card .label{ font-size: 0.85rem; color: var(--text-soft); }
.stat-card a{ font-size: 0.82rem; }

/* ---- Buttons ---- */
.btn{
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 18px; border-radius: var(--r-sm); font-weight: 600; font-size: 0.88rem;
  border: 1.5px solid transparent; font-family: inherit; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover{ text-decoration: none; }
.btn-primary{ background: var(--primary); color: #fff; }
.btn-primary:hover{ background: var(--primary-dark); }
.btn-accent{ background: var(--accent); color: #221a06; }
.btn-accent:hover{ background: var(--accent-dark); color: #fff; }
.btn-outline{ background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover{ border-color: var(--primary); color: var(--primary); }
.btn-danger{ background: var(--danger-light); color: var(--danger); border-color: transparent; }
.btn-danger:hover{ background: var(--danger); color: #fff; }
.btn-sm{ padding: 6px 12px; font-size: 0.8rem; }
.btn[disabled]{ opacity: 0.5; cursor: not-allowed; }

/* ---- Forms ---- */
.field{ margin-bottom: 18px; }
.field label{ display: block; font-weight: 700; font-size: 0.85rem; color: var(--text); margin-bottom: 6px; }
.field .hint{ font-size: 0.78rem; color: var(--text-faint); margin-top: 5px; }
input[type=text], input[type=password], input[type=date], input[type=file], select, textarea{
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-family: inherit; font-size: 0.92rem; color: var(--text); background: #fff;
}
input:focus, select:focus, textarea:focus{ outline: none; border-color: var(--primary); }
textarea{ resize: vertical; min-height: 100px; }
.form-row{ display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-actions{ display: flex; gap: 12px; margin-top: 8px; }

/* ---- Tables ---- */
table{ width: 100%; border-collapse: collapse; }
th, td{ text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: top; }
th{ font-family: var(--font-heading); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); }
tr:last-child td{ border-bottom: none; }
td.actions{ white-space: nowrap; text-align: right; }
td.actions .btn{ margin-left: 6px; }
.badge{ display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge-success{ background: var(--success-light); color: var(--success); }
.badge-muted{ background: var(--bg); color: var(--text-faint); }
.badge-primary{ background: var(--primary-light); color: var(--primary); }
.empty-row{ text-align: center; color: var(--text-faint); padding: 32px; }

/* ---- Alerts ---- */
.alert{ padding: 14px 18px; border-radius: var(--r-md); margin-bottom: 20px; font-size: 0.9rem; }
.alert-success{ background: var(--success-light); color: var(--success); }
.alert-danger{ background: var(--danger-light); color: var(--danger); }

/* ---- Login / setup screens ---- */
.auth-screen{ min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); padding: 20px; }
.auth-card{ background: #fff; border-radius: var(--r-lg); padding: 40px 36px; width: 100%; max-width: 400px; box-shadow: 0 30px 60px -20px rgba(11,53,86,0.5); }
.auth-card img{ width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 16px; }
.auth-card h1{ font-size: 1.3rem; text-align: center; margin-bottom: 4px; }
.auth-card .sub{ text-align: center; font-size: 0.85rem; color: var(--text-faint); margin-bottom: 24px; }
.auth-card .btn{ width: 100%; justify-content: center; }

/* ---- Cloud file list ---- */
.file-row{ display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.file-row:last-child{ border-bottom: none; }
.file-icon{ width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-name{ font-weight: 700; font-size: 0.9rem; word-break: break-word; }
.file-meta{ font-size: 0.78rem; color: var(--text-faint); }
.file-row .grow{ flex: 1; min-width: 0; }

.icon{ width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 720px){
  .form-row{ grid-template-columns: 1fr; }
  .admin-wrap{ padding: 20px 16px 48px; }
  th, td{ padding: 10px 8px; font-size: 0.82rem; }
}
