/* Variables CSS */
:root {
    --primary-color: #6d5acd;
    --primary-dark: #5a48b0;
    --secondary-color: #4e545a;
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #e0e0e0;
    --text-secondary: #aaaaaa;
    --success-color: #2ecc71;
    --success-dark: #27ae60;
    --timer-color: #1a8045;  /* Nouvelle couleur verte plus foncée pour les boutons timer */
    --danger-color: #e74c3c;
    --danger-dark: #c0392b;
    --warning-color: #f39c12;
    --warning-dark: #e67e22;
    --transition: all 0.25s ease;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    --border-radius: 8px;
}

/* Styles Généraux */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    /* Suppression de align-items: center pour ne pas centrer verticalement */
    padding: 15px;
    padding-top: 50px; /* Ajout d'un padding top pour descendre le contenu */
}

.container {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

h1 {
    color: var(--text-color);
    margin-bottom: 25px;
    font-weight: 600;
    font-size: 24px;
}

/* Section de Login */
.login-section {
    transition: var(--transition);
}

.password-input {
    display: block;
    width: 100%;
    padding: 14px 15px;
    margin-bottom: 20px;
    border: 1px solid #333;
    border-radius: var(--border-radius);
    font-size: 16px;
    outline: none;
    transition: var(--transition);
    background-color: #252525;
    color: var(--text-color);
}

.password-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(109, 90, 205, 0.3);
}

.password-input::placeholder {
    color: var(--text-secondary);
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 14px 25px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
    margin: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Effet de survol pour desktop */
@media (hover: hover) {
    .btn:hover {
        background-color: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: var(--shadow);
    }

    .btn-open:hover {
        background-color: var(--success-dark);
        transform: scale(1.05);
    }

    .btn-time:hover {
        background-color: var(--timer-color);
        transform: scale(1.05);
    }

    .btn-logout:hover {
        background-color: var(--danger-dark);
    }

    .btn-cancel:hover {
        background-color: var(--danger-dark);
    }
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus {
    outline: none;
}

.btn-submit {
    width: 100%;
    margin-bottom: 10px;
}

/* Bouton OUVRIR circulaire - Centrage amélioré */
.btn-open {
    background-color: var(--success-color);
    font-size: 20px;
    font-weight: 700;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 30px auto 40px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    left: 0; /* Assure qu'il n'y a pas de décalage */
    right: 0; /* Assure qu'il n'y a pas de décalage */
}

.btn-open:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.5s ease;
}

.btn-open:active:after {
    width: 200px;
    height: 200px;
    opacity: 0;
}

/* Boutons de timer modifiés pour être circulaires */
.btn-time {
    background-color: var(--timer-color);
    font-size: 15px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 10px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.btn-time:active {
    transform: scale(0.95);
    background-color: var(--success-dark);
}

.btn-time.active {
    background-color: var(--success-color);
    transform: scale(1.05);
}

.btn-logout {
    background-color: var(--danger-color);
    margin-top: 25px;
}

/* Organisation des boutons de timer en grille 2x2 */
.time-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    justify-items: center;
    margin: 20px auto;
    width: 100%;
    max-width: 240px;
}

/* Bouton Annuler */
.btn-cancel {
    background-color: var(--danger-color);
    font-size: 14px;
    padding: 10px 15px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-cancel:active {
    transform: scale(0.95);
}

/* Animation de chargement */
@keyframes loading {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.loading {
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

/* Section Principale */
.main-section {
    display: none;
    opacity: 0;
    transition: var(--transition);
}

.main-section.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    min-height: 400px;
    width: 100%;
}

/* Compte à rebours */
.countdown {
    font-size: 24px;
    font-weight: 700;
    color: var(--success-color);
    margin: 15px 0;
    padding: 10px;
    border-radius: var(--border-radius);
    background-color: rgba(46, 204, 113, 0.1);
    display: inline-block;
    min-width: 120px;
    transition: all 0.3s ease;
}

.countdown.warning {
    color: var(--warning-color);
    background-color: rgba(243, 156, 18, 0.1);
}

.countdown.danger {
    color: var(--danger-color);
    background-color: rgba(231, 76, 60, 0.1);
}

.hidden {
    display: none !important;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fadeIn {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 1.5s infinite ease-in-out;
}

/* Media Queries pour Mobile */
@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
        min-height: 420px;
    }

    .time-options {
        gap: 10px;
    }

    .btn-time {
        width: 70px;
        height: 70px;
        font-size: 14px;
    }

    .btn-open {
        width: 130px;
        height: 130px;
        font-size: 18px;
    }
}

/* Desktop spécifique */
@media (min-width: 769px) {
    .container {
        padding: 40px;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .container:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    }

    .btn {
        margin: 8px;
    }

    .time-options {
        margin: 20px auto;
    }
}

/* Mode Timer */
.timer-mode .btn-open,
.timer-mode .time-options,
.timer-mode #logoutBtn {
    display: none;
}
