/* =====================================================================
   Skill Design Studio — Back office (admin)
   Charte : navy + orange accent, fonds clairs. Sobre et pro.
   ===================================================================== */

:root {
  --navy:        #16243d;
  --navy-2:      #1f3354;
  --orange:      #f0531f;
  --orange-dark: #d8430f;
  --teal:        #0a8f5a;
  --green:       #39b54a;

  --bg:          #f4f6f8;
  --panel:       #ffffff;
  --line:        #e5e9ef;
  --muted:       #8a93a3;
  --text:        #16243d;

  --radius:      14px;
  --radius-sm:   9px;
  --shadow:      0 10px 30px rgba(22, 36, 61, 0.08);
  --shadow-sm:   0 2px 8px rgba(22, 36, 61, 0.06);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Anciennement monospace ; on garde la même typo d'interface, plus classique. */
  --mono: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- Boutons -------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); text-decoration: none; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-ghost:hover { border-color: #cdd5e0; text-decoration: none; }
.btn-danger { background: #fff; border-color: #f3c4b6; color: var(--orange-dark); }
.btn-danger:hover { background: #fff5f1; text-decoration: none; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- Champs --------------------------------------------------------- */
label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 6px; }
.input, input[type=text], input[type=password], input[type=search], textarea, select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: #fff;
}
.input:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(240, 83, 31, .12);
}
textarea { resize: vertical; min-height: 90px; }

/* ---- Messages flash ------------------------------------------------- */
.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; }
.flash-success { background: #e9f9ef; color: #136c39; }
.flash-error   { background: #fdece6; color: var(--orange-dark); }
.flash-info    { background: #eaf0fb; color: var(--navy-2); }

/* =====================================================================
   Page de connexion (login.php)
   ===================================================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 400px at 50% -120px, rgba(240,83,31,.07), transparent 70%),
    var(--bg);
}
.login-logo { margin-bottom: 26px; }
.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 32px;
}
.login-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--orange);
  margin: 0 0 6px;
}
.login-card h1 { margin: 0 0 6px; font-size: 25px; color: var(--navy); }
.login-card .sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { margin-top: 6px; }
.login-foot {
  text-align: center;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* =====================================================================
   Layout back office (topbar + sidebar + contenu)
   ===================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title strong { display: block; font-size: 18px; color: var(--navy); }
.topbar-title span { font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.search input {
  width: 280px;
  max-width: 40vw;
  padding: 9px 13px 9px 32px;
  background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a93a3' stroke-width='2'><circle cx='7' cy='7' r='5'/><path d='M11 11l4 4'/></svg>") no-repeat 10px center;
  border-color: transparent;
}

.layout { display: flex; align-items: flex-start; min-height: calc(100vh - 59px); }
.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: #fff;
  border-right: 1px solid var(--line);
  min-height: calc(100vh - 59px);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 59px;
}
.brand { display: block; padding: 4px 8px 20px; }
.nav-label {
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 8px 8px;
}
.nav-item {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--navy);
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg); text-decoration: none; }
.nav-item.active { background: #fdece6; color: var(--orange-dark); }
.nav-main { font-weight: 600; font-size: 14px; }
.nav-sub { font-size: 11.5px; color: var(--muted); }
.nav-item.active .nav-sub { color: #d8806a; }
.nav-item .badge {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: var(--navy); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px;
}
.sidebar-user {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-top: 1px solid var(--line); padding-top: 16px;
}
.sidebar-user .avatar {
  width: 34px; height: 34px; border-radius: 9px; background: var(--navy);
  color: #fff; display: grid; place-items: center; font-weight: 700;
}
.sidebar-user .who { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-user .who strong { font-size: 13px; }
.sidebar-user .who em { font-style: normal; font-size: 11.5px; color: var(--teal); }
.sidebar-user .logout { margin-left: auto; color: var(--muted); font-size: 17px; text-decoration: none; }
.sidebar-user .logout:hover { color: var(--orange); }

.content { flex: 1 1 auto; min-width: 0; padding: 26px 30px; }

/* ---- Cartes statistiques ------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.stat .stat-head { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.stat .stat-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--bg); }
.stat .stat-num { font-size: 32px; font-weight: 800; color: var(--navy); margin-top: 8px; }

/* ---- En-têtes de section ------------------------------------------- */
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 16px; }
.section-head h2 { font-size: 17px; margin: 0; color: var(--navy); }
.section-head .count { color: var(--muted); font-size: 14px; }

/* ---- Grille de projets --------------------------------------------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.project-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); text-decoration: none; color: inherit;
  display: flex; flex-direction: column; transition: box-shadow .15s, transform .08s;
}
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.project-thumb {
  height: 128px; background: linear-gradient(160deg, #16243d, #1f3354);
  position: relative; padding: 16px;
}
.project-thumb.has-image {
  background-size: cover; background-position: top center; background-repeat: no-repeat;
  padding: 0;
}
.project-thumb .pill {
  position: absolute; top: 12px; left: 12px; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; background: rgba(255,255,255,.16); color: #fff;
}
.pill.st-en_ligne { background: #2ecf6f; }
.pill.st-a_valider { background: #4d9bff; }
.pill.st-brouillon { background: #f2b34a; color: #3a2a04; }
.skeleton-line { height: 8px; border-radius: 5px; background: rgba(255,255,255,.85); margin-bottom: 8px; }
.skeleton-line.short { width: 45%; background: var(--orange); }
.skeleton-line.mid { width: 70%; background: rgba(255,255,255,.4); }
.project-body { padding: 14px 16px; display: flex; align-items: center; gap: 11px; }
.project-body .pavatar { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 700; flex: 0 0 auto; }
.project-body .ptitle { font-weight: 700; color: var(--navy); }
.project-body .pslug { font-family: var(--mono); font-size: 12px; color: var(--orange); }
.project-foot {
  border-top: 1px solid var(--line); padding: 11px 16px;
  display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted);
}

.empty {
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 48px; text-align: center; color: var(--muted);
}

/* ---- Filtres ------------------------------------------------------- */
.filters { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line); background: #fff;
  font-size: 13px; font-weight: 600; color: var(--navy); cursor: pointer; text-decoration: none;
}
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* =====================================================================
   Formulaire projet (projet.php)
   ===================================================================== */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head .back { color: var(--muted); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.panel h3 { margin: 0 0 16px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.field { margin-bottom: 16px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; }
.accent-picker {
  flex: 0 0 44px; width: 44px; height: 42px; padding: 4px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { display: none; }
.toggle .track { width: 44px; height: 24px; border-radius: 13px; background: #d3dae4; position: relative; transition: background .15s; }
.toggle .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle input:checked + .track { background: var(--orange); }
.toggle input:checked + .track::after { left: 23px; }
.seg { display: flex; width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg label { margin: 0; flex: 1; }
.seg input { display: none; }
.seg span { display: block; text-align: center; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--navy); }
.seg input:checked + span { background: var(--orange); color: #fff; }
.seg.studio input:checked + span { background: var(--navy); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.delete-form { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }

/* =====================================================================
   Panneau de gestion des maquettes
   ===================================================================== */
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel-head h3 { margin: 0; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.maq-section-block { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.maq-section-block:first-of-type { border-top: 0; }
.maq-section-block.dragging-sec { opacity: .6; }
.maq-section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sec-handle { cursor: grab; color: var(--muted); }
.sec-name, .sec-name-default {
  width: auto; min-width: 120px; max-width: 280px; font-weight: 700; color: var(--navy);
  border: 1px solid transparent; background: transparent; padding: 4px 8px;
}
.sec-name:hover, .sec-name-default:hover { border-color: var(--line); }
.sec-name-default::placeholder { color: var(--muted); font-weight: 700; }
.sec-label { font-weight: 700; color: var(--navy); }
.sec-count {
  background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 700;
  min-width: 22px; text-align: center; border-radius: 11px; padding: 2px 8px;
}
.sec-delete {
  margin-left: auto; border: none; background: none; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 6px;
}
.sec-delete:hover { background: #fdece6; color: var(--orange-dark); }

.maq-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.maq-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  background: #fff; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
}
.maq-card.dragging { opacity: .4; }
.maq-thumb {
  height: 230px; background: #0e1726; overflow: hidden; position: relative;
}
.maq-num {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 5px; line-height: 1.2;
}
.maq-cbadge {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  display: inline-flex; align-items: center; gap: 3px; line-height: 1;
  background: var(--orange); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 7px; border-radius: 20px;
}
.maq-cbadge svg { display: block; }
.maq-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.maq-meta { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.maq-label, .maq-section { padding: 6px 8px; font-size: 12.5px; }
.maq-actions {
  display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--line);
}
.maq-handle { cursor: grab; color: var(--muted); margin-right: auto; }
.maq-replace, .maq-delete {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer;
  width: 28px; height: 28px; display: grid; place-items: center; font-size: 13px;
}
.maq-replace:hover { border-color: var(--orange); color: var(--orange); }
.maq-delete:hover { border-color: #f3c4b6; background: #fff5f1; }

.maq-drop {
  border: 2px dashed #cdd5e0; border-radius: var(--radius-sm); min-height: 150px;
  display: grid; place-items: center; text-align: center; color: var(--muted);
  font-size: 12.5px; cursor: pointer; transition: border-color .15s, background .15s; line-height: 1.6;
}
.maq-drop:hover, .maq-drop.over { border-color: var(--orange); background: #fff7f3; color: var(--orange-dark); }
.maq-drop.busy { opacity: .6; pointer-events: none; }

.maq-empty { text-align: center; color: var(--muted); padding: 32px 16px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.maq-empty p { margin: 0 0 12px; }

/* =====================================================================
   Panneau « Retours clients » (admin)
   ===================================================================== */
.retour-count {
  background: #fdece6; color: var(--orange-dark); font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}
.retour-bloc { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-top: 14px; }
.retour-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.retour-thumb {
  flex: 0 0 auto; width: 72px; height: 56px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: #0e1726; display: block;
}
.retour-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.retour-titre { margin: 0; font-size: 14px; color: var(--navy); }
.retour-thread { display: flex; flex-direction: column; gap: 8px; }
.retour-msg { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: var(--bg); }
.retour-msg.is-admin { background: #fff4ef; border-color: #f3d2c4; margin-left: 24px; }
.retour-msg.is-client { background: #fff; }
.retour-msg.traite { opacity: .6; }
.retour-msg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; margin-bottom: 3px; }
.retour-msg-head strong { color: var(--navy); }
.retour-msg-head span { color: var(--muted); }
.retour-msg-body { font-size: 13.5px; line-height: 1.45; color: var(--text); }
.retour-msg-actions { display: flex; gap: 6px; margin-top: 7px; }
.retour-treat, .retour-del {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer;
  font: inherit; font-size: 12px; padding: 4px 9px; color: var(--navy);
}
.retour-treat:hover { border-color: var(--teal); color: var(--teal); }
.retour-msg.traite .retour-treat { border-color: var(--teal); color: var(--teal); }
.retour-del:hover { border-color: #f3c4b6; background: #fff5f1; }
.retour-reply { display: flex; gap: 8px; margin-top: 10px; align-items: flex-start; }
.retour-reply-text { flex: 1; min-height: 38px; }

/* En-tête de bloc retour : vignette + nom/section + statut + temps */
.retour-head-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.retour-head-info strong { color: var(--navy); font-size: 14px; }
.retour-section { font-size: 12px; color: var(--muted); }
.retour-status {
  margin-left: auto; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
}
.retour-status.a_traiter { background: #eaf0fb; color: #3060c0; }
.retour-status.traite { background: #e9f9ef; color: #136c39; }
.retour-time { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Filtres retours (À traiter / Traités / Tous) */
.retour-filters { display: inline-flex; gap: 4px; }
.retour-filters .rf {
  border: 1px solid var(--line); background: #fff; color: var(--navy);
  font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.retour-filters .rf.active { background: #fdece6; border-color: #f3c4b6; color: var(--orange-dark); }

/* =====================================================================
   Onglets (Maquettes / Retours clients)
   ===================================================================== */
.tabs-panel { padding-top: 14px; }
.tabbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: inline-flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; }
.tab {
  border: 0; background: none; font: inherit; font-weight: 600; font-size: 14px; color: var(--muted);
  padding: 8px 14px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.tab.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }
.tab-n {
  background: #e2e7ee; color: var(--navy); font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.tab-n.accent { background: var(--orange); color: #fff; }

/* =====================================================================
   Synthèse + sous-libellés des interrupteurs
   ===================================================================== */
.synthese { list-style: none; margin: 0; padding: 0; }
.synthese li { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.synthese li:last-child { border-bottom: 0; }
.synthese li span { color: var(--muted); }
.synthese li strong { color: var(--navy); font-size: 15px; }
.synthese li strong.accent { color: var(--orange); }
.synthese li strong.ok { color: var(--teal); }
.synthese li strong.muted { color: var(--muted); font-size: 14px; }

.toggle-text { display: flex; flex-direction: column; line-height: 1.25; }
.toggle-text strong { font-weight: 600; font-size: 14px; color: var(--navy); }
.toggle-text em { font-style: normal; font-size: 12px; color: var(--muted); }

.btn-save { margin-top: 4px; }

/* « Supprimer le projet » en haut à droite */
.delete-inline { margin: 0; }
.link-danger {
  border: 0; background: none; color: var(--orange-dark); font: inherit; font-weight: 600;
  cursor: pointer; padding: 4px 6px;
}
.link-danger:hover { text-decoration: underline; }

@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .projects-grid, .stats { grid-template-columns: 1fr; }
}
