:root {
  --blue: #0066FF;
  --yellow: #FFBE2D;
  --bg: #0A0A0F;
  --surface: #16161F;
  --border: #1E1E2A;
  --text: #F0F0FF;
  --muted: #8888AA;
  --danger: #FF4444;
  --success: #22AA44;
  --header-bg: rgba(10, 10, 15, 0.8);
  --preview-bg: #0A0A0F;
  --input-bg: #0A0A0F;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
}

[data-theme="light"] {
  --bg: #F0F2F8;
  --surface: #FFFFFF;
  --border: #D0D5E0;
  --text: #0A0A12;
  --muted: #667085;
  --header-bg: rgba(255, 255, 255, 0.92);
  --preview-bg: #E8ECF2;
  --input-bg: #F5F7FA;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { transition: background 0.35s, color 0.35s; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background 0.35s, color 0.35s;
}

/* Login premium */
.login-page {
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 24px 16px;
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse at 18% 8%, rgba(0, 102, 255, 0.14), transparent 52%),
    radial-gradient(ellipse at 92% 92%, rgba(255, 190, 45, 0.12), transparent 46%),
    var(--bg);
}

.login-shell {
  display: flex;
  width: min(1040px, 94vw);
  min-height: min(640px, 88vh);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(10, 16, 32, 0.16);
}

.login-visual {
  position: relative;
  flex: 1.08;
  min-height: 100%;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.login-visual-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-visual-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.42) 0%, rgba(0, 70, 180, 0.4) 46%, rgba(11, 18, 32, 0.88) 100%);
}

.login-visual-copy {
  position: relative;
  z-index: 1;
  padding: 40px;
  color: #fff;
}

.login-brand-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  background: #fff;
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.login-visual-copy p {
  margin: 16px 0 6px;
  font-size: 0.95rem;
  opacity: 0.88;
}

.login-visual-copy strong {
  display: block;
  color: #FFBE2D;
  font-size: 1.05rem;
}

.login-card {
  position: relative;
  flex: 0.92;
  width: 100%;
  max-width: none;
  padding: 48px 44px;
  background: var(--surface);
  border: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-kicker {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.15;
}

.login-sub {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 0.95rem;
  line-height: 1.55;
}

.login-card .form-field { margin-bottom: 16px; }

.login-card .form-field label {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.input-icon { position: relative; display: flex; align-items: center; }

.input-icon > svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.login-card .input-icon input {
  width: 100%;
  padding: 13px 46px;
  border-radius: 12px;
  background: var(--input-bg);
}

.toggle-pass {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
}

.toggle-pass:hover { color: var(--blue); background: rgba(0, 102, 255, 0.08); }
.toggle-pass svg { width: 18px; height: 18px; }

.btn-login {
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.3s;
}

.back-link svg { width: 16px; height: 16px; }
.back-link:hover { color: var(--blue); }

@media (max-width: 860px) {
  .login-shell {
    flex-direction: column;
    min-height: auto;
    width: min(480px, 94vw);
  }
  .login-visual { min-height: 220px; flex: none; }
  .login-visual-copy { padding: 24px; }
  .login-brand-logo { width: 58px; height: 58px; }
  .login-card { padding: 28px 22px 32px; }
}

/* Admin layout */
.admin-body {
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'Inter', system-ui, sans-serif;
  --radius: 16px;
  display: flex;
  min-height: 100vh;
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse at 8% 0%, rgba(0, 102, 255, 0.07), transparent 46%),
    radial-gradient(ellipse at 100% 100%, rgba(255, 190, 45, 0.08), transparent 42%),
    var(--bg);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
  z-index: 90;
}

.admin-sidebar {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  transition: background 0.35s, border-color 0.35s, transform 0.3s;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
  width: 118px;
  height: auto;
  max-height: 42px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  padding: 6px 8px;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
}

.sidebar-brand span { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--blue);
}
.sidebar-brand small {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  background: none;
  border: none;
  border-radius: 12px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  position: relative;
}

.nav-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--input-bg);
  color: var(--blue);
  flex-shrink: 0;
}

.nav-ico svg { width: 16px; height: 16px; }

.nav-item:hover, .nav-item.active {
  color: var(--text);
  background: rgba(0,102,255,0.08);
}

.nav-item.active .nav-ico {
  background: var(--blue);
  color: #fff;
}

.badge {
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
}

.sidebar-footer {
  padding: 16px 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-main {
  flex: 1;
  margin-left: 280px;
  min-height: 100vh;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.35s, border-color 0.35s;
}

.header-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.header-kicker {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 4px;
}

.admin-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  letter-spacing: 0;
  line-height: 1.15;
}

#panelLead {
  margin-top: 4px;
  font-size: 0.88rem;
  color: var(--muted);
}

.sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--blue);
  border-radius: 99px;
}

.header-actions { display: flex; align-items: center; gap: 12px; }

.save-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--success);
}

.admin-content {
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel { display: none; }
.panel.active { display: flex; flex-direction: column; gap: 18px; }

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 24px 24px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.04);
}

.panel-card-head { margin-bottom: 18px; }
.panel-card-head h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 4px;
}
.panel-card-head p,
.panel-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel-grid .full { grid-column: span 2; }

.panel-hint { margin-bottom: 16px; }

/* Form fields */
.form-field { display: flex; flex-direction: column; gap: 6px; }

.form-field label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-field input,
.form-field textarea,
.form-field select {
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.35s, color 0.35s;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}

/* Buttons */
.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
}

.btn-admin svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: #0088FF; box-shadow: 0 0 20px rgba(0,102,255,0.3); }

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--border);
}

.btn-outline:hover { background: rgba(0,102,255,0.08); border-color: var(--blue); }

.btn-danger { background: var(--danger); color: white; border-radius: 12px; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-sm { padding: 9px 14px; font-size: 0.78rem; }

.alert {
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.alert-error {
  background: rgba(255,68,68,0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
}

/* Services editor */
.services-editor { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.service-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: background 0.35s, border-color 0.35s;
}

.service-row.inactive { opacity: 0.5; }

.service-row input, .service-row textarea {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.service-row textarea { resize: vertical; min-height: 60px; }

.service-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--danger);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.btn-icon svg { width: 15px; height: 15px; }

.btn-icon:hover { background: rgba(255,68,68,0.1); border-color: var(--danger); }

/* Tarifs */
.tarif-row {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr auto;
  gap: 8px;
  margin-bottom: 8px;
}

.tarif-row input {
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
}

/* Catalogue & partenaires (admin) */
.media-editor { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }

.media-row {
  display: grid;
  grid-template-columns: 132px 1fr auto;
  gap: 16px;
  padding: 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  align-items: start;
}

.media-preview {
  width: 132px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.media-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.media-preview span {
  font-size: 0.75rem;
  color: var(--muted);
}

.media-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-fields input[type="text"] {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
}

.media-check {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px;
}

/* Section paramètres — logos */
.settings-section { margin-bottom: 0; }

.settings-section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 8px;
}

.logo-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

.logo-upload-card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.logo-upload-card > label:first-child {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 12px;
}

.logo-preview-wrap {
  background: var(--preview-bg);
  border: 1px dashed var(--border);
  border-radius: 14px;
  transition: background 0.35s;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  margin-bottom: 12px;
}

.logo-preview-wrap img {
  max-width: 100%;
  max-height: 100px;
  object-fit: contain;
}

.logo-preview-wrap--favicon img {
  max-height: 48px;
  max-width: 48px;
}

.logo-upload-card input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.upload-btn-wrap {
  display: inline-block;
  cursor: pointer;
}

.upload-btn-wrap input { display: none; }

@media (max-width: 768px) {
  .logo-settings-grid { grid-template-columns: 1fr; }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: 14px;
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
  animation: slideUp 0.3s ease;
}

.toast.error { border-color: var(--danger); color: var(--danger); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Toggle thème admin */
.admin-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--yellow);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s;
  flex-shrink: 0;
  position: relative;
}

.admin-theme-toggle:hover {
  border-color: var(--blue);
  box-shadow: 0 0 12px rgba(0, 102, 255, 0.25);
  transform: rotate(15deg);
}

.admin-theme-toggle svg {
  width: 18px;
  height: 18px;
  position: absolute;
  transition: opacity 0.3s, transform 0.3s;
}

[data-theme="dark"] .admin-theme-toggle .icon-sun { opacity: 1; transform: rotate(0); }
[data-theme="dark"] .admin-theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg); }
[data-theme="light"] .admin-theme-toggle .icon-sun { opacity: 0; transform: rotate(90deg); }
[data-theme="light"] .admin-theme-toggle .icon-moon { opacity: 1; transform: rotate(0); }

.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 30;
}

.sidebar-theme-row {
  padding: 0 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-theme-row span {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

[data-theme="light"] .admin-sidebar,
[data-theme="light"] .login-card,
[data-theme="light"] .panel-card,
[data-theme="light"] .service-row,
[data-theme="light"] .message-card,
[data-theme="light"] .logo-upload-card,
[data-theme="light"] .tarif-card {
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.05);
}

[data-theme="light"] .nav-item:hover,
[data-theme="light"] .nav-item.active {
  background: rgba(0, 102, 255, 0.06);
}

@media (max-width: 980px) {
  .sidebar-toggle { display: flex; }
  .sidebar-overlay:not([hidden]) { display: block; }
  .admin-sidebar { transform: translateX(-105%); }
  .admin-sidebar.is-open { transform: translateX(0); box-shadow: 16px 0 40px rgba(10, 16, 32, 0.18); }
  .admin-main { margin-left: 0; }
  .admin-header { padding: 16px 18px; }
  .admin-content { padding: 18px 16px 36px; }
  .panel-grid { grid-template-columns: 1fr; }
  .panel-grid .full { grid-column: span 1; }
  .service-row { grid-template-columns: 1fr; }
  .tarif-row { grid-template-columns: 1fr; }
  .media-row { grid-template-columns: 1fr; }
  .header-actions .admin-theme-toggle { display: none; }
}
