/* ====================================================================
   AUDEXA — Back-office admin styles
   ==================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --void: #060A14;
  --ink: #0F1A2E;
  --night: #0A1020;
  --surf: rgba(232, 237, 247, 0.04);
  --surf-2: rgba(232, 237, 247, 0.07);
  --frost: #E8EDF7;
  --pearl: #B8C0D0;
  --silver: #8A93A6;
  --line: rgba(232, 237, 247, 0.10);
  --line-2: rgba(232, 237, 247, 0.18);
  --cyan: #4FE0FF;
  --azure: #00B4F0;
  --cobalt: #006FA8;
  --danger: #F87171;
  --success: #4ADE80;
  --warn: #FBBF24;
}

html, body { background: var(--void); color: var(--frost); }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--frost); }
.mono { font-family: ui-monospace, "Geist Mono", "SF Mono", Consolas, monospace; }
code { font-family: ui-monospace, monospace; background: var(--surf); padding: 2px 6px; border-radius: 4px; font-size: 0.92em; }

/* ============== LOGIN ============== */
body.is-login {
  background: radial-gradient(ellipse at top, #0A1020 0%, #060A14 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-shell { width: 100%; display: flex; justify-content: center; }
.login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, var(--ink), var(--night));
  border: 1px solid var(--line-2);
  border-radius: 18px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-card .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--silver);
}
.login-card .brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}
.login-card .brand-name { color: var(--frost); font-weight: 600; letter-spacing: 0.18em; }
.login-card .brand-sub { opacity: 0.55; }
.login-card h1 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.login-card .lede {
  color: var(--silver);
  margin-bottom: 28px;
  font-size: 13.5px;
}
.hash-result {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
}
.hash-result ol { padding-left: 20px; margin-top: 12px; }
.hash-result li { margin-bottom: 6px; color: var(--pearl); }
.hash-result .success { color: var(--success); margin: 16px 0 8px; }

/* ============== FORMS ============== */
label {
  display: block;
  margin-bottom: 18px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--silver);
  font-weight: 500;
}
label small.hint {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--silver);
  font-style: italic;
  opacity: 0.85;
}
input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--frost);
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color .2s, background .2s;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  background: rgba(79, 224, 255, 0.04);
}
/* Options du menu déroulant : fond sombre + texte clair (sinon blanc/blanc) */
select option,
select optgroup {
  background: #0f1626;
  color: var(--frost);
}
textarea { resize: vertical; min-height: 80px; font-family: ui-monospace, monospace; font-size: 13.5px; line-height: 1.6; }
textarea.body-editor { font-family: ui-monospace, monospace; }
input[dir="rtl"], textarea[dir="rtl"] { text-align: right; }

.error {
  margin: 14px 0;
  padding: 12px 14px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 8px;
  color: var(--danger);
  font-size: 13px;
}

/* ============== BUTTONS ============== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--void);
  background: linear-gradient(135deg, var(--cyan), var(--azure));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 180, 240, 0.30);
  color: var(--void);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--cyan);
  background: var(--surf);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-secondary:hover {
  border-color: var(--cyan);
  background: rgba(79, 224, 255, 0.06);
}
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 13px;
  color: var(--pearl);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-ghost:hover {
  color: var(--frost);
  border-color: var(--line-2);
  background: var(--surf);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s;
}
.btn-danger:hover {
  background: rgba(248, 113, 113, 0.08);
  border-color: var(--danger);
}

/* ============== HEADER ============== */
.admin-hdr {
  background: rgba(6, 10, 20, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-hdr-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-hdr .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.admin-hdr .brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.admin-hdr .brand-name { color: var(--frost); font-weight: 700; letter-spacing: 0.20em; }
.admin-hdr .brand-sub { color: var(--silver); }
.admin-nav { display: flex; gap: 24px; font-size: 13px; }
.admin-nav a { color: var(--silver); }
.admin-nav a:hover { color: var(--frost); }

/* ============== MAIN ============== */
.admin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.page-head .lede {
  color: var(--silver);
  font-size: 14px;
  max-width: 600px;
}
.page-head .btn-primary { flex-shrink: 0; }

.empty {
  padding: 80px 32px;
  text-align: center;
  background: var(--surf);
  border: 1px dashed var(--line-2);
  border-radius: 14px;
}
.empty p {
  color: var(--silver);
  margin-bottom: 20px;
}

/* ============== ARTICLES TABLE ============== */
.articles-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.articles-table th,
.articles-table td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: middle;
}
.articles-table th {
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--silver);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 26, 46, 0.5);
}
.articles-table tr { border-bottom: 1px solid var(--line); }
.articles-table tbody tr:last-child { border-bottom: none; }
.articles-table tbody tr:hover { background: var(--surf-2); }
.col-date { width: 130px; color: var(--silver); }
.col-cat { width: 200px; }
.col-actions { width: 180px; text-align: right !important; }
.col-actions .btn-ghost, .col-actions .btn-danger { margin-left: 8px; }

.pill {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(79, 224, 255, 0.08);
  border: 1px solid rgba(79, 224, 255, 0.20);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--cyan);
  text-transform: uppercase;
  font-weight: 500;
}

/* ============== EDITOR ============== */
.editor-section {
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  margin-bottom: 24px;
}
.editor-section h2 {
  font-size: 17px;
  font-weight: 500;
  margin-bottom: 22px;
  letter-spacing: -0.005em;
  color: var(--frost);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2 { margin-bottom: 0; display: flex; align-items: center; gap: 10px; }

.lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 22px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--surf-2);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  color: var(--cyan);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 680px) { .row-2 { grid-template-columns: 1fr; } }

.editor-fr h2 .lang-flag { color: var(--cyan); }
.editor-en h2 .lang-flag { color: var(--success); }
.editor-ar h2 .lang-flag { color: var(--warn); }

.badge-ai {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
  background: rgba(251, 191, 36, 0.10);
  border: 1px solid rgba(251, 191, 36, 0.25);
  padding: 5px 10px;
  border-radius: 999px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

/* ============== SPINNER ============== */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== TOAST / FLASH ============== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 14px 24px;
  background: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--frost);
  font-size: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast.success { border-color: rgba(74, 222, 128, 0.4); }
.toast.error { border-color: rgba(248, 113, 113, 0.4); color: var(--danger); }

/* ============== RESPONSIVE ============== */
@media (max-width: 720px) {
  .admin-hdr-inner, .admin-main { padding-left: 20px; padding-right: 20px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head h1 { font-size: 28px; }
  .articles-table { font-size: 13px; }
  .articles-table th, .articles-table td { padding: 10px 12px; }
  .col-cat { display: none; }
  .editor-section { padding: 24px 20px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn-primary, .form-actions .btn-ghost { width: 100%; }
}

/* ============== TABS NAV (Actualités | Bibliothèque) ============== */
.admin-tab {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--silver);
  padding: 6px 14px;
  border-radius: 999px;
  transition: all .2s;
}
.admin-tab:hover {
  color: var(--frost);
  background: var(--surf);
}
.admin-tab.is-active {
  color: var(--cyan);
  background: rgba(79, 224, 255, 0.10);
}

/* ============== CHECKBOX ROW (library form) ============== */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13.5px;
  color: var(--pearl);
  font-weight: 400;
  padding: 10px 14px;
  background: var(--surf);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: all .2s;
}
.checkbox-row:hover { border-color: var(--line-2); background: var(--surf-2); }
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--cyan);
  cursor: pointer;
}
.checkbox-row span { line-height: 1.4; }

/* ============== FILE INPUT ============== */
input[type="file"] {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 13px;
}
input[type="file"]::file-selector-button {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 14px;
  margin-right: 12px;
  background: var(--cyan);
  color: var(--void);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: filter .2s;
}
input[type="file"]::file-selector-button:hover { filter: brightness(1.1); }

/* ============== Badge "Nouveau" dans le tableau ============== */
.badge-new {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(79, 224, 255, 0.10);
  border: 1px solid rgba(79, 224, 255, 0.30);
  border-radius: 999px;
  animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.col-size { width: 100px; }
