/* ===================================
   CSS Dédié - Page Réveil
   HeureExacte.fr
   =================================== */

/* Variables spécifiques réveil */
:root {
    --alarm-primary: #4a69bd;
    --alarm-secondary: #5f7ccc;
    --alarm-danger: #e74c3c;
    --alarm-success: #27ae60;
    --alarm-warning: #f39c12;
    --alarm-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --quiz-overlay: rgba(0, 0, 0, 0.85);
}

/* Container principal */
.alarm-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .alarm-container {
        grid-template-columns: 2fr 1fr;
        padding: 0 2rem;
    }
}

/* Cards communes */
.card {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(74, 105, 189, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Titre de section */
.section-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Time Picker */
.time-picker {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.time-input {
    width: 100px;
    height: 80px;
    font-size: 3rem;
    text-align: center;
    border: 3px solid var(--alarm-primary);
    border-radius: 16px;
    background: white;
    font-weight: 700;
    font-family: 'Courier New', Courier, monospace;
    transition: all 0.3s ease;
}

.time-input:focus {
    outline: none;
    border-color: var(--alarm-secondary);
    box-shadow: 0 0 0 4px rgba(74, 105, 189, 0.15);
    transform: scale(1.05);
}

.time-separator {
    font-size: 3rem;
    font-weight: 700;
    color: var(--alarm-primary);
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Options d'alarme */
.alarm-options {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.option-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.option-input:focus {
    outline: none;
    border-color: var(--alarm-primary);
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.1);
}

/* Sélecteur de type de quiz */
.quiz-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.quiz-type-btn {
    padding: 0.75rem 1rem;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    background: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.quiz-type-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

.quiz-type-btn.active {
    background: var(--alarm-primary);
    color: white;
    border-color: var(--alarm-primary);
}

/* Sélecteur de difficulté */
.difficulty-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 480px) {
    .difficulty-selector {
        grid-template-columns: repeat(4, 1fr);
    }
}

.difficulty-btn {
    padding: 0.75rem 1rem;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    background: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.difficulty-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background: var(--alarm-primary);
    color: white;
    border-color: var(--alarm-primary);
    transform: scale(1.05);
}

.difficulty-btn[data-difficulty="evil"] {
    position: relative;
    overflow: hidden;
}

.difficulty-btn[data-difficulty="evil"].active {
    background: var(--alarm-danger);
    border-color: var(--alarm-danger);
    animation: evilPulse 2s infinite;
}

@keyframes evilPulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Bouton principal */
.set-alarm-btn {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--alarm-primary);
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.set-alarm-btn:hover {
    background: var(--alarm-secondary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 105, 189, 0.3);
}

.set-alarm-btn.success {
    background: var(--alarm-success);
    animation: successPulse 0.6s ease;
}

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

/* Liste des alarmes */
.alarms-list {
    max-height: 600px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.alarm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.alarm-item:hover {
    border-color: var(--alarm-primary);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.alarm-time {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Courier New', Courier, monospace;
}

.alarm-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.alarm-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Toggle Switch */
.toggle-switch {
    width: 50px;
    height: 26px;
    background: #cbd5e0;
    border-radius: 26px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: var(--alarm-success);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(24px);
}

.delete-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    padding: 0.5rem;
}

.delete-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Section de test */
.test-section {
    margin: 2rem auto;
    max-width: 800px;
}

.test-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.test-btn {
    padding: 0.75rem 1.25rem;
    background: white;
    border: 2px solid var(--alarm-primary);
    border-radius: 12px;
    color: var(--alarm-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.test-btn:hover {
    background: var(--alarm-primary);
    color: white;
    transform: translateY(-2px);
}

/* Modal Quiz */
.quiz-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--quiz-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.quiz-modal.active {
    opacity: 1;
    visibility: visible;
}

.quiz-container {
    background: white;
    padding: 3rem;
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.quiz-modal.active .quiz-container {
    transform: scale(1);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.quiz-title {
    font-size: 2rem;
    color: var(--alarm-danger);
    margin-bottom: 1rem;
    animation: alarmFlash 1s infinite;
}

@keyframes alarmFlash {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.7; }
}

.quiz-question {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2rem 0;
    font-family: 'SF Mono', monospace;
}

.quiz-input {
    width: 200px;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    margin: 0 auto 1.5rem;
    border: 3px solid var(--alarm-primary);
    border-radius: 12px;
}

.quiz-submit {
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--alarm-success);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.3);
}

.quiz-error {
    color: var(--alarm-danger);
    font-weight: 600;
    margin-top: 1rem;
    min-height: 1.5rem;
}

/* Section SEO */
.seo-section {
    max-width: 900px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 1.75rem;
    border-radius: 16px;
    border-left: 4px solid var(--alarm-primary);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.feature-card h4 {
    color: var(--alarm-primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Optimisations mobile */
@media (max-width: 768px) {
    .time-input {
        width: 80px;
        height: 60px;
        font-size: 2rem;
    }
    
    .time-separator {
        font-size: 2rem;
    }
    
    .quiz-container {
        padding: 2rem;
    }
    
    .quiz-question {
        font-size: 2rem;
    }
    
    .alarm-container {
        gap: 1.5rem;
    }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    .card {
        background: #1a202c;
        border-color: rgba(74, 105, 189, 0.3);
    }
    
    .time-input,
    .option-input,
    .difficulty-btn,
    .quiz-type-btn {
        background: #2d3748;
        color: white;
        border-color: #4a5568;
    }
    
    .quiz-type-btn:hover,
    .difficulty-btn:hover {
        background: #374151;
    }
    
    .quiz-type-btn.active,
    .difficulty-btn.active {
        background: var(--alarm-primary);
        color: white;
        border-color: var(--alarm-primary);
    }
    
    .alarm-item {
        background: #2d3748;
    }
    
    .quiz-container {
        background: #2d3748;
        color: white;
    }
    
    .feature-card {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    }
}

/* Animations au chargement */
.alarm-setup {
    animation: slideInLeft 0.6s ease-out;
}

.alarms-list {
    animation: slideInRight 0.6s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Performance */
.card,
.alarm-item,
.difficulty-btn,
.toggle-switch {
    will-change: transform;
}

/* Accessibilité */
.difficulty-btn:focus,
.test-btn:focus,
.toggle-switch:focus {
    outline: 3px solid var(--alarm-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .alarm-container,
    .test-section,
    .quiz-modal {
        display: none;
    }
    
    .seo-section {
        max-width: 100%;
    }
}