/* ==============================================
   SENGARDIEN - admin.css
   Palette : Bleu marine #0D1F5C | Rouge #CC2229
=============================================== */

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

:root {
  --navy:      #0D1F5C;
  --navy-2:    #162a7a;
  --navy-dark: #091644;
  --red:       #CC2229;
  --red-2:     #a81b20;
  --white:     #FFFFFF;
  --bg:        #F0F2F8;
  --sidebar-w: 240px;
  --text:      #1A1A1A;
  --text-2:    #444;
  --text-3:    #888;
  --border:    #DDE2EE;
  --success:   #1A7A3A;
  --success-bg:#E8F9EE;
  --danger:    #C0392B;
  --danger-bg: #FEECEC;
  --radius:    10px;
  --shadow:    0 2px 16px rgba(13,31,92,.08);
  --transition:.22s ease;
  --font: 'Poppins', system-ui, sans-serif;
}

html { font-size: 15px; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; }
a    { text-decoration: none; color: inherit; }
ul   { list-style: none; }
input, select, textarea, button { font-family: var(--font); }

/* -- Buttons ---------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: 8px;
  font-size: .85rem; font-weight: 700; cursor: pointer;
  border: 2px solid transparent; transition: var(--transition);
}
.btn-primary       { background: var(--red);    color: var(--white); border-color: var(--red); }
.btn-primary:hover { background: var(--red-2);  border-color: var(--red-2); }
.btn-danger        { background: var(--danger);  color: var(--white); border-color: var(--danger); }
.btn-danger:hover  { background: #a93226; }
.btn-ghost         { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover   { background: var(--border); }
.btn-outline       { background: transparent; color: var(--navy); border-color: var(--navy); font-size: .8rem; }
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-sm   { padding: 6px 14px; font-size: .78rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 6px 10px; border-radius: 6px; }

/* -- Login ------------------------------------------ */
.login-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
/* Red line at bottom of login overlay */
.login-overlay::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--red-2));
}

.login-card {
  background: var(--white); border-radius: 16px;
  padding: 48px 40px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
  position: relative;
  border-top: 4px solid var(--red);
}

.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo-icon { font-size: 3rem; margin-bottom: 8px; }
.login-logo h1 { font-size: 1.6rem; font-weight: 800; color: var(--navy); letter-spacing: .04em; }
.login-logo p  { color: var(--text-3); font-size: .88rem; }
.login-hint { text-align: center; color: var(--text-3); font-size: .78rem; margin-top: 20px; }

.form-error {
  color: var(--danger); font-size: .82rem; font-weight: 600;
  padding: 10px 14px; background: var(--danger-bg); border-radius: 6px;
  margin-bottom: 12px; display: none;
}
.form-error.show { display: block; }

/* -- Admin shell ------------------------------------ */
.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* -- Sidebar ---------------------------------------- */
.sidebar {
  background: var(--navy);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}

/* Red accent line at top of sidebar */
.sidebar::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--red-2));
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-icon { font-size: 1.8rem; }
.sidebar-brand strong { display: block; color: var(--white); font-size: .95rem; font-weight: 700; }
.sidebar-brand small  { color: rgba(255,255,255,.45); font-size: .72rem; }

.sidebar-nav {
  flex: 1; display: flex; flex-direction: column;
  padding: 16px 12px; gap: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 14px;
  background: none; border: none; border-radius: 8px;
  color: rgba(255,255,255,.65); font-size: .88rem; font-weight: 500;
  cursor: pointer; text-align: left; transition: var(--transition);
  position: relative;
}
.nav-item svg   { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: var(--white); }
.nav-item.active { background: var(--red); color: var(--white); }

.badge {
  background: #E74C3C; color: var(--white);
  font-size: .68rem; font-weight: 700;
  padding: 2px 6px; border-radius: 50px; margin-left: auto;
}

.sidebar-logout {
  display: flex; align-items: center; gap: 10px;
  margin: 12px; padding: 12px 14px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px; color: rgba(255,255,255,.55);
  font-size: .83rem; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.sidebar-logout svg { width: 16px; height: 16px; }
.sidebar-logout:hover { background: rgba(255,255,255,.1); color: var(--white); }

/* -- Main ------------------------------------------- */
.admin-main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--white); padding: 16px 28px;
  border-bottom: 3px solid var(--red);
  position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user  { font-size: .82rem; color: var(--text-3); }

.module { padding: 28px; }
.module-toolbar { margin-bottom: 20px; }
.module-hint { color: var(--text-3); font-size: .88rem; margin-bottom: 20px; }

/* -- Card ------------------------------------------- */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 24px; margin-bottom: 20px;
}
.card h3 { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 20px; }
.form-card { padding: 28px; }

/* -- Form ------------------------------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span-2 { grid-column: span 2; }
.form-group label { font-size: .82rem; font-weight: 600; color: var(--navy); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px; border: 2px solid var(--border);
  border-radius: 7px; font-size: .88rem; color: var(--text);
  background: var(--white); transition: border-color var(--transition); outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(204,34,41,.08);
}
.form-group textarea { resize: vertical; min-height: 90px; }

.form-actions {
  display: flex; gap: 12px; margin-top: 24px;
  padding-top: 20px; border-top: 1px solid var(--border);
}

.form-status {
  margin-top: 14px; padding: 12px 16px;
  border-radius: 7px; font-size: .85rem; font-weight: 600;
  text-align: center; display: none;
}
.form-status.success { background: var(--success-bg); color: var(--success); display: block; }
.form-status.error   { background: var(--danger-bg);  color: var(--danger);  display: block; }

.settings-separator { border-top: 1px solid var(--border); margin: 24px 0 16px; }
.settings-separator h4 { font-size: .88rem; font-weight: 700; color: var(--navy); margin-top: 16px; }

/* -- Table ------------------------------------------ */
.table-responsive { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.admin-table th {
  text-align: left; padding: 10px 14px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3);
  border-bottom: 2px solid var(--red);
  white-space: nowrap;
}
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #F7F9FD; }

.loading-row { text-align: center; padding: 48px 0 !important; color: var(--text-3); }

.product-thumb {
  width: 52px; height: 40px; border-radius: 6px;
  object-fit: cover; background: var(--bg); display: block;
}
.product-thumb-placeholder {
  width: 52px; height: 40px; border-radius: 6px;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  color: #C0C8DD; font-size: 1.2rem;
}

.status-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 50px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.status-nouveau { background: #EEF2FF; color: var(--navy-2); }
.status-lu      { background: #FFF4E6; color: #B85900; }
.status-traite  { background: var(--success-bg); color: var(--success); }
.status-oui     { background: var(--success-bg); color: var(--success); }
.status-non     { background: var(--danger-bg);  color: var(--danger);  }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* -- Services editor -------------------------------- */
.service-group { margin-bottom: 28px; }
.service-group-title {
  font-size: .88rem; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: .06em;
  padding-bottom: 10px; border-bottom: 2px solid var(--red);
  margin-bottom: 14px; display: flex; align-items: center; gap: 10px;
}

.service-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.service-row:last-child { border-bottom: none; }

.toggle-switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border); border-radius: 22px; cursor: pointer; transition: var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--white); left: 3px; top: 3px;
  transition: var(--transition); box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: #25D366; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

.service-info { flex: 1; }
.service-info strong { font-size: .88rem; color: var(--navy); display: block; }
.service-info small  { font-size: .78rem; color: var(--text-3); }

/* -- Modal ------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 9000;
}
.modal-card {
  background: var(--white); border-radius: 12px;
  padding: 36px; max-width: 420px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  border-top: 4px solid var(--red);
}
.modal-card h3 { font-size: 1.1rem; color: var(--navy); margin-bottom: 10px; }
.modal-card p  { color: var(--text-2); font-size: .9rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; }

/* -- Toast ------------------------------------------ */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: var(--white);
  padding: 12px 24px; border-radius: 50px;
  font-size: .88rem; font-weight: 600;
  opacity: 0; transition: opacity .3s, transform .3s;
  pointer-events: none; z-index: 9999; white-space: nowrap;
}
.toast.show    { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #1A7A3A; }
.toast.error   { background: var(--danger); }

/* -- Responsive ------------------------------------- */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: span 1; }
}
