/* ============================================== */
/* LOGIN.CSS - Une Tartine de Bonheur            */
/* Styles de la page de connexion                */
/* Version 1.0                                   */
/* ============================================== */

/* === Reset === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === Variables - Palette Boulangerie === */
:root {
    /* Couleurs principales */
    --primary-gold: #FDB913;
    --primary-gold-dark: #E5A811;
    --primary-gold-light: #FFD54F;
    
    /* Couleurs chaudes */
    --brown-dark: #5D4037;
    --brown-medium: #795548;
    --brown-light: #A1887F;
    
    /* Fonds et surfaces */
    --bg-cream: #FFF8E7;
    --bg-warm-white: #FFFDF7;
    --bg-light-beige: #F5E6D3;
    
    /* Textes */
    --text-dark: #3E2723;
    --text-medium: #5D4037;
    --text-light: #8D6E63;
    
    /* Bordures et ombres */
    --border-light: #E8D5C4;
    --border-medium: #D7C4B0;
    
    /* États */
    --error-bg: #FFEBEE;
    --error-text: #C62828;
    --error-border: #FFCDD2;
    --info-bg: #FFF3E0;
    --info-text: #E65100;
    --info-border: #FFE0B2;
    --success-bg: #E8F5E9;
    --success-text: #2E7D32;
    --success-border: #C8E6C9;
    
    /* Ombres */
    --shadow-soft: 0 4px 20px rgba(93, 64, 55, 0.1);
    --shadow-medium: 0 8px 40px rgba(93, 64, 55, 0.15);
    --shadow-gold: 0 4px 20px rgba(253, 185, 19, 0.3);
    
    /* Transitions */
    --transition-speed: 0.3s;
    
    /* Safe areas */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
}

/* === Fonts === */
@font-face {
    font-family: 'OrdinaryGuy';
    src: url('../fonts/ordinaryguyDEMO.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* === Base === */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-cream);
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(253, 185, 19, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(253, 185, 19, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(161, 136, 127, 0.05) 0%, transparent 30%);
    color: var(--text-dark);
    min-height: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
    padding: var(--safe-area-top) var(--safe-area-right) var(--safe-area-bottom) var(--safe-area-left);
}

/* === Décoration de fond === */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 100%;
    background: radial-gradient(ellipse, rgba(253, 185, 19, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* === Layout === */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1rem;
    padding-top: calc(1rem + var(--safe-area-top));
    padding-bottom: calc(1rem + var(--safe-area-bottom));
    position: relative;
    z-index: 1;
}

.login-box {
    background: var(--bg-warm-white);
    border-radius: 20px;
    box-shadow: var(--shadow-medium);
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: fadeIn 0.6s ease;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

/* Décoration subtile sur la boîte */
.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-gold), var(--primary-gold-light), var(--primary-gold));
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Logo === */
.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.logo {
    width: 75px;
    height: auto;
    will-change: transform;
    filter: drop-shadow(0 4px 8px rgba(93, 64, 55, 0.15));
}

.logo-left {
    animation: float 3s ease-in-out infinite;
}

.logo-right {
    animation: float 3s ease-in-out infinite 1.5s;
}

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

/* === Typography === */
.login-box h1 {
    color: var(--brown-dark);
    margin-bottom: 0.5rem;
    font-size: 1.6rem;
    font-weight: 400;
    font-family: 'OrdinaryGuy', cursive, sans-serif;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.login-box p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* === Forms === */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-medium);
    font-weight: 600;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 2px solid var(--border-medium);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all var(--transition-speed) ease;
    background-color: var(--bg-warm-white);
    color: var(--text-dark);
    -webkit-appearance: none;
    appearance: none;
    min-height: 50px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 4px rgba(253, 185, 19, 0.15);
    background-color: #FFFFFF;
}

.form-group input::placeholder {
    color: var(--brown-light);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 3.5rem;
}

.toggle-password-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    color: var(--brown-light);
    transition: all var(--transition-speed) ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.toggle-password-btn:hover,
.toggle-password-btn:active {
    color: var(--primary-gold-dark);
    background: rgba(253, 185, 19, 0.1);
}

/* === Buttons === */
.btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-gold-dark) 100%);
    color: var(--text-dark);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all var(--transition-speed) ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 52px;
    box-shadow: var(--shadow-gold);
    letter-spacing: 0.02em;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(253, 185, 19, 0.4);
    background: linear-gradient(135deg, var(--primary-gold-light) 0%, var(--primary-gold) 100%);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.btn:focus-visible {
    outline: 3px solid var(--brown-dark);
    outline-offset: 2px;
}

/* === Messages === */
.message {
    padding: 0.875rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
    font-weight: 500;
}

.message.show {
    opacity: 1;
    max-height: 150px;
    padding: 0.875rem 1rem;
}

.error-message {
    background-color: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.info-message {
    background-color: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* === Footer === */
.login-footer {
    margin-top: 1.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.75rem;
    color: var(--text-light);
}

/* === Décoration pain/blé === */
.decoration {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0.15;
    pointer-events: none;
}

.decoration-1 { top: 15%; left: 8%; transform: rotate(-15deg); }
.decoration-2 { top: 25%; right: 10%; transform: rotate(20deg); }
.decoration-3 { bottom: 20%; left: 12%; transform: rotate(10deg); }
.decoration-4 { bottom: 15%; right: 8%; transform: rotate(-10deg); }

/* ==================== RESPONSIVE - TRÈS PETIT MOBILE (<360px) ==================== */
@media (max-width: 359px) {
    .login-container {
        padding: 0.75rem;
    }

    .login-box {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }

    .logo {
        width: 55px;
    }

    .logo-container {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .login-box h1 {
        font-size: 1.35rem;
    }

    .login-box p {
        font-size: 0.8125rem;
        margin-bottom: 1rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        font-size: 0.8125rem;
    }

    .form-group input {
        padding: 0.8rem;
    }

    .btn {
        padding: 0.9rem;
        font-size: 0.9375rem;
    }

    .decoration {
        display: none;
    }
}

/* ==================== RESPONSIVE - MOBILE (360px - 480px) ==================== */
@media (min-width: 360px) and (max-width: 480px) {
    .login-box {
        padding: 1.75rem 1.25rem;
    }

    .logo {
        width: 68px;
    }

    .decoration {
        font-size: 1.25rem;
    }
}

/* ==================== RESPONSIVE - TABLETTE (481px - 768px) ==================== */
@media (min-width: 481px) and (max-width: 768px) {
    .login-box {
        padding: 2.5rem 2rem;
        border-radius: 24px;
    }

    .logo {
        width: 85px;
    }

    .logo-container {
        gap: 1rem;
        margin-bottom: 1.25rem;
    }

    .login-box h1 {
        font-size: 1.85rem;
    }

    .login-box p {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .form-group {
        margin-bottom: 1.5rem;
    }

    .form-group input {
        padding: 1rem 1.125rem;
        border-radius: 14px;
    }

    .btn {
        padding: 1.125rem;
        border-radius: 14px;
        margin-top: 0.75rem;
    }
}

/* ==================== RESPONSIVE - DESKTOP (769px+) ==================== */
@media (min-width: 769px) {
    .login-container {
        padding: 2rem;
    }

    .login-box {
        max-width: 450px;
        padding: 3rem 2.5rem;
        border-radius: 28px;
    }

    .logo {
        width: 100px;
    }

    .logo-container {
        gap: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .login-box h1 {
        font-size: 2.1rem;
        margin-bottom: 0.625rem;
    }

    .login-box p {
        font-size: 1rem;
        margin-bottom: 2.5rem;
    }

    .form-group {
        margin-bottom: 1.75rem;
    }

    .form-group label {
        font-size: 0.9375rem;
        margin-bottom: 0.625rem;
    }

    .form-group input {
        padding: 1.1rem 1.25rem;
        border-radius: 14px;
    }

    .btn {
        padding: 1.15rem;
        font-size: 1.0625rem;
        border-radius: 14px;
        margin-top: 0.5rem;
    }

    .message {
        border-radius: 12px;
    }

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

/* ==================== RESPONSIVE - GRAND DESKTOP (1200px+) ==================== */
@media (min-width: 1200px) {
    .login-box {
        max-width: 480px;
        padding: 3.5rem 3rem;
    }

    .logo {
        width: 110px;
    }

    .login-box h1 {
        font-size: 2.35rem;
    }
}

/* ==================== PAYSAGE MOBILE ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    .login-container {
        padding: 0.5rem 1rem;
        align-items: flex-start;
    }

    .login-box {
        padding: 1rem 1.5rem;
        margin-top: 0.5rem;
    }

    .logo-container {
        margin-bottom: 0.5rem;
    }

    .logo {
        width: 45px;
    }

    @keyframes float {
        0%, 100%, 50% { 
            transform: translateY(0);
        }
    }

    .login-box h1 {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }

    .login-box p {
        font-size: 0.8125rem;
        margin-bottom: 0.75rem;
    }

    .form-group {
        margin-bottom: 0.625rem;
    }

    .form-group label {
        margin-bottom: 0.25rem;
        font-size: 0.8125rem;
    }

    .form-group input {
        padding: 0.625rem 0.875rem;
        min-height: 42px;
    }

    .btn {
        padding: 0.75rem;
        margin-top: 0.5rem;
        min-height: 44px;
    }

    .message {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.5rem;
        font-size: 0.8125rem;
    }

    .login-footer {
        margin-top: 0.75rem;
        padding-top: 0.5rem;
    }

    .decoration {
        display: none;
    }
}

/* ==================== CLAVIER VIRTUEL OUVERT ==================== */
@media (max-height: 450px) {
    .login-container {
        align-items: flex-start;
        padding-top: 1rem;
    }

    .logo-container {
        display: none;
    }

    .login-box h1 {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }

    .login-box p {
        display: none;
    }

    .login-footer {
        display: none;
    }

    .decoration {
        display: none;
    }
}

/* ==================== ACCESSIBILITÉ ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.form-group input:focus-visible,
.toggle-password-btn:focus-visible {
    outline: 3px solid var(--primary-gold);
    outline-offset: 2px;
}

@media (prefers-contrast: high) {
    .form-group input {
        border-width: 3px;
    }

    .btn {
        border: 2px solid var(--brown-dark);
    }
}

/* === Print === */
@media print {
    body {
        background: white;
    }

    .login-box {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .logo-left,
    .logo-right {
        animation: none;
    }

    .decoration {
        display: none;
    }
}

/* === Personnages décoratifs === */
.character {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    opacity: 0.9;
}

.character-girl {
    left: 2%;
    bottom: 5%;
    width: 180px;
    max-width: 15vw;
}

.character-boy {
    right: 2%;
    bottom: 15%;
    width: 160px;
    max-width: 13vw;
}

/* Masquer les personnages sur tablette */
@media (max-width: 1200px) {
    .character-girl {
        width: 140px;
        max-width: 12vw;
        left: 1%;
        bottom: 3%;
    }
    .character-boy {
        width: 120px;
        max-width: 10vw;
        right: 1%;
        bottom: 10%;
    }
}

/* Masquer complètement sur mobile */
@media (max-width: 900px) {
    .character {
        display: none;
    }
}
