/* ========================================
   LOGIN PAGE STYLES - DARK MODERN THEME
   Matching Dashboard Design
   ======================================== */

/* ========================================
   CSS VARIABLES (same as dashboard)
   ======================================== */

:root {
    /* Background colors */
    --bg-primary: #0f0f14;
    --bg-secondary: #1a1a24;
    --bg-card: #22222e;
    --bg-hover: #2a2a38;

    /* Text colors */
    --text-primary: #e4e4e7;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    /* Accent colors */
    --primary: #4a74b4;
    --primary-hover: #6b93cf;
    --secondary: #294064;
    --accent: #9ad1d1;

    /* Status colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.15);

    /* Borders & shadows */
    --border: #2d2d3a;
    --border-light: #3d3d4a;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* ========================================
   RESET & BASE
   ======================================== */

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

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Gradient orb - top left (purple) */
body::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(74, 116, 180, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    top: -150px;
    left: -150px;
    filter: blur(60px);
    z-index: 1;
    animation: float 20s infinite ease-in-out;
}

/* Gradient orb - bottom right (secondary purple) */
body::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 90, 138, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    bottom: -150px;
    right: -100px;
    filter: blur(60px);
    z-index: 1;
    animation: float 25s infinite ease-in-out reverse;
}

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

/* ========================================
   LOGIN CONTAINER
   ======================================== */

.login-container {
    position: relative;
    z-index: 10;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 50px 45px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    animation: containerPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes containerPop {
    0% { opacity: 0; transform: scale(0.95) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-header .logo {
    width: 90px;
    height: 90px;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(74, 116, 180, 0.3);
    object-fit: contain;
    background: var(--bg-secondary);
    padding: 10px;
    border: 1px solid var(--border);
}

.login-header h1 {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.form-group {
    margin-bottom: 22px;
}

label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
input[type="email"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.2s ease;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="email"]::placeholder {
    color: var(--text-muted);
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
    outline: none;
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 116, 180, 0.2);
}

/* ========================================
   BUTTONS
   ======================================== */

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(74, 116, 180, 0.3);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(74, 116, 180, 0.4);
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--accent) 100%);
}

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

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

/* ========================================
   ERROR & SUCCESS MESSAGES
   ======================================== */

.error-message {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid var(--danger);
    display: none;
    animation: slideIn 0.3s ease;
}

.error-message.show {
    display: block;
}

.error-message i {
    margin-right: 10px;
}

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

/* ========================================
   PASSWORD TOGGLE
   ======================================== */

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

.password-wrapper input {
    padding-right: 50px !important;
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    font-size: 16px;
    transition: color 0.2s ease;
}

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

.toggle-password:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ========================================
   FIELD ERRORS
   ======================================== */

.field-error {
    display: none;
    color: var(--danger);
    font-size: 12px;
    margin-top: 6px;
    font-weight: 500;
}

.field-error::before {
    content: '\f071';
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-right: 6px;
    font-size: 10px;
}

input:invalid:not(:placeholder-shown) {
    border-color: var(--danger);
}

/* ========================================
   WARNING MESSAGE
   ======================================== */

.warning-message {
    background: var(--warning-bg);
    color: var(--warning);
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid var(--warning);
    display: none;
    animation: slideIn 0.3s ease;
}

.warning-message i {
    margin-right: 10px;
}

.maintenance-message {
    background: rgba(59, 130, 246, 0.14);
    color: var(--info);
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid var(--info);
    display: none;
    animation: slideIn 0.3s ease;
}

.maintenance-message i {
    margin-right: 10px;
}

/* ========================================
   SECURITY NOTICE
   ======================================== */

.security-notice {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-top: 25px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.security-notice i {
    color: var(--primary);
    font-size: 14px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 500px) {
    .login-container {
        padding: 40px 28px;
        border-radius: 20px;
        margin: 16px;
    }

    .login-header h1 {
        font-size: 22px;
    }

    .login-header .logo {
        width: 75px;
        height: 75px;
    }

    input[type="text"],
    input[type="password"],
    input[type="email"] {
        padding: 12px 14px;
        font-size: 16px;
    }

    .login-btn {
        padding: 13px;
        font-size: 14px;
    }
}

/* ========================================
   2FA / TOTP FIELD
   ======================================== */

.totp-group {
    animation: slideIn 0.3s ease;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.totp-group label {
    color: var(--info);
    display: flex;
    align-items: center;
    gap: 8px;
}

.totp-group label i {
    font-size: 14px;
}

.totp-group input {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 6px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.totp-hint {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
}

/* ========================================
   LOADING STATE
   ======================================== */

.login-btn.loading {
    pointer-events: none;
    position: relative;
    color: transparent;
}

.login-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   FOOTER LINK (optional)
   ======================================== */

.login-footer {
    margin-top: 25px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Liens secondaires (mot de passe oublié, retour, mentions légales) */
.muted-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color .15s;
}
.muted-link:hover,
.muted-link:focus-visible {
    color: var(--primary);
}

/* ================================================
   SSO — Bouton Microsoft + Bandeau suggestion
   ================================================ */

.sso-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 1rem;
    color: var(--text-secondary, #6b7280);
    font-size: 0.8125rem;
}

.sso-divider::before,
.sso-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border, #e5e7eb);
}

.sso-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-light, #3d3d4a);
    border-radius: 8px;
    background: var(--bg-card, #22222e);
    color: var(--text-primary, #e4e4e7);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.sso-btn:hover {
    background: var(--surface, #f3f4f6);
    border-color: var(--primary, #4a74b4);
    box-shadow: 0 0 0 3px rgba(74, 116, 180,0.1);
}

.sso-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Bandeau suggestion liaison SSO */
.sso-suggestion {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding: 1rem;
    background: rgba(74, 116, 180,0.07);
    border: 1px solid rgba(74, 116, 180,0.25);
    border-radius: 10px;
    animation: ssoFadeIn 0.3s ease;
}

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

.sso-suggestion-icon {
    font-size: 1.25rem;
    color: var(--primary, #4a74b4);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.sso-suggestion-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sso-suggestion-text strong {
    font-size: 0.875rem;
    color: var(--text, #111827);
}

.sso-suggestion-text span {
    font-size: 0.8125rem;
    color: var(--text-secondary, #6b7280);
}

.sso-suggestion-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
}

.sso-suggestion-link-btn {
    padding: 0.4rem 0.85rem;
    background: var(--primary, #4a74b4);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.sso-suggestion-link-btn:hover {
    background: var(--primary-hover, #3b5a8a);
}

.sso-suggestion-skip-btn {
    padding: 0.35rem 0.85rem;
    background: transparent;
    color: var(--text-secondary, #6b7280);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.sso-suggestion-skip-btn:hover {
    background: var(--surface, #f3f4f6);
}

/* Bouton Accès Invité */
.sso-btn.sso-guest {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.35);
    color: var(--warning);
    margin-top: 0.6rem;
    font-size: 0.875rem;
}

.sso-btn.sso-guest:hover {
    background: rgba(245, 158, 11, 0.16);
    border-color: var(--warning);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.guest-demo-badge {
    display: inline-block;
    padding: 2px 6px;
    background: var(--warning);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.5px;
    margin-left: 6px;
}

/* Message erreur SSO */
.sso-error-msg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 8px;
    font-size: 0.8125rem;
    color: #ef4444;
}
