/* Rest Timer Modal Styles */
.rest-timer-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999; /* Very high z-index to ensure it's above everything */
    animation: fadeIn 0.3s ease-out;
}

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

.rest-timer-content {
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    position: relative;
    z-index: 100000;
}

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

.rest-timer-content h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: #1a202c;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.rest-timer-content .rest-subtitle {
    font-size: 0.95rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.rest-timer-display {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem;
}

.rest-progress-ring {
    transform: rotate(-90deg);
    filter: drop-shadow(0 4px 12px rgba(93, 95, 239, 0.15));
}

.rest-ring-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 12;
}

.rest-ring-animate {
    fill: none;
    stroke: var(--primary-color, #5D5FEF);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.rest-time-remaining {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-color, #5D5FEF);
    letter-spacing: -0.05em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Ensure consistent width to prevent shifting */
    min-width: 120px;
    text-align: center;
    /* Prevent layout shift during animations */
    will-change: transform;
    transform-origin: center center;
}

.rest-timer-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.rest-timer-controls .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.rest-timer-controls .btn-sm {
    background: #f3f4f6;
    color: #4b5563;
    border: none;
}

.rest-timer-controls .btn-sm:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.rest-timer-controls .btn-primary {
    background: var(--primary-color, #5D5FEF);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
}

.rest-timer-controls .btn-primary:hover {
    background: #4f51d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 95, 239, 0.3);
}

/* Color transitions based on time remaining */
.rest-timer-modal.warning .rest-ring-animate {
    stroke: #f59e0b;
    transition: stroke 0.5s ease;
}

.rest-timer-modal.warning .rest-time-remaining {
    color: #f59e0b;
    transition: color 0.5s ease;
}

.rest-timer-modal.urgent .rest-ring-animate {
    stroke: #ef4444;
    transition: stroke 0.5s ease;
}

.rest-timer-modal.urgent .rest-time-remaining {
    color: #ef4444;
    transition: color 0.5s ease;
    animation: urgentPulse 1s ease-in-out infinite;
}

/* Create a wrapper for the timer to handle centering */
.rest-timer-modal.urgent .rest-time-remaining::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(239, 68, 68, 0.2) 0%, transparent 70%);
    animation: urgentGlow 1s ease-in-out infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes urgentPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.02);
    }
}

@keyframes urgentGlow {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .rest-timer-content {
        padding: 2rem;
        width: 95%;
    }
    
    .rest-timer-content h3 {
        font-size: 1.5rem;
    }
    
    .rest-timer-display {
        width: 180px;
        height: 180px;
    }
    
    .rest-time-remaining {
        font-size: 3rem;
        min-width: 100px;
    }
    
    .rest-timer-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .rest-timer-controls .btn {
        width: 100%;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .rest-timer-content {
        background: #1a202c;
        color: white;
    }
    
    .rest-timer-content h3 {
        color: white;
    }
    
    .rest-ring-bg {
        stroke: #2d3748;
    }
    
    .rest-timer-controls .btn-sm {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .rest-timer-controls .btn-sm:hover {
        background: #4a5568;
    }
}