/* ===========================================
   Timers des étapes - Page recette front-end
   Timer intégré dans l'étape (pas de popup)
   =========================================== */

/* Container du timer sous chaque étape */
.etape-timers-container {
    margin-top: 15px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
}

/* ============================================
   Bouton Timer - État initial (non actif)
   ============================================ */
.btn-timer-etape {
    background: linear-gradient(135deg, #4286f4, #2563eb);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 3px 12px rgba(66, 134, 244, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-timer-etape:hover {
    background: linear-gradient(135deg, #5a9cf4, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(66, 134, 244, 0.5);
}

.btn-timer-etape:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(66, 134, 244, 0.4);
}

/* Icône Play à gauche */
.btn-timer-etape .timer-icon-play {
    font-size: 0.85rem;
    color: #fff;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

/* Texte du temps */
.btn-timer-etape .timer-text {
    font-weight: 500;
    letter-spacing: 0.3px;
    min-width: 50px;
    text-align: center;
    line-height: 1;
}

/* Icône Horloge à droite */
.btn-timer-etape .timer-icon-clock {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

/* ============================================
   Bouton Timer - État actif (en cours)
   ============================================ */
.btn-timer-etape.timer-active {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    animation: pulse-timer 2s infinite;
    cursor: default;
}

.btn-timer-etape.timer-active:hover {
    transform: none;
}

.btn-timer-etape.timer-active .timer-icon-play {
    display: none;
}

.btn-timer-etape.timer-active .timer-icon-clock {
    color: #fff;
    animation: pulse-clock 1.5s ease-in-out infinite;
}

@keyframes pulse-timer {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.5); }
    70% { box-shadow: 0 0 0 12px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

@keyframes pulse-clock {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

/* ============================================
   Bouton Timer - État en pause
   ============================================ */
.btn-timer-etape.timer-paused {
    background: linear-gradient(135deg, #ffc107, #e6ac00);
    animation: none;
    cursor: default;
}

.btn-timer-etape.timer-paused:hover {
    transform: none;
}

.btn-timer-etape.timer-paused .timer-icon-play {
    display: none;
}

.btn-timer-etape.timer-paused .timer-icon-clock {
    color: #000;
    animation: blink-pause 1s infinite;
}

@keyframes blink-pause {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================
   Contrôles inline (dans l'étape)
   ============================================ */
.timer-inline-controls {
    display: none;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.timer-inline-controls.visible {
    display: flex;
}

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

.timer-inline-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 25px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    line-height: 1;
    min-width: 100px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.timer-inline-btn i {
    font-size: 0.85rem;
}

.timer-inline-btn.pause {
    background: linear-gradient(135deg, #ffc107, #e6ac00);
    color: #000;
}

.timer-inline-btn.pause:hover {
    background: linear-gradient(135deg, #e6ac00, #cc9900);
    transform: scale(1.05);
}

.timer-inline-btn.resume {
    background: linear-gradient(135deg, #28a745, #22943d);
    color: white;
}

.timer-inline-btn.resume:hover {
    background: linear-gradient(135deg, #22943d, #1e8035);
    transform: scale(1.05);
}

.timer-inline-btn.stop {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.timer-inline-btn.stop:hover {
    background: linear-gradient(135deg, #c82333, #b21f2d);
    transform: scale(1.05);
}

/* ============================================
   Popup flottant (uniquement hors page)
   ============================================ */
.timer-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: linear-gradient(145deg, #2d2d2d, #252525);
    color: white;
    padding: 20px 25px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 9998;
    min-width: 280px;
    max-width: 350px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideIn 0.3s ease-out;
}

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

.timer-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.timer-popup-title {
    font-weight: 600;
    font-size: 1rem;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-popup-title i {
    color: #4286f4;
}

.timer-popup-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.timer-popup-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.timer-popup-time {
    font-size: 48px;
    font-weight: 700;
    text-align: center;
    margin: 15px 0;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.timer-popup-time.warning {
    color: #ffc107;
    animation: blink 1s infinite;
}

.timer-popup-time.finished {
    color: #28a745;
}

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

/* Contrôles du popup */
.timer-popup-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.timer-popup-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timer-popup-btn.pause {
    background: linear-gradient(135deg, #ffc107, #e6ac00);
    color: #000;
}

.timer-popup-btn.pause:hover {
    background: linear-gradient(135deg, #e6ac00, #cc9900);
    transform: translateY(-1px);
}

.timer-popup-btn.stop {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.timer-popup-btn.stop:hover {
    background: linear-gradient(135deg, #c82333, #b21f2d);
    transform: translateY(-1px);
}

.timer-popup-btn.resume {
    background: linear-gradient(135deg, #28a745, #22943d);
    color: white;
}

.timer-popup-btn.resume:hover {
    background: linear-gradient(135deg, #22943d, #1e8035);
    transform: translateY(-1px);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .timer-popup {
        bottom: 80px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .timer-popup-time {
        font-size: 40px;
    }
    
    .etape-timers-container {
        flex-wrap: nowrap;
        gap: 6px;
    }
    
    .btn-timer-etape {
        padding: 8px 12px;
        font-size: 0.8rem;
        gap: 6px;
        height: 36px;
        box-sizing: border-box;
    }
    
    .btn-timer-etape .timer-text {
        min-width: 45px;
    }
    
    .timer-inline-controls {
        gap: 6px;
    }
    
    .timer-inline-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        gap: 6px;
        min-width: 80px;
        height: 36px;
        box-sizing: border-box;
    }
    
    .timer-inline-btn i {
        font-size: 0.75rem;
    }
    
    .timer-popup-minimized {
        bottom: 80px;
        right: 10px;
    }
}

/* ============================================
   Popup global (sur autres pages)
   ============================================ */
.timer-popup-global {
    z-index: 9998;
}

.timer-popup-etape {
    font-size: 0.85rem;
    color: #aaa;
    text-align: center;
    margin-bottom: 10px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

/* Lien vers la recette - style amélioré */
.timer-popup-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(66, 134, 244, 0.15), rgba(37, 99, 235, 0.1));
    border: 1px solid rgba(66, 134, 244, 0.3);
    border-radius: 10px;
    color: #4286f4;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.timer-popup-link:hover {
    background: linear-gradient(135deg, rgba(66, 134, 244, 0.25), rgba(37, 99, 235, 0.2));
    border-color: rgba(66, 134, 244, 0.5);
    color: #5a9cf4;
    transform: translateY(-1px);
}

.timer-popup-link i {
    font-size: 0.85rem;
}

/* ============================================
   Popup minimisé
   ============================================ */
.timer-popup-minimized {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: linear-gradient(145deg, #2d2d2d, #252525);
    color: white;
    padding: 12px 18px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 9998;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease-out;
}

.timer-popup-minimized:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5);
}

.timer-popup-minimized i {
    color: #4286f4;
    font-size: 1.1rem;
}

.timer-popup-minimized .timer-mini-time {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ============================================
   Mode clair - Adaptation du popup
   ============================================ */
body.light-mode .timer-popup,
.light-mode .timer-popup {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

body.light-mode .timer-popup-header,
.light-mode .timer-popup-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .timer-popup-title,
.light-mode .timer-popup-title {
    color: #333;
}

body.light-mode .timer-popup-close,
.light-mode .timer-popup-close {
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

body.light-mode .timer-popup-close:hover,
.light-mode .timer-popup-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

body.light-mode .timer-popup-time,
.light-mode .timer-popup-time {
    color: #333;
    text-shadow: none;
}

body.light-mode .timer-popup-etape,
.light-mode .timer-popup-etape {
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

body.light-mode .timer-popup-link,
.light-mode .timer-popup-link {
    background: linear-gradient(135deg, rgba(66, 134, 244, 0.1), rgba(37, 99, 235, 0.05));
    border: 1px solid rgba(66, 134, 244, 0.2);
}

body.light-mode .timer-popup-link:hover,
.light-mode .timer-popup-link:hover {
    background: linear-gradient(135deg, rgba(66, 134, 244, 0.15), rgba(37, 99, 235, 0.1));
    border-color: rgba(66, 134, 244, 0.4);
}

body.light-mode .timer-popup-minimized,
.light-mode .timer-popup-minimized {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

body.light-mode .timer-popup-minimized:hover,
.light-mode .timer-popup-minimized:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

body.light-mode .timer-popup-minimized .timer-mini-time,
.light-mode .timer-popup-minimized .timer-mini-time {
    color: #333;
}
