@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ─── TOKENS ─────────────────────────────────────────────── */
:root {
  --bg:            #f0f2f7;
  --surface:       #ffffff; 
  --surface-2:     #f8fafc;
  --surface-3:     linear-gradient(135deg, #8B8D78, #E4CF98);
  --border:        #d4d6cb;
  --border-focus:  #6b7c6e;
  --brand:          #6b7c6e;
  --brand-2:        #4a5e6a;
  --brand-soft:     rgba(107, 124, 110, 0.09);
  --brand-glow:     rgba(107, 124, 110, 0.22);
  --danger:         #ef4444;
  --danger-soft:    rgba(239, 68, 68, 0.08);
  --success:        #10b981;
  --success-soft:   rgba(16, 185, 129, 0.08);
  --text:           #1e2330;
  --text-2:         #6b7c6e;
  --text-3:         #8b8d78;
  --text-4:         #284455;
  --sidebar-w:      260px;
  --radius-xl:      20px;
  --radius-lg:      14px;
  --radius-md:      10px;
  --radius-sm:      8px;
  --shadow-card:    0 1px 3px rgba(0,0,0,.02), 0 4px 16px rgba(140, 145, 130, 0.06);
  --shadow-hover:   0 8px 24px rgba(107, 124, 110, 0.12);
  --anim:           .2s ease;
  --font:           'Plus Jakarta Sans', sans-serif;
}

.dark-theme {
  --bg:            #141618;
  --surface:       #1e2124;
  --surface-2:     #25282c;
  --surface-3:     linear-gradient(135deg, #3a3d30, #5a4e2e);
  --border:        #2e3136;
  --border-focus:  #5a6e5d;
  --brand:          #7e9e82;
  --brand-2:        #6a8fa0;
  --brand-soft:     rgba(126, 158, 130, 0.12);
  --brand-glow:     rgba(126, 158, 130, 0.28);
  --danger:         #f87171;
  --danger-soft:    rgba(248, 113, 113, 0.1);
  --success:        #34d399;
  --success-soft:   rgba(52, 211, 153, 0.1);
  --text:           #e8eaf0;
  --text-2:         #9aad9d;
  --text-3:         #6b7c6e;
  --text-4:         #7ab0c8;
  --shadow-card:    0 1px 3px rgba(0,0,0,.2), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-hover:   0 8px 24px rgba(0, 0, 0, 0.4);
  --sidebar-w:      260px;
  --radius-xl:      20px;
  --radius-lg:      14px;
  --radius-md:      10px;
  --radius-sm:      8px;
}
/* ─── RESET BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* body par défaut = panel avec sidebar */
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

/* login.html → <body class="login-page"> */
/* maintenance.html → <body class="login-page"> */
.theme-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--anim), border-color var(--anim), transform var(--anim);
}

.theme-toggle:hover {
  background: var(--brand-soft);
  border-color: var(--border-focus);
  transform: scale(1.08);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-2);
  fill: none;
  transition: stroke var(--anim);
}

.theme-toggle:hover svg {
  stroke: var(--brand);
}
/* ─── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ─── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  z-index: 100;
  padding: 0 0 20px;
  color: var(--text-4);
}

.logo-section {
  padding: 28px 24px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.logo-section img {
  max-width: 110px;
  filter: none;
}

/* Nav links */
.nav-links {
  list-style: none;
  padding: 0 12px;
  flex-grow: 1;
  margin: 0;
}

.nav-links li { margin-bottom: 4px; }

.nav-links a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--anim), color var(--anim);
}

.nav-links a i { font-size: 1rem; width: 20px; text-align: center; }

.nav-links a:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.nav-links a.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}

.nav-links a[style*="f87171"]:hover,
.nav-links a[style*="f87171"] {
  color: var(--danger) !important;
}
.nav-links a[style*="f87171"]:hover {
  background: var(--danger-soft);
}

/* Profile */
.nav-profile {
  margin: 12px;
  padding: 14px 16px;
  background: var(--surface-3);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
}

.nav-profile img {
  width: 40px;
  border-radius: var(--radius-sm);
}

/* ─── MAIN CONTENT ───────────────────────────────────────── */
main {
  flex-grow: 1;
  margin-left: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.content-container {
  max-width: 1100px;
  padding: 36px 48px 80px;
}

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--anim);
}

.card:hover { box-shadow: var(--shadow-hover); }

/* Carte danger (derank) */
.card[style*="ef4444"] {
  border-top: 3px solid var(--danger) !important;
}

/* Section headings */
h2 {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--brand);
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

h2 i { color: var(--brand); }

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ─── FORMULAIRES ─────────────────────────────────────────── */
.input-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 6px 2px;
}

input,
select,
textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-4);
  font-family: var(--font);
  font-size: .875rem;
  box-sizing: border-box;
  transition: border-color var(--anim), box-shadow var(--anim), background var(--anim);
  outline: none;
  appearance: none;
}

input::placeholder,
textarea::placeholder { color: var(--text-3); }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-soft);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

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

/* Row de champs côte à côte */
.row {
  display: flex;
  gap: 12px;
  margin-bottom: 0;
}

/* Code area (outputs) */
#html-code,
.code-area {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: .78rem;
  background: #1e2330;
  color: #a5b4fc;
  border-color: #2d3550;
  border-radius: var(--radius-md);
}

#html-code:focus,
.code-area:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(107,124,110,.15);
  background: #1e2330;
}

/* Output preview box */
.output-box {
  min-height: 160px;
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  font-size: .85rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* ─── BOUTONS ─────────────────────────────────────────────── */
/* Bouton générer (formulaires dashboard) */
.btn-gen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-family: var(--font);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  border: none;
  cursor: pointer;
  width: 100%;
  margin-top: 20px;
  box-shadow: 0 4px 12px var(--brand-glow);
  transition: transform var(--anim), filter var(--anim), box-shadow var(--anim);
}

.btn-gen:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow: 0 6px 20px var(--brand-glow);
}

/* Bouton submit dans cards dashboard */
button.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-family: var(--font);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--brand-glow);
  transition: transform var(--anim), filter var(--anim), box-shadow var(--anim);
}

button.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow: 0 6px 20px var(--brand-glow);
}

/* Bouton danger (derank) */
button.btn-primary[style*="#ef4444"],
button.btn-primary[style*="ef4444"] {
  background: linear-gradient(135deg, #ef4444, #f97316) !important;
  box-shadow: 0 4px 12px rgba(239,68,68,.25);
}

/* Bouton login */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-family: var(--font);
  font-size: .8rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--anim);
  text-decoration: none;
  box-sizing: border-box;
  border: none;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--brand-glow);
}

.btn-logout {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  margin-top: 12px;
}

.btn-logout:hover {
  background: var(--danger-soft);
  border-color: rgba(239,68,68,.25);
  color: var(--danger);
}

/* ─── TABLE ───────────────────────────────────────────────── */
table {
  width: 100%;
  border-spacing: 0 8px;
  border-collapse: separate;
}

th {
  padding: 0 16px 8px;
  text-transform: uppercase;
  font-size: .65rem;
  letter-spacing: 1px;
  color: var(--text-3);
  text-align: left;
  font-weight: 700;
}

td {
  background: var(--surface-2);
  padding: 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background var(--anim);
}

tr:hover td { background: var(--brand-soft); }

td:first-child {
  border-left: 1px solid var(--border);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

td:last-child {
  border-right: 1px solid var(--border);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.user-cell img {
  width: 36px;
  border-radius: var(--radius-sm);
  margin-right: 12px;
  border: 2px solid var(--border);
}

.role-pill {
  background: var(--brand-soft);
  color: var(--brand);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  border: 1px solid rgba(99,102,241,.15);
  display: inline-block;
}

/* ─── BADGES STATUS ───────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .72rem;
  margin-top: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.status-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(16,185,129,.2);
}

.status-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.2);
}

/* ─── LOGIN PAGE ──────────────────────────────────────────── */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
}

/* ─── LOGIN CARD ──────────────────────────────────────────── */
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--surface);
  backdrop-filter: none;
  padding: 48px 40px;
  border-radius: var(--radius-xl);
  border: 0.5px solid var(--border);
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  animation: fadeInUp .45s ease-out;
}

.login-card::before { display: none; }

.logo-icon {
  font-size: 2.8rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  filter: none;
}

.login-card h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
  background: none !important;
  -webkit-text-fill-color: var(--text) !important;
}

.login-card p {
  color: var(--text-2);
  margin-bottom: 28px;
  font-size: .9rem;
}

/* ─── ERROR PAGE ──────────────────────────────────────────── */
body.error-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
}

.error-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--surface);
  padding: 48px 40px;
  border-radius: var(--radius-xl);
  border: 0.5px solid var(--border);
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  animation: fadeInUp .45s ease-out;
}

.error-code {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 12px;
}

.error-container h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}

.error-container p {
  color: var(--text-2);
  margin-bottom: 28px;
  font-size: .9rem;
}

.user-info {
  background: var(--surface-2);
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── CONTAINER (plaintes / appels) ──────────────────────── */
.container {
  max-width: 1200px;
  padding: 32px 48px 80px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .container { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}

/* ─── ERROR PAGES ─────────────────────────────────────────── */
body.error-page {
  justify-content: center;
  align-items: center;
  background: var(--bg);
}