/* Reset global pour comportement type Application Mobile */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-color: #0b111e;
    --input-bg: #1c2638;
    --text-primary: #ffffff;
    --text-secondary: #7e8b9b;
    --accent-orange: #ff6a00;
    --accent-yellow: #ee9b00;
    --border-color: #26354a;
}

body.login-page {
    background-color: var(--bg-color);
    background: radial-gradient(circle at top right, #1a2942 0%, #0b111e 70%);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: max(16px, env(safe-area-inset-top, 0px))
             max(16px, env(safe-area-inset-right, 0px))
             max(16px, env(safe-area-inset-bottom, 0px))
             max(16px, env(safe-area-inset-left, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Conteneur principal */
.login-container {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Header & Logos */
.login-header {
    text-align: center;
    margin-bottom: 40px;
    width: 100%;
}

.logo-placeholder {
    display: flex;
    flex-direction: column;
    font-weight: 700;
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 25px;
    letter-spacing: 1px;
    word-break: break-word;
    text-align: center;
}

.logo-main {
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.logo-sub {
    color: var(--accent-orange);
    font-size: 2.4rem;
    background: linear-gradient(45deg, var(--accent-orange), var(--accent-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.5rem;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.welcome-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Structure du Formulaire */
.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form {
    display: none;
}

.auth-form.auth-form--active {
    display: flex;
}

.login-footer .forgot-password.is-hidden {
    display: none;
}

.auth-mode-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--accent-orange);
    cursor: pointer;
    text-decoration: underline;
}

.auth-mode-link:hover {
    color: var(--accent-yellow);
}

.login-form--shake {
    animation: formShake 0.45s ease-out;
}

@keyframes formShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding-left: 5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 15px;
    font-size: 1.1rem;
    opacity: 0.6;
}

.input-wrapper input {
    width: 100%;
    min-width: 0;
    padding: 14px 44px 14px 45px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.input-wrapper input:focus {
    border-color: var(--accent-orange);
}

.toggle-password {
    position: absolute;
    right: 15px;
    cursor: pointer;
    opacity: 0.6;
    user-select: none;
    background: none;
    border: none;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    color: inherit;
}

/* Bouton principal Chakra */
.btn-login {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: linear-gradient(90deg, var(--accent-orange) 0%, var(--accent-yellow) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(238, 155, 0, 0.3);
    transition: transform 0.1s, opacity 0.2s;
}

.btn-login:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-login:disabled {
    opacity: 0.85;
    cursor: wait;
}

.btn-login.is-loading .shuriken-icon {
    display: none;
}

.btn-login-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: loginSpin 0.7s linear infinite;
}

.btn-login.is-loading .btn-login-spinner {
    display: block;
}

@keyframes loginSpin {
    to { transform: rotate(360deg); }
}

.shuriken-icon {
    font-size: 1.1rem;
}

.password-hint {
    margin: 6px 0 0;
    padding: 0 4px;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--muted-text, #94a3b8);
}

/* Message d'erreur inline */
.login-feedback {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    text-align: center;
    animation: feedbackIn 0.25s ease-out;
}

.login-feedback--error {
    background: rgba(255, 59, 48, 0.12);
    border: 1px solid rgba(255, 59, 48, 0.35);
    color: #ff8a84;
}

.login-feedback--info {
    background: rgba(255, 106, 0, 0.1);
    border: 1px solid rgba(255, 106, 0, 0.3);
    color: #ffb380;
}

.login-feedback--success {
    background: rgba(76, 217, 100, 0.12);
    border: 1px solid rgba(76, 217, 100, 0.35);
    color: #7dffb0;
}

@keyframes feedbackIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Overlay succès / chargement */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 8, 15, 0.88);
    backdrop-filter: blur(8px);
    animation: overlayFadeIn 0.2s ease-out;
}

.login-overlay[hidden] {
    display: none !important;
}

.login-overlay-card {
    text-align: center;
    padding: 32px 28px;
    max-width: 320px;
    width: 100%;
    background: rgba(28, 38, 56, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.login-overlay-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-overlay-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 106, 0, 0.2);
    border-top-color: var(--accent-orange);
    border-radius: 50%;
    animation: loginSpin 0.75s linear infinite;
}

.login-overlay--success .login-overlay-spinner {
    display: none;
}

.login-overlay--success .login-overlay-icon::after {
    content: '✓';
    font-size: 2rem;
    font-weight: 700;
    color: #4cd964;
    line-height: 1;
}

.login-overlay-message {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Liens d'arborescence */
.login-footer {
    text-align: center;
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.login-footer a {
    color: var(--accent-yellow);
    text-decoration: none;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

.login-footer a:hover {
    opacity: 0.8;
}

.signup-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.signup-text a {
    font-weight: 600;
}