/* ══════════════════════════════════════════════════════
   APP.CSS — Interface d'administration CV Manager
   ══════════════════════════════════════════════════════ */

:root {
  --c-bg:       #0e1117;
  --c-surface:  #161b26;
  --c-surface2: #1e2535;
  --c-border:   #2a3350;
  --c-primary:  #3b82f6;
  --c-primary-h:#2563eb;
  --c-accent:   #f59e0b;
  --c-success:  #10b981;
  --c-danger:   #ef4444;
  --c-text:     #e2e8f0;
  --c-text2:    #94a3b8;
  --c-text3:    #4a5568;
  --sidebar-w:  240px;
  --font:       'Inter', system-ui, sans-serif;
  --font-head:  'Sora', system-ui, sans-serif;
  --radius:     8px;
  --shadow:     0 4px 20px rgba(0,0,0,.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
}

/* ── LAYOUT ─────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 12px;
}

.logo-icon { font-size: 1.4rem; color: var(--c-primary); }
.logo-text  { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; color: var(--c-text); }

.sidebar-nav { list-style: none; padding: 0 10px; }

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-text3);
  padding: 16px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--c-text2);
  text-decoration: none;
  font-size: 13.5px;
  transition: all .15s;
  cursor: pointer;
}

.nav-link:hover { background: var(--c-surface2); color: var(--c-text); }
.nav-link.active { background: rgba(59,130,246,.15); color: var(--c-primary); font-weight: 500; }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

/* ── TOPBAR ──────────────────────────────────────────── */
.main-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.page-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--c-text);
}

.topbar-actions { display: flex; gap: 10px; }

/* ── PAGE BODY ───────────────────────────────────────── */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── BOUTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-h); }
.btn-secondary { background: var(--c-surface2); color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-danger { background: rgba(239,68,68,.12); color: var(--c-danger); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: var(--c-danger); color: #fff; }
.btn-success { background: var(--c-success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-accent { background: var(--c-accent); color: #000; }

/* ── CARDS ───────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-weight: 600; font-size: 0.95rem; }
.card-body  { padding: 20px; }

/* ── GRILLE DASHBOARD ────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card-label { font-size: 12px; color: var(--c-text2); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-card-value { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--c-primary); }

/* ── LISTE D'ITEMS ───────────────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: 10px; }

.item-row {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  transition: border-color .15s;
}

.item-row:hover { border-color: var(--c-primary); }

.item-row-content { flex: 1; min-width: 0; }
.item-row-title   { font-weight: 600; font-size: 0.92rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row-sub     { font-size: 12px; color: var(--c-text2); }
.item-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── FORMULAIRES ─────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid.full { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span2 { grid-column: span 2; }

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="url"],
textarea,
select {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--c-text);
  font-family: var(--font);
  font-size: 13.5px;
  transition: border-color .15s;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

textarea { resize: vertical; min-height: 80px; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.form-check input[type="checkbox"] { width: auto; }
.form-check label { text-transform: none; letter-spacing: 0; font-size: 13px; margin: 0; cursor: pointer; }

/* ── TAGS EDITOR ─────────────────────────────────────── */
.tags-editor {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  cursor: text;
}

.tags-editor:focus-within { border-color: var(--c-primary); }

.tag-pill {
  background: rgba(59,130,246,.2);
  color: var(--c-primary);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tag-remove { cursor: pointer; opacity: .6; }
.tag-remove:hover { opacity: 1; }

.tag-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 2px 4px !important;
  width: auto !important;
  min-width: 80px;
  flex: 1;
  font-size: 13px;
}

/* ── COMPÉTENCES EDITOR ──────────────────────────────── */
.comp-skill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.comp-skill-row input { flex: 1; }

.stars-editor {
  display: flex;
  gap: 4px;
}

.star {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--c-border);
  background: transparent;
  cursor: pointer;
  transition: all .1s;
}

.star.on { background: var(--c-accent); border-color: var(--c-accent); }

/* ── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title { font-family: var(--font-head); font-weight: 600; font-size: 1rem; }
.modal-close  { background: none; border: none; color: var(--c-text2); font-size: 1rem; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--c-text); }

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── TOAST ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease;
  max-width: 340px;
}

.toast.success { border-left: 3px solid var(--c-success); }
.toast.error   { border-left: 3px solid var(--c-danger);  }

@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── COMPOSER ────────────────────────────────────────── */
.composer-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

.section-toggle-list { display: flex; flex-direction: column; gap: 8px; }

.section-toggle {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.section-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-toggle-name { font-weight: 500; font-size: 0.9rem; }

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--c-border);
  border-radius: 20px;
  cursor: pointer;
  transition: .2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: .2s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--c-primary); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(18px); }

.section-ids-panel {
  margin-top: 12px;
  border-top: 1px solid var(--c-border);
  padding-top: 12px;
}

.id-checkbox-list { display: flex; flex-direction: column; gap: 6px; }

.id-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--c-text2);
  cursor: pointer;
}

.id-checkbox input { width: auto; }

/* ── CV LIST CARDS ───────────────────────────────────── */
.cv-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.cv-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s;
}

.cv-card:hover { border-color: var(--c-primary); }

.cv-card-name { font-family: var(--font-head); font-weight: 600; font-size: 1rem; }
.cv-card-desc { font-size: 12.5px; color: var(--c-text2); }
.cv-card-meta { font-size: 11.5px; color: var(--c-text3); }
.cv-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* ── PRÉVISUALISATION ────────────────────────────────── */
.preview-frame {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.preview-frame iframe {
  width: 100%;
  height: 600px;
  border: none;
  display: block;
}

.preview-placeholder {
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text3);
  font-size: 13px;
  flex-direction: column;
  gap: 12px;
}

.preview-placeholder .placeholder-icon { font-size: 3rem; opacity: .3; }

/* ── TEMPLATE SELECTOR ───────────────────────────────── */
.template-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.template-opt {
  border: 2px solid var(--c-border);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--c-text2);
  transition: all .15s;
}

.template-opt:hover { border-color: var(--c-primary); color: var(--c-text); }
.template-opt.selected { border-color: var(--c-primary); background: rgba(59,130,246,.1); color: var(--c-primary); font-weight: 500; }

/* ── EXPORT BUTTONS ──────────────────────────────────── */
.export-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── EMPTY STATE ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--c-text2);
}

.empty-icon { font-size: 3rem; opacity: .3; margin-bottom: 12px; }
.empty-text { font-size: 15px; margin-bottom: 16px; }

/* ── LANGUE TABLE EDITOR ─────────────────────────────── */
.lang-level-select {
  padding: 5px 8px;
  width: auto;
}

/* ── UTILS ───────────────────────────────────────────── */
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.flex   { display: flex; }
.gap-10 { gap: 10px; }
.text-muted { color: var(--c-text2); }
.text-sm    { font-size: 12px; }
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(59,130,246,.15);
  color: var(--c-primary);
  font-weight: 500;
}

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text3); }
