/* === SYSTÈME DE VERROUILLAGE UI === */

/* Bouton cadenas dans le header */
#lock-button {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 10px;
    position: relative;
    z-index: 10000;
}

#lock-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

#lock-button:active {
    transform: scale(0.95);
}

/* État verrouillé */
#lock-button.locked {
    color: #dc3545;
    animation: pulse-lock 1s ease-in-out infinite;
}

/* État déverrouillé */
#lock-button.unlocked {
    color: #28a745;
}

@keyframes pulse-lock {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* === OVERLAY DE VERROUILLAGE === */
#lock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    z-index: 9998;
    animation: fadeIn 0.3s ease;
}

#lock-overlay.active {
    display: block;
}

/* Icône centrée quand verrouillé */
#lock-icon-center {
    position: sticky;
    top: 100px;
    text-align: center;
    color: white;
    cursor: pointer;
    z-index: 9999;
    transition: none;
    width: fit-content;
    margin: 0 auto;
}

#lock-icon-center .lock-icon-pulse {
    font-size: 80px;
    animation: pulse-glow 2s ease-in-out infinite;
    margin-bottom: 20px;
}

#lock-icon-center p {
    font-size: 24px;
    font-weight: 600;
    margin: 10px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#lock-icon-center small {
    font-size: 14px;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 0 10px rgba(255,255,255,0.5));
    }
    50% {
        opacity: 0.7;
        filter: drop-shadow(0 0 20px rgba(255,255,255,0.8));
    }
}

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

/* === MODAL DE DÉVERROUILLAGE === */
#lock-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    z-index: 9999;
    transform: translateX(-50%);
    transform-origin: center;
    animation: zoomInCentered 0.25s ease-out;
    display: none; /* Masqué par défaut */
}

@keyframes zoomInCentered {
    from {
        transform: translateX(-50%) scale(0.92);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

#lock-modal h2 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
}

#lock-modal .lock-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

#lock-modal p {
    color: #666;
    margin: 15px 0;
    font-size: 14px;
}

/* Champ mot de passe */
#lock-password-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin: 15px 0;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

#lock-password-input:focus {
    outline: none;
    border-color: #0056b3;
    background: #f8f9fa;
}

/* Message d'erreur */
#lock-error-message {
    color: #dc3545;
    font-size: 13px;
    margin: 10px 0;
    min-height: 20px;
    display: none;
}

#lock-error-message.visible {
    display: block;
}

/* Compteur d'essais */
#lock-attempts-info {
    color: #ff9800;
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
}

/* Boutons */
.lock-modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#lock-unlock-btn,
#lock-logout-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#lock-unlock-btn {
    background: #0056b3;
    color: white;
}

#lock-unlock-btn:hover {
    background: #004085;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 86, 179, 0.3);
}

#lock-unlock-btn:active {
    transform: translateY(0);
}

#lock-unlock-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#lock-logout-btn {
    background: #6c757d;
    color: white;
}

#lock-logout-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

#lock-logout-btn:active {
    transform: translateY(0);
}

/* État pendant la vérification */
.lock-verifying {
    opacity: 0.6;
    cursor: wait;
}

/* Tous les éléments verrouillés */
body.ui-locked {
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
}

body.ui-locked * {
    pointer-events: none !important;
    user-select: none;
}

body.ui-locked #lock-overlay,
body.ui-locked #lock-overlay * {
    pointer-events: all !important;
}

body.ui-locked #session-timeout-warning,
body.ui-locked #session-timeout-warning * {
    pointer-events: all !important;
    user-select: auto;
}

/* Indication visuelle du verrouillage */
.ui-locked-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: 20px;
    z-index: -1;
    opacity: 0;
    pointer-events: none;
}
