/**
 * 🎨 Styles d'Authentification Centralisés
 * Version: 1.0.0
 * Compatible avec tous les sites /chez-nous/
 */

/* === OVERLAY DE LOGIN === */
.auth-login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(25, 25, 112, 0.95), rgba(72, 61, 139, 0.95));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: authFadeIn 0.3s ease-out;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.auth-login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 400px;
    max-width: 90vw;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: authSlideUp 0.4s ease-out;
}

@keyframes authSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-login-title {
    font-size: 2.2em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-login-subtitle {
    font-size: 1.1em;
    color: #7f8c8d;
    margin-bottom: 30px;
    font-weight: 500;
}

.auth-login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-login-input {
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    outline: none;
    color: #2c3e50;
}

.auth-login-input:focus {
    border-color: #3498db;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.auth-login-input::placeholder {
    color: #95a5a6;
    font-weight: 400;
}

.auth-login-button {
    padding: 15px 30px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
}

.auth-login-button:hover {
    background: linear-gradient(135deg, #2980b9, #1e6091);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.auth-login-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.auth-login-error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    margin-top: 10px;
    border-left: 4px solid #a93226;
    animation: authErrorShake 0.5s ease-out;
}

@keyframes authErrorShake {
    0%, 20%, 40%, 60%, 80% {
        transform: translateX(-3px);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(3px);
    }
    100% {
        transform: translateX(0);
    }
}

/* === INFORMATIONS DE SESSION === */
.auth-session-info {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 1000;
    animation: authSlideInRight 0.4s ease-out;
}

@keyframes authSlideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.auth-session-time {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #27ae60;
    background: rgba(46, 204, 113, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.auth-session-time.auth-attention {
    color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
    animation: authPulse 2s infinite;
}

.auth-session-time.auth-warning {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    animation: authUrgentPulse 1s infinite;
}

@keyframes authPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

@keyframes authUrgentPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
}

.auth-logout-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.auth-logout-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
}

/* === MODAL DE SESSION === */
.auth-session-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: authModalFadeIn 0.3s ease-out;
}

@keyframes authModalFadeIn {
    from {
        opacity: 0;
        background: rgba(0, 0, 0, 0);
    }
    to {
        opacity: 1;
        background: rgba(0, 0, 0, 0.8);
    }
}

.auth-session-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90vw;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: authModalSlideIn 0.4s ease-out;
}

@keyframes authModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-session-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: authIconPulse 2s infinite;
}

@keyframes authIconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.auth-session-title {
    font-size: 1.8em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 20px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.auth-session-content p {
    font-size: 1.1em;
    color: #5d6d7e;
    margin-bottom: 15px;
    line-height: 1.5;
}

.auth-session-content span {
    font-weight: bold;
    color: #e74c3c;
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
}

.auth-session-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.auth-session-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
}

.auth-session-btn.auth-continue {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.auth-session-btn.auth-continue:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

.auth-session-btn.auth-logout {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.auth-session-btn.auth-logout:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(149, 165, 166, 0.3);
}

/* === RESPONSIVITÉ === */
@media (max-width: 768px) {
    .auth-login-container {
        width: 350px;
        padding: 30px 25px;
    }
    
    .auth-login-title {
        font-size: 1.8em;
    }
    
    .auth-session-info {
        position: static;
        margin: 10px;
        width: calc(100% - 20px);
        justify-content: center;
        border-radius: 15px;
    }
    
    .auth-session-content {
        padding: 30px 20px;
    }
    
    .auth-session-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .auth-session-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .auth-login-container {
        width: 95vw;
        padding: 25px 20px;
    }
    
    .auth-login-title {
        font-size: 1.5em;
    }
    
    .auth-login-input,
    .auth-login-button {
        font-size: 14px;
        padding: 12px 15px;
    }
    
    .auth-session-content {
        padding: 25px 15px;
    }
    
    .auth-session-title {
        font-size: 1.5em;
    }
}

/* === INTÉGRATION AVEC LES SITES EXISTANTS === */
/* Masquer le contenu non-authentifié */
body:not(.auth-authenticated) .auth-protected {
    display: none !important;
}

/* Afficher le contenu une fois authentifié */
body.auth-authenticated .auth-protected {
    display: block !important;
}

/* Style pour les éléments nécessitant une authentification */
.auth-required {
    position: relative;
}

.auth-required::before {
    content: "🔒";
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 0 0 0 8px;
    font-size: 12px;
    z-index: 100;
}

/* Animation de chargement */
.auth-loading {
    position: relative;
    overflow: hidden;
}

.auth-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3498db, transparent);
    animation: authLoading 1.5s infinite;
}

@keyframes authLoading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* === THÈME SOMBRE === */
@media (prefers-color-scheme: dark) {
    .auth-login-container {
        background: rgba(44, 62, 80, 0.95);
        color: #ecf0f1;
    }
    
    .auth-login-title {
        color: #ecf0f1;
    }
    
    .auth-login-input {
        background: rgba(52, 73, 94, 0.9);
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .auth-login-input::placeholder {
        color: #95a5a6;
    }
    
    .auth-session-info {
        background: rgba(44, 62, 80, 0.95);
        color: #ecf0f1;
    }
    
    .auth-session-content {
        background: rgba(44, 62, 80, 0.95);
        color: #ecf0f1;
    }
    
    .auth-session-title {
        color: #ecf0f1;
    }
    
    .auth-session-content p {
        color: #bdc3c7;
    }
}

/* === ACCESSIBILITÉ === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible pour l'accessibilité */
.auth-login-input:focus-visible,
.auth-login-button:focus-visible,
.auth-logout-btn:focus-visible,
.auth-session-btn:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Haute visibilité */
@media (prefers-contrast: high) {
    .auth-login-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .auth-login-container,
    .auth-session-info,
    .auth-session-content {
        border: 2px solid #000;
        background: #fff;
        color: #000;
    }
    
    .auth-login-button,
    .auth-logout-btn,
    .auth-session-btn {
        border: 2px solid #000;
    }
}