/* ------------------------------------------------------------------
 * auth.css - pages d'authentification autonomes (hors layout admin) :
 *   application/views/admin/login.php
 *   application/views/admin/forgotpassword.php
 * Gabarit ecran partage : panneau vitrine/publicite + carte de formulaire.
 * ------------------------------------------------------------------ */

:root {
    --brand-dark: #0f2b46;
    --brand: #14548c;
    --brand-light: #3c8dbc;
    --accent: #35aa47;
    --accent-dark: #2b8c3a;
    --ink: #1f2d3d;
    --muted: #7a8794;
    --line: #e3e8ee;
    /* Variantes thematisables : voir .theme-parents en bas de fichier */
    --brand-2: #1b6ba8;        /* fin du degrade de la vitrine */
    --accent-rgb: 53, 170, 71; /* meme teinte que --accent, en composantes */
    --tag-text: #b9f0c3;
    --scrim-rgb: 9, 25, 42;    /* voile sombre sous les legendes d'image */
    --page-bg: #f4f6f9;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--page-bg);
    -webkit-font-smoothing: antialiased;
}

.login-shell {
    display: flex;
    min-height: 100vh;
}

/* ---------- Panneau vitrine / publicites ---------- */
.login-showcase {
    position: relative;
    flex: 1 1 56%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 55%, var(--brand-2) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 48px 56px;
}

.login-showcase::after {
    content: "";
    position: absolute;
    top: -160px;
    right: -160px;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
}

.showcase-brand {
    position: absolute;
    top: 42px;
    left: 56px;
    right: 56px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 15px;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 500;
    opacity: .9;
    z-index: 3;
}

.showcase-brand .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex: 0 0 auto;
}

/* Zone publicitaire : une "slide" = image plein cadre + legende */
.ad-stage {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.ad-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .8s ease;
    pointer-events: none;
}

.ad-slide.is-active {
    opacity: 1;
    pointer-events: auto;
}

.ad-slide .ad-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.ad-slide .ad-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(var(--scrim-rgb), .92) 0%, rgba(var(--scrim-rgb), .45) 45%, rgba(var(--scrim-rgb), .15) 100%);
}

.ad-caption {
    position: absolute;
    left: 56px;
    right: 56px;
    bottom: 92px;
    z-index: 2;
    max-width: 620px;
}

.ad-caption .tag {
    display: inline-block;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 99px;
    background: rgba(var(--accent-rgb), .22);
    border: 1px solid rgba(var(--accent-rgb), .55);
    color: var(--tag-text);
    margin-bottom: 16px;
}

.ad-caption h2 {
    margin: 0 0 12px;
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
}

.ad-caption p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .82);
}

.ad-caption a.ad-link {
    display: inline-block;
    margin-top: 18px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 3px;
}

.ad-dots {
    position: absolute;
    left: 56px;
    bottom: 48px;
    z-index: 3;
    display: flex;
    gap: 8px;
}

.ad-dots button {
    width: 26px;
    height: 4px;
    border: 0;
    padding: 0;
    border-radius: 99px;
    background: rgba(255, 255, 255, .32);
    cursor: pointer;
    transition: background .3s ease, width .3s ease;
}

.ad-dots button.is-active {
    background: var(--accent);
    width: 42px;
}

/* ---------- Panneau de connexion ---------- */
.login-panel {
    flex: 0 0 480px;
    max-width: 100%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    box-shadow: -18px 0 46px rgba(15, 43, 70, .10);
    z-index: 2;
}

.login-card {
    width: 100%;
    max-width: 360px;
}

.login-logo {
    text-align: center;
    margin-bottom: 26px;
}

.login-logo img {
    display: block;
    margin: 0 auto;
    max-width: 240px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.login-logo .school-name {
    margin-top: 14px;
    font-size: 17px;
    font-weight: 500;
    color: var(--brand-dark);
    line-height: 1.35;
}

.login-title {
    text-align: center;
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
}

.login-subtitle {
    text-align: center;
    margin: 0 0 26px;
    font-size: 14px;
    color: var(--muted);
}

.login-title { margin-bottom: 26px; }

.alert {
    border-radius: 6px;
    padding: 11px 14px;
    font-size: 13.5px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-danger {
    background: #fdecea;
    border-color: #f5c6c2;
    color: #a3271c;
}

.alert-success {
    background: #eaf7ec;
    border-color: #c3e6cb;
    color: #256b32;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.field-input {
    position: relative;
}

.field-input .fa {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: #a9b4bf;
    font-size: 15px;
    pointer-events: none;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="email"] {
    width: 100%;
    height: 46px;
    padding: 0 14px 0 40px;
    font-size: 15px;
    color: var(--ink);
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.field input:focus {
    background: #fff;
    border-color: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(60, 141, 188, .16);
}

.field input:focus + .fa {
    color: var(--brand-light);
}

.field .toggle-password {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    left: auto;
    color: #a9b4bf;
    cursor: pointer;
    pointer-events: auto;
    font-size: 15px;
}

.field .toggle-password:hover {
    color: var(--brand);
}

.field-error {
    display: block;
    margin-top: 5px;
    font-size: 12.5px;
    color: #a3271c;
}

.captcha-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.captcha-image {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px 8px;
    min-height: 46px;
}

.captcha-image img {
    max-height: 36px;
}

.captcha-image .fa-refresh {
    color: var(--muted);
    cursor: pointer;
}

.captcha-row .field {
    flex: 1;
    margin-bottom: 0;
}

.btn-login {
    display: block;
    margin-top: 8px;
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .03em;
    cursor: pointer;
    transition: background .2s ease, transform .1s ease, box-shadow .2s ease;
    box-shadow: 0 6px 16px rgba(53, 170, 71, .28);
}

.btn-login:hover {
    background: var(--accent-dark);
}

.btn-login:active {
    transform: translateY(1px);
}

.login-links {
    margin-top: 20px;
    text-align: center;
}

.login-links a {
    color: var(--brand);
    text-decoration: none;
    font-size: 13.5px;
}

.login-links a:hover {
    text-decoration: underline;
}

.login-footer {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- Choix exclusif (type d'utilisateur) ---------- */
.field-choice {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.field-choice label {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfd;
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease;
}

.field-choice label:hover {
    border-color: var(--brand-light);
}

.field-choice input[type="radio"] {
    margin: 0;
    accent-color: var(--accent);
}

/* Mise en avant de l'option cochee (sans JS : :has est supporte par les
   navigateurs actuels ; a defaut la case reste simplement cochee). */
.field-choice label:has(input:checked) {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), .08);
    font-weight: 500;
}

/* ---------- Vitrine repli (aucune publicite) ---------- */
.showcase-fallback {
    position: relative;
    z-index: 2;
    max-width: 560px;
}

.showcase-fallback h2 {
    font-size: 36px;
    line-height: 1.2;
    margin: 0 0 16px;
    font-weight: 700;
}

.showcase-fallback p {
    font-size: 16px;
    line-height: 1.65;
    color: rgba(255, 255, 255, .78);
    margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .login-showcase,
    .showcase-brand,
    .ad-caption,
    .ad-dots { padding-left: 36px; }
    .showcase-brand, .ad-caption, .ad-dots { left: 36px; right: 36px; }
    .ad-caption h2 { font-size: 28px; }
    .login-panel { flex-basis: 420px; }
}

@media (max-width: 900px) {
    .login-shell { display: block; }
    .login-showcase { display: none; }
    .login-panel {
        flex: none;
        width: 100%;
        min-height: 100vh;
        box-shadow: none;
    }
}

/* ------------------------------------------------------------------
 * Variante « bleu ciel » : portail eleves / parents (site/userlogin).
 * Distingue visuellement l'entree des familles de celle des
 * administrateurs, qui garde le bleu nuit par defaut.
 * S'active en posant class="theme-parents" sur <body>.
 * ------------------------------------------------------------------ */
body.theme-parents {
    --brand-dark: #1478b0;
    --brand: #46abdd;
    --brand-2: #8fd3ef;
    --brand-light: #5cb9e6;
    --accent: #0f86c4;
    --accent-dark: #0b6d9f;
    --accent-rgb: 15, 134, 196;
    --tag-text: #dbf1fd;
    --scrim-rgb: 8, 48, 74;
    --page-bg: #eef8fd;
}

/* Degrade inverse : ciel clair en haut, bleu profond en bas, la ou se
   posent le titre et le texte de l'encart. */
body.theme-parents .login-showcase {
    background: linear-gradient(160deg, var(--brand-2) 0%, var(--brand) 42%, var(--brand-dark) 100%);
}

/* Voile de lisibilite pour les encarts sans image (actualites CMS) :
   place sous .ad-stage, il ne s'applique donc qu'aux fonds transparents,
   les images ayant deja leur propre voile. */
body.theme-parents .login-showcase::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to top, rgba(var(--scrim-rgb), .55) 0%, rgba(var(--scrim-rgb), .22) 45%, rgba(var(--scrim-rgb), 0) 75%);
}

body.theme-parents .login-showcase::after {
    background: rgba(255, 255, 255, .14);
}

body.theme-parents .login-panel {
    box-shadow: -18px 0 46px rgba(20, 120, 176, .16);
}

/* Sur fond bleu, l'accent bleu du bouton ne ressort pas : reperes en blanc. */
body.theme-parents .ad-dots button.is-active,
body.theme-parents .showcase-brand .dot {
    background: #fff;
}

body.theme-parents .ad-caption a.ad-link {
    border-bottom-color: #fff;
}

body.theme-parents .ad-caption .tag {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .5);
    color: #fff;
}
