/*
 * 16/11/2026 - Écrans de connexion JYL CONCEPT : nouveau design (repris de la
 * page login du CRM socle « demoreno-new », css/login.css), aux couleurs JYL.
 *
 * Chargé UNIQUEMENT par les pages qui posent $uiLoginCss = true avant
 * inc/template_start.php (login.php). Les pages 2FA ont leurs propres styles
 * (bloc « Pages 2FA TOTP » de css/main.css), dont cette palette reprend les couleurs.
 * Fichier séparé de css/main.css car celui-ci est chargé sur toutes les pages :
 * toutes les classes sont préfixées « lgn- », les @keyframes aussi, et aucune
 * règle globale (*, body, .help-block…) n'est posée.
 */

/* =========================================================
   Palette JYL — à ajuster ici uniquement.
   16/11/26 : alignée sur le logo (vert émeraude + jaune citron sur fond
   sombre) et sur les pages 2FA déjà en place (verify_2fa.php), relevé
   visuel faute de main.css en local.
   ========================================================= */
:root {
    --lgn-dark: #1e1224;            /* fond historique du logo logo-jyl2.png */
    --lgn-dark-2: #1f2b33;          /* bleu-vert très sombre (coin du fond 2FA) */
    --lgn-dark-green: #1d4a45;      /* phase vert sombre du fond animé 2FA */
    --lgn-emerald: #2bb98a;
    --lgn-emerald-rgb: 43, 185, 138;
    --lgn-lime: #b8d433;
    --lgn-lime-rgb: 184, 212, 51;
    --lgn-teal: #2a8c9c;
    --lgn-teal-rgb: 42, 140, 156;
    --lgn-text: #1e1224;
    --lgn-text-soft: #6b7280;
    --lgn-border: #e2e8f0;
    --lgn-danger: #e5484d;
}

/* =========================================================
   Fond animé : fond sombre + halos flous émeraude / bleu-vert / citron
   ========================================================= */
.lgn-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.lgn-bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
        var(--lgn-dark-green) 0%,
        var(--lgn-dark-2) 25%,
        var(--lgn-dark) 50%,
        #2a1a35 75%,
        var(--lgn-dark-green) 100%);
    background-size: 300% 300%;
    animation: lgn-gradient-shift 20s ease infinite;
}

@keyframes lgn-gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.lgn-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(45px);
    opacity: 0.55;
}

.lgn-shape-1 { background: rgba(var(--lgn-emerald-rgb), 0.8); }
.lgn-shape-2 { background: rgba(var(--lgn-teal-rgb), 0.8); }
.lgn-shape-3 { background: rgba(var(--lgn-lime-rgb), 0.7); }
.lgn-shape-4 { background: rgba(var(--lgn-lime-rgb), 0.7); }

.lgn-shape-1 { width: 300px; height: 300px; top: -100px; left: -100px; animation: lgn-float 20s ease-in-out infinite; }
.lgn-shape-2 { width: 200px; height: 200px; top: 25%; right: 15%; animation: lgn-float 15s ease-in-out infinite reverse; }
.lgn-shape-3 { width: 150px; height: 150px; bottom: 10%; left: 10%; animation: lgn-float 18s ease-in-out infinite; }
.lgn-shape-4 { width: 220px; height: 220px; bottom: 8%; right: 4%; animation: lgn-float 22s ease-in-out infinite reverse; }

@keyframes lgn-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(30px, -30px) scale(1.1); }
    66%      { transform: translate(-20px, 20px) scale(0.9); }
}

/* =========================================================
   Conteneur + carte
   ========================================================= */
.lgn-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;               /* remplace body{overflow:hidden} du modèle */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    animation: lgn-fade-in 0.8s ease;
}

.lgn-container *,
.lgn-container *::before,
.lgn-container *::after {
    box-sizing: border-box;
}

@keyframes lgn-fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lgn-card {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 44px 40px;
    width: 100%;
    max-width: 450px;
    margin: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    animation: lgn-card-up 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.lgn-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
    pointer-events: none;
}

.lgn-card:hover::before {
    left: 100%;
}

@keyframes lgn-card-up {
    from { opacity: 0; transform: translateY(50px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================================
   En-tête : logo + titre
   ========================================================= */
.lgn-header {
    text-align: center;
    margin-bottom: 34px;
}

/* Le logo JYL est prévu sur fond sombre (#1e1224) : cadre sombre */
.lgn-logo {
    display: block;
    margin: 0 auto 25px;
    padding: 6px 10px;
    background: var(--lgn-dark);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    animation: lgn-logo-float 3s ease-in-out infinite;
}

@keyframes lgn-logo-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.lgn-logo-img {
    display: block;
    width: 100%;
    max-width: 340px;
    height: auto;
    margin: 0 auto;
}

.lgn-title {
    font-size: 30px;
    font-weight: 700;
    color: var(--lgn-text);
    margin: 0 0 8px 0;
    animation: lgn-title-slide 0.8s ease 0.2s both;
}

@keyframes lgn-title-slide {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.lgn-subtitle {
    font-size: 15px;
    color: var(--lgn-text-soft);
    margin: 0;
    animation: lgn-title-slide 0.8s ease 0.3s both;
}

/* =========================================================
   Formulaire
   ========================================================= */
.lgn-group {
    margin-bottom: 22px;
    animation: lgn-group-slide 0.6s ease 0.4s both;
}

.lgn-group + .lgn-group {
    animation-delay: 0.5s;
}

@keyframes lgn-group-slide {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.lgn-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--lgn-text);
    margin-bottom: 8px;
}

.lgn-label i {
    color: var(--lgn-emerald);
    font-size: 15px;
}

.lgn-input-wrapper {
    position: relative;
}

.lgn-input {
    width: 100%;
    height: auto;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid var(--lgn-border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--lgn-text);
    transition: all 0.3s ease;
    outline: none;
    box-shadow: none;
}

.lgn-input-wrapper .lgn-input-password {
    padding-right: 48px;           /* place du bouton œil */
}

.lgn-input:focus {
    border-color: var(--lgn-emerald);
    box-shadow: 0 0 0 4px rgba(var(--lgn-emerald-rgb), 0.12);
    transform: translateY(-2px);
}

.lgn-input::placeholder {
    color: #c3bccb;
}

.lgn-toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #a59bad;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.lgn-toggle-password:hover {
    color: var(--lgn-emerald);
    background: rgba(var(--lgn-emerald-rgb), 0.1);
}

/* Case « Se souvenir de moi » */
.lgn-options {
    margin-bottom: 28px;
    animation: lgn-group-slide 0.6s ease 0.6s both;
}

.lgn-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-weight: normal;
    margin: 0;
}

.lgn-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lgn-checkbox-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--lgn-border);
    border-radius: 6px;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.lgn-checkbox input:checked + .lgn-checkbox-box {
    background: linear-gradient(135deg, var(--lgn-emerald) 0%, var(--lgn-lime) 100%);
    border-color: var(--lgn-emerald);
}

.lgn-checkbox input:checked + .lgn-checkbox-box::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--lgn-text);
    font-size: 12px;
    font-weight: bold;
}

.lgn-checkbox input:focus-visible + .lgn-checkbox-box {
    box-shadow: 0 0 0 3px rgba(var(--lgn-emerald-rgb), 0.25);
}

.lgn-checkbox-label {
    font-size: 14px;
    color: var(--lgn-text-soft);
}

/* Bouton de connexion */
.lgn-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: var(--lgn-text);         /* texte sombre, comme « Vérifier le code » (2FA) */
    background: linear-gradient(135deg, var(--lgn-emerald) 0%, var(--lgn-lime) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(var(--lgn-emerald-rgb), 0.4);
    position: relative;
    overflow: hidden;
    animation: lgn-group-slide 0.6s ease 0.7s both;
}

.lgn-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transition: left 0.5s;
}

.lgn-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--lgn-emerald-rgb), 0.5);
}

.lgn-btn:hover::before {
    left: 100%;
}

.lgn-btn:active {
    transform: translateY(0);
}

.lgn-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.lgn-btn-icon {
    transition: transform 0.3s ease;
}

.lgn-btn:hover .lgn-btn-icon {
    transform: translateX(4px);
}

/* Erreurs (jquery.validate) : limitées à la carte */
.lgn-card .has-error .lgn-input {
    border-color: var(--lgn-danger);
    animation: lgn-shake 0.5s;
}

.lgn-card .help-block {
    color: var(--lgn-danger);
    font-size: 13px;
    margin-top: 6px;
}

@keyframes lgn-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-10px); }
    75%      { transform: translateX(10px); }
}

/* =========================================================
   Accessibilité / responsive
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    .lgn-bg-gradient,
    .lgn-shape,
    .lgn-logo { animation: none; }
}

@media (max-width: 576px) {
    .lgn-card  { padding: 34px 24px; }
    .lgn-title { font-size: 26px; }
}
