/* ==========================================================================
   PERMIS ADMIN - Stylesheet Personnalisée
   Design moderne, professionnel et adapté au contexte administratif français
   ========================================================================== */

:root {
  --admin-blue-dark: #0f2a4a;
  --admin-blue-navy: #1e3a8a;
  --admin-blue-primary: #2563eb;
  --admin-blue-light: #3b82f6;
  --admin-blue-soft: #eff6ff;
  --admin-accent-border: #dbeafe;
  --admin-slate-dark: #0f172a;
  --admin-slate-muted: #64748b;
  --admin-bg-light: #f8fafc;
  --admin-surface: #ffffff;
  --admin-border: #e2e8f0;
  
  /* Tricolore discret */
  --fr-blue: #0026e6;
  --fr-white: #ffffff;
  --fr-red: #ed2939;

  /* Dimensions */
  --sidebar-width: 270px;
  --sidebar-collapsed-width: 76px;
  --topbar-height: 70px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--admin-bg-light);
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Bandeau tricolore supérieur républicain discret */
.tricolor-stripe {
  height: 4px;
  width: 100%;
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1060;
}
.tricolor-stripe .t-blue { width: 33.33%; background-color: var(--fr-blue); }
.tricolor-stripe .t-white { width: 33.34%; background-color: #cbd5e1; }
.tricolor-stripe .t-red { width: 33.33%; background-color: var(--fr-red); }

/* Layout général */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  padding-top: 4px; /* espace pour la bande tricolore */
}

/* Sidebar latérale */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: #0b192c;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 4px;
  bottom: 0;
  left: 0;
  z-index: 1040;
  transition: all 0.25s ease-in-out;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
}

.app-sidebar .sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.6);
}

.app-sidebar .sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.sidebar-heading {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
  margin-top: 0.5rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: #cbd5e1;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  margin-bottom: 2px;
}

.sidebar-nav .nav-link i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  color: #94a3b8;
  transition: color 0.15s ease-in-out;
}

.sidebar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.sidebar-nav .nav-link:hover i {
  color: #60a5fa;
}

.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, #1d4ed8 0%, #2563eb 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.sidebar-nav .nav-link.active i {
  color: #ffffff;
}

/* Zone de contenu principal */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--admin-bg-light);
  min-height: calc(100vh - 4px);
}

/* Topbar supérieure */
.app-topbar {
  height: var(--topbar-height);
  background-color: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 4px;
  z-index: 1030;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

/* Sélecteur de langue FR / EN */
.lang-switcher {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 2rem;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 1.5rem;
  text-decoration: none;
  color: #475569;
  transition: all 0.2s;
}

.lang-btn:hover {
  color: #0f172a;
}

.lang-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* Cartes et surfaces */
.card-stat {
  border: 1px solid var(--admin-border);
  border-radius: 0.85rem;
  background: #ffffff;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  height: 100%;
}

.card-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

/* Tables modernes */
.table-admin {
  background-color: #ffffff;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--admin-border);
}

.table-admin thead th {
  background-color: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--admin-border);
  padding: 0.9rem 1rem;
}

.table-admin tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
}

.table-admin tbody tr:hover {
  background-color: #f8fafc;
}

/* Disclaimer officiel / pédagogique */
.banner-disclaimer {
  background-color: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Attestation imprimable de permis */
.printable-attestation {
  background: #ffffff;
  border: 2px solid #0f2a4a;
  border-radius: 8px;
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
  max-width: 820px;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.watermark-demo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-size: 2.5rem;
  font-weight: 900;
  color: rgba(220, 38, 38, 0.12);
  white-space: nowrap;
  pointer-events: none;
  text-transform: uppercase;
  z-index: 1;
}

@media print {
  body {
    background: #ffffff !important;
  }
  .app-sidebar,
  .app-topbar,
  .no-print,
  .tricolor-stripe,
  .banner-disclaimer {
    display: none !important;
  }
  .app-main {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  .printable-attestation {
    border: 1px solid #000;
    box-shadow: none;
    max-width: 100%;
    page-break-inside: avoid;
  }
}

/* Responsive pour tablettes et mobiles */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
    display: none;
  }
  .sidebar-backdrop.show {
    display: block;
  }
}
