/* =========================================================
   COMPLEXE SCOLAIRE BILINGUE ST JOBED — Identité visuelle
   Palette : bleu nuit académique + or (sceau/diplôme)
   Typo : Fraunces (titres, esprit "diplôme") + Inter (UI)
   ========================================================= */

:root {
  --ca-navy: #17233F;
  --ca-navy-light: #223561;
  --ca-gold: #C89B3C;
  --ca-gold-soft: #E8D8AE;
  --ca-bg: #F6F5F1;
  --ca-surface: #FFFFFF;
  --ca-text: #1C2230;
  --ca-text-muted: #6B7280;
  --ca-success: #2F7D5D;
  --ca-danger: #B3413A;
  --ca-border: #E7E4DB;
  --ca-radius: 10px;
}

body {
  background: var(--ca-bg);
  color: var(--ca-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.95rem;
}

h1, h2, h3, h4, .ca-display {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--ca-navy);
  letter-spacing: -0.01em;
}

/* ---------- Layout ---------- */
.ca-shell {
  display: flex;
  min-height: 100vh;
}

.ca-sidebar {
  width: 250px;
  background: var(--ca-navy);
  color: #E9ECF3;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ca-sidebar .ca-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ca-sidebar .ca-brand .seal,
.ca-sidebar .ca-brand .ca-brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ca-gold);
  color: var(--ca-navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  margin-right: 0.6rem;
  flex-shrink: 0;
}

/* Logo réel de l'établissement (remplace le sceau "CA") */
.ca-brand-logo {
  background: #fff;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15);
}
.ca-login-seal.ca-login-seal-img,
.vitrine-seal.vitrine-seal-img {
  background: #fff;
  object-fit: cover;
  padding: 0;
}
.ca-topbar-logo {
  height: 30px;
  width: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
}

.ca-sidebar .ca-brand-name {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  color: #fff;
  line-height: 1.1;
}

.ca-sidebar .ca-brand-sub {
  font-size: 0.72rem;
  color: var(--ca-gold-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ca-nav {
  padding: 1rem 0.75rem;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.ca-nav .ca-nav-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: 0.9rem 0.75rem 0.35rem;
}

.ca-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: #C9CEDB;
  text-decoration: none;
  font-size: 0.88rem;
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.ca-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.ca-nav a.active {
  background: var(--ca-gold);
  color: var(--ca-navy);
  font-weight: 600;
}

.ca-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ca-topbar {
  background: var(--ca-surface);
  border-bottom: 1px solid var(--ca-border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ca-topbar .ca-role-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--ca-gold-soft);
  color: var(--ca-navy);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 600;
}

.ca-content {
  padding: 1.75rem;
  flex: 1;
}

/* ---------- Cards / stats ---------- */
.ca-card {
  background: var(--ca-surface);
  border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius);
  padding: 1.25rem;
}

.ca-stat {
  border-left: 3px solid var(--ca-gold);
}

.ca-stat .ca-stat-value {
  font-family: 'Fraunces', serif;
  font-size: 1.8rem;
  color: var(--ca-navy);
  line-height: 1;
}

.ca-stat .ca-stat-label {
  font-size: 0.78rem;
  color: var(--ca-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.35rem;
}

/* ---------- Buttons ---------- */
.btn-ca-primary {
  background: var(--ca-navy);
  border-color: var(--ca-navy);
  color: #fff;
}
.btn-ca-primary:hover {
  background: var(--ca-navy-light);
  border-color: var(--ca-navy-light);
  color: #fff;
}
.btn-ca-gold {
  background: var(--ca-gold);
  border-color: var(--ca-gold);
  color: var(--ca-navy);
  font-weight: 600;
}
.btn-ca-gold:hover {
  background: #b7893a;
  border-color: #b7893a;
  color: var(--ca-navy);
}

/* ---------- Tables ---------- */
.table-ca thead {
  background: var(--ca-navy);
  color: #fff;
}
.table-ca thead th {
  font-weight: 500;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: none;
}

/* ---------- Login page ---------- */
.ca-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ca-navy);
  background-image: radial-gradient(circle at 20% 20%, rgba(200,155,60,0.12), transparent 40%),
                     radial-gradient(circle at 80% 80%, rgba(200,155,60,0.10), transparent 40%);
}

.ca-login-card {
  width: 100%;
  max-width: 380px;
  background: var(--ca-surface);
  border-radius: 14px;
  padding: 2.25rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.ca-login-seal {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ca-gold);
  color: var(--ca-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0 auto 1rem;
}

/* ---------- Logo bannière (page d'accueil) ---------- */
.vitrine-logo-full {
  max-width: 220px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
@media (max-width: 480px) {
  .vitrine-logo-full { max-width: 160px; }
}

/* ---------- Responsive global : évite tout débordement horizontal ---------- */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

* { box-sizing: border-box; }

/* ---------- Responsive : tableaux et formulaires utilisables sur mobile ---------- */
.ca-card {
  overflow-x: auto;
}

@media (max-width: 768px) {
  .ca-sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 1000; transition: left .2s ease; height: 100vh; width: min(260px, 82vw); }
  .ca-sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,0.35); }
  .ca-content { padding: 1rem; }

  .ca-topbar { flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1rem; }
  .ca-topbar h1 { font-size: 1.05rem; }
  .ca-topbar h1.ca-display { max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .table-ca, table.recap { font-size: 0.82rem; }
  .ca-stat .ca-stat-value { font-size: 1.4rem; }

  .btn-sm { padding: 0.3rem 0.55rem; font-size: 0.78rem; }

  /* Barres d'outils / filtres : on empile proprement au lieu de déborder */
  .ca-content .d-flex {
    flex-wrap: wrap;
  }
  .ca-content input[style*="width"],
  .ca-content select[style*="width"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Empêche la page en dessous de défiler pendant que le menu mobile est ouvert */
  body.ca-no-scroll { overflow: hidden; height: 100vh; touch-action: none; }
  body.ca-no-scroll .ca-main { overflow: hidden; touch-action: none; }
}

@media (max-width: 480px) {
  .ca-login-card { padding: 1.5rem 1.25rem; }
}
