/* ============================================================
   style.css — AIS Disponibilités Formateurs
   Direction : institutionnel sobre, clarté fonctionnelle
   ============================================================ */

:root {
    --c-bg:        #F6F5F2;
    --c-surface:   #FFFFFF;
    --c-border:    #E2DFD8;
    --c-text:      #1A1917;
    --c-muted:     #6B6860;
    --c-accent:    #1B4F8A;   /* bleu AIS */
    --c-accent-lt: #EEF3FA;
    --c-green:     #1E7A4A;
    --c-green-lt:  #E8F5EE;
    --c-orange:    #C05A00;
    --c-orange-lt: #FFF0E4;
    --c-red:       #B91C1C;
    --c-red-lt:    #FEE2E2;
    --c-yellow:    #92400E;
    --c-yellow-lt: #FEF3C7;
    --radius:      10px;
    --shadow:      0 2px 12px rgba(0,0,0,.07);
    --font-body:   'DM Sans', sans-serif;
    --font-display:'DM Serif Display', serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--c-bg);
    color: var(--c-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- NAVBAR ---- */
.navbar {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    height: 60px;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand   { display: flex; align-items: center; gap: .6rem; margin-right: auto; }
.nav-logo    { font-size: 1.3rem; color: var(--c-accent); }
.nav-title   { font-family: var(--font-display); font-size: 1.1rem; }
.nav-title em{ color: var(--c-accent); font-style: normal; }
.nav-links   { display: flex; gap: .25rem; }
.nav-link    {
    color: var(--c-muted);
    text-decoration: none;
    padding: .35rem .85rem;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active {
    background: var(--c-accent-lt);
    color: var(--c-accent);
}
.nav-user    { display: flex; align-items: center; gap: .75rem; font-size: .875rem; }
.nav-nom     { color: var(--c-muted); }
.nav-badge   {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: .2rem .6rem;
    border-radius: 99px;
    background: var(--c-accent-lt);
    color: var(--c-accent);
}
.nav-badge.formateur { background: var(--c-green-lt); color: var(--c-green); }
.nav-logout  {
    color: var(--c-muted);
    text-decoration: none;
    font-size: .85rem;
    border: 1px solid var(--c-border);
    padding: .25rem .7rem;
    border-radius: 6px;
    transition: border-color .15s, color .15s;
}
.nav-logout:hover { border-color: var(--c-red); color: var(--c-red); }

/* ---- MAIN ---- */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ---- FOOTER ---- */
.footer {
    text-align: center;
    padding: 1.25rem;
    font-size: .8rem;
    color: var(--c-muted);
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
}

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--c-border);
}
.page-header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 400;
}
.page-header p { color: var(--c-muted); font-size: .9rem; margin-top: .25rem; }

/* ---- CARDS ---- */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--c-border);
}

/* ---- STATS GRID ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.stat-value { font-size: 2.25rem; font-family: var(--font-display); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-card.accent   { border-left: 3px solid var(--c-accent); }
.stat-card.green    { border-left: 3px solid var(--c-green); }
.stat-card.orange   { border-left: 3px solid var(--c-orange); }
.stat-card.red      { border-left: 3px solid var(--c-red); }

/* ---- TABLE ---- */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
thead th {
    text-align: left;
    padding: .75rem 1rem;
    background: var(--c-bg);
    color: var(--c-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--c-border);
}
tbody tr { border-bottom: 1px solid var(--c-border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--c-bg); }
tbody td { padding: .85rem 1rem; vertical-align: middle; }

/* ---- BADGES STATUT ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    font-weight: 600;
    padding: .25rem .75rem;
    border-radius: 99px;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; display: block; }
.badge-disponible    { background: var(--c-green-lt);  color: var(--c-green);  }
.badge-disponible::before    { background: var(--c-green); }
.badge-indisponible  { background: var(--c-red-lt);    color: var(--c-red);    }
.badge-indisponible::before  { background: var(--c-red); }
.badge-sous_reserve  { background: var(--c-yellow-lt); color: var(--c-yellow); }
.badge-sous_reserve::before  { background: var(--c-yellow); }
.badge-nc            { background: var(--c-border);    color: var(--c-muted);  }
.badge-nc::before    { background: var(--c-muted); }

/* ---- FORMS ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: .85rem; font-weight: 500; color: var(--c-muted); }
input, select, textarea {
    border: 1px solid var(--c-border);
    border-radius: 7px;
    padding: .6rem .9rem;
    font-family: var(--font-body);
    font-size: .95rem;
    color: var(--c-text);
    background: var(--c-bg);
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(27,79,138,.12);
    background: var(--c-surface);
}
textarea { resize: vertical; min-height: 80px; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.2rem;
    border-radius: 7px;
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    text-decoration: none;
}
.btn-primary   { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }
.btn-primary:hover { background: #153e6e; border-color: #153e6e; }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border); }
.btn-secondary:hover { background: var(--c-bg); }
.btn-danger    { background: var(--c-red-lt); color: var(--c-red); border-color: #fca5a5; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: .35rem .8rem; font-size: .82rem; }

/* ---- ALERTS ---- */
.alert {
    padding: .85rem 1.1rem;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--c-green-lt);  color: var(--c-green); border-color: #86efac; }
.alert-error   { background: var(--c-red-lt);    color: var(--c-red);   border-color: #fca5a5; }
.alert-info    { background: var(--c-accent-lt); color: var(--c-accent); border-color: #93c5fd; }

/* ---- CALENDRIER ---- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 2rem;
}
.cal-header { text-align: center; font-size: .7rem; font-weight: 600; color: var(--c-muted); text-transform: uppercase; letter-spacing: .08em; padding: .4rem; }
.cal-day {
    aspect-ratio: 1;
    border-radius: 6px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    cursor: default;
    transition: transform .1s;
    position: relative;
}
.cal-day.empty        { background: transparent; border-color: transparent; }
.cal-day.cfa-journee  { background: var(--c-accent); color: #fff; border-color: var(--c-accent); font-weight: 600; }
.cal-day.cfa-matin    { background: linear-gradient(to bottom, var(--c-accent) 50%, var(--c-surface) 50%); color: var(--c-text); border-color: var(--c-accent); }
.cal-day.cfa-aprem    { background: linear-gradient(to bottom, var(--c-surface) 50%, var(--c-accent) 50%); color: var(--c-text); border-color: var(--c-accent); }
.cal-day.cfa-journee  { color: #fff; }
.cal-day:not(.empty):hover { transform: scale(1.05); z-index: 2; }
.cal-num { font-size: .8rem; font-weight: 500; }
.cal-label { font-size: .6rem; opacity: .8; }
.cal-month-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: .5rem;
    color: var(--c-accent);
}

/* ---- DISPO GRID (formateur) ---- */
.dispo-table td.statut-cell { min-width: 160px; }
.dispo-select {
    padding: .4rem .7rem;
    border-radius: 6px;
    font-size: .85rem;
    cursor: pointer;
}
.dispo-select.disponible    { background: var(--c-green-lt);  color: var(--c-green);  border-color: var(--c-green); }
.dispo-select.indisponible  { background: var(--c-red-lt);    color: var(--c-red);    border-color: var(--c-red); }
.dispo-select.sous_reserve  { background: var(--c-yellow-lt); color: var(--c-yellow); border-color: var(--c-yellow); }

/* ---- LOGIN ---- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-bg);
}
.login-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 3rem;
    width: 100%;
    max-width: 420px;
}
.login-logo {
    font-family: var(--font-display);
    font-size: 2rem;
    text-align: center;
    margin-bottom: .25rem;
    color: var(--c-accent);
}
.login-sub {
    text-align: center;
    color: var(--c-muted);
    font-size: .88rem;
    margin-bottom: 2rem;
}
.login-card .form-group { margin-bottom: 1rem; }
.login-card .btn { width: 100%; justify-content: center; margin-top: .5rem; }

/* ---- SYNTHESE ---- */
.synth-matrix {
    overflow-x: auto;
}
.synth-matrix table { font-size: .8rem; }
.synth-matrix thead th { white-space: nowrap; }
.synth-cell {
    text-align: center;
    padding: .5rem .4rem !important;
    border-radius: 4px;
}
.synth-cell.d { background: var(--c-green-lt);  color: var(--c-green);  font-weight: 600; }
.synth-cell.i { background: var(--c-red-lt);    color: var(--c-red);    font-weight: 600; }
.synth-cell.r { background: var(--c-yellow-lt); color: var(--c-yellow); font-weight: 600; }
.synth-cell.n { background: var(--c-bg);        color: var(--c-muted); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; }
    .nav-links { display: none; }
    .main-content { padding: 0 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .calendar-grid { grid-template-columns: repeat(7, 1fr); gap: 2px; }
    .cal-day { font-size: .7rem; }
}
