/* ========================================================
   FEUILLE DE STYLE - ESPACE SÉCURISÉ L'HOME DÉMOL SERVICE
   Design System Moderne & Finition Haute Qualité
   ======================================================== */

:root {
    --bg-dark-1: #051329;
    --bg-dark-2: #0a2342;
    --bg-dark-3: #12345e;
    
    --primary: #2b9d8f;
    --primary-hover: #21867a;
    --primary-light: rgba(43, 157, 143, 0.12);
    --primary-glow: rgba(43, 157, 143, 0.4);

    --accent-orange: #f4a261;
    --accent-red: #e74c3c;
    --accent-blue: #3498db;
    --accent-gold: #f39c12;

    --card-bg: rgba(255, 255, 255, 0.98);
    --card-border: rgba(255, 255, 255, 0.2);
    --card-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --input-focus: #2b9d8f;

    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body {
    background: radial-gradient(circle at 10% 20%, var(--bg-dark-3) 0%, var(--bg-dark-2) 50%, var(--bg-dark-1) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
    color: var(--text-main);
    position: relative;
    overflow-x: hidden;
}

/* --- LUMIÈRES D'AMBIANCE EN ARRIÈRE-PLAN --- */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.45;
}

.glow-1 {
    width: 400px;
    height: 400px;
    top: -80px;
    left: -80px;
    background: radial-gradient(circle, #2b9d8f 0%, rgba(43,157,143,0) 70%);
}

.glow-2 {
    width: 500px;
    height: 500px;
    bottom: -100px;
    right: -100px;
    background: radial-gradient(circle, #1d4ed8 0%, rgba(29,78,216,0) 70%);
}

/* --- CONTENEUR GLOBAL --- */
.login-wrapper {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: authFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* --- CARTE PRINCIPALE D'AUTHENTIFICATION --- */
.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    padding: 38px 34px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.4);
    position: relative;
}

/* SHAKE ANIMATION EN CAS D'ERREUR */
.auth-card.shake {
    animation: shakeCard 0.4s ease-in-out;
}

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

/* --- EN-TÊTE --- */
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    background: #f1f5f9;
    padding: 6px 16px 6px 8px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    margin-bottom: 16px;
    transition: all 0.25s ease;
}

.brand-badge:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.brand-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--bg-dark-2), var(--primary));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(43,157,143,0.3);
}

.brand-title {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.logo-main {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--bg-dark-2);
    letter-spacing: 0.5px;
}

.logo-main .highlight {
    color: var(--primary);
}

.logo-sub {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.auth-header h1 {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--bg-dark-2);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* --- BANDEAU SESSION ACTIVE --- */
.active-session-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 20px;
    font-size: 0.88rem;
    color: #1e3a8a;
}

/* --- ONGLETS (TABS) --- */
.auth-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: #fff;
    color: var(--bg-dark-2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-icon {
    font-size: 0.95rem;
}

/* --- FORMULAIRES --- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-field label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-main);
}

.link-forgot {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.link-forgot:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

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

.input-icon {
    position: absolute;
    left: 14px;
    font-size: 1rem;
    color: var(--text-light);
    pointer-events: none;
}

.input-control input,
.input-control select {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
}

.input-control select {
    cursor: pointer;
}

.input-control input:focus,
.input-control select:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.btn-pwd-eye {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.btn-pwd-eye:hover {
    opacity: 1;
}

/* GRILLE 2 COLONNES */
.grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .grid-2-cols {
        grid-template-columns: 1fr;
    }
}

/* INTRO PRO */
.pro-intro-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 0.82rem;
    color: #166534;
    line-height: 1.4;
}

.pro-tag {
    display: block;
    font-weight: 800;
    margin-bottom: 4px;
    color: #15803d;
}

/* --- CHECKBOX PERSONNALISÉE --- */
.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 18px;
    height: 18px;
    background-color: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.custom-checkbox:hover input ~ .checkmark {
    border-color: var(--primary);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox input:checked ~ .checkmark:after {
    content: "✓";
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
}

/* --- BOUTON PRINCIPAL D'ACTION --- */
.btn-primary-auth {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    border: none;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.98rem;
    font-weight: 800;
    font-family: var(--font-heading);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 6px 18px var(--primary-glow);
    transition: all 0.25s ease;
    margin-top: 4px;
}

.btn-primary-auth:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 8px 24px rgba(43, 157, 143, 0.45);
    background: linear-gradient(135deg, #32b5a5 0%, #1a756b 100%);
}

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

.btn-primary-auth:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-pro-action {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.35);
}

.btn-pro-action:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 8px 24px rgba(29, 78, 216, 0.45);
}

/* SPINNER DE CHARGEMENT */
.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

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

/* --- ALERTES ET FEEDBACKS --- */
.alert-box {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

/* --- PIED DE LA CARTE --- */
.auth-card-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: var(--bg-dark-2);
    transform: translateX(-3px);
}

/* --- TIROIR DÉVELOPPEUR & COMPTES DE DÉMO --- */
.dev-quick-access {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
}

.dev-summary {
    padding: 12px 18px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 700;
    user-select: none;
    list-style: none;
}

.dev-summary::-webkit-details-marker {
    display: none;
}

.dev-arrow {
    font-size: 0.7rem;
    transition: transform 0.25s ease;
}

.dev-details[open] .dev-arrow {
    transform: rotate(180deg);
}

.dev-content {
    padding: 0 16px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dev-note {
    font-size: 0.74rem;
    color: #94a3b8;
    margin: 10px 0 8px 0;
}

.dev-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (max-width: 480px) {
    .dev-grid {
        grid-template-columns: 1fr;
    }
}

.dev-chip {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid transparent;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.76rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    color: var(--bg-dark-2);
    transition: all 0.2s ease;
    text-align: left;
}

.dev-chip span {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: monospace;
}

.dev-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chip-admin:hover { border-color: var(--accent-gold); background: #fffdf5; }
.chip-tech:hover { border-color: var(--primary); background: #f0fdf9; }
.chip-client:hover { border-color: var(--accent-blue); background: #f0f7ff; }

/* --- MODALE --- */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 19, 41, 0.7);
    backdrop-filter: blur(6px);
}

.modal-card {
    position: relative;
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    position: relative;
}

.modal-icon {
    font-size: 1.4rem;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--bg-dark-2);
    font-weight: 800;
}

.modal-close-btn {
    position: absolute;
    right: 0;
    top: 0;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 18px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-modal-cancel {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.86rem;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-modal-submit {
    background: var(--primary);
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.86rem;
    color: #fff;
    cursor: pointer;
}

/* --- TOASTS --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
}

.toast {
    background: var(--bg-dark-2);
    color: #fff;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    border-left: 5px solid var(--primary);
    animation: toastIn 0.3s ease-out;
}

.toast.success { border-left-color: #22c55e; }
.toast.error { border-left-color: var(--accent-red); }

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