/* Stopwatch specific styles */

/* Stopwatch Display */
.stopwatch-display {
    text-align: center;
    margin-bottom: 1.25rem;
    padding: 1.25rem;
}

.stopwatch-circle {
    width: 300px;
    height: 300px;
    border: 8px solid var(--border-color);
    border-radius: 50%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    position: relative;
    transition: all 0.3s ease;
}

.stopwatch-circle.running {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
    animation: pulse 2s infinite;
}

.stopwatch-circle.stopped {
    border-color: var(--danger-color);
}

.stopwatch-circle.completed {
    border-color: var(--success-color);
}

@keyframes pulse {
    0% { box-shadow: 0 0 20px rgba(37, 99, 235, 0.3); }
    50% { box-shadow: 0 0 30px rgba(37, 99, 235, 0.5); }
    100% { box-shadow: 0 0 20px rgba(37, 99, 235, 0.3); }
}

.stopwatch-time {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stopwatch-status {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Stopwatch Controls */
.stopwatch-controls {
    margin-bottom: 3rem;
    text-align: center;
}

.control-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.control-buttons .btn {
    min-width: 120px;
    padding: 0.875rem 1.25rem;
    font-size: 1.05rem;
    font-weight: 600;
}

/* Lap Times */
.lap-times {
    margin-bottom: 3rem;
}

.lap-times h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.lap-list {
    max-width: 600px;
    margin: 0 auto;
    max-height: 400px;
    overflow-y: auto;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.lap-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.lap-item:last-child {
    border-bottom: none;
}

.lap-item:hover {
    background-color: var(--bg-tertiary);
}

.lap-item.fastest {
    background-color: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success-color);
}

.lap-item.slowest {
    background-color: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger-color);
}

.lap-number {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 60px;
}

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

.lap-difference {
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-width: 80px;
    text-align: right;
}

.lap-difference.positive {
    color: var(--danger-color);
}

.lap-difference.negative {
    color: var(--success-color);
}

/* Quick Actions */
.quick-actions {
    margin-bottom: 3rem;
}

.quick-actions h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.action-btn {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.action-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-btn svg {
    width: 32px;
    height: 32px;
    fill: var(--primary-color);
}

/* Statistics */
.stopwatch-stats {
    margin-bottom: 3rem;
}

.stopwatch-stats h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Empty state */
.lap-list:empty::after {
    content: 'No lap times recorded yet. Start the stopwatch and press Lap to record your first lap time.';
    display: block;
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-style: italic;
}

/* Scrollbar styling for lap list */
.lap-list::-webkit-scrollbar {
    width: 8px;
}

.lap-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.lap-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.lap-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    .stopwatch-display {
        margin-bottom: 0.75rem;
        padding: 0.75rem;
    }
    .stopwatch-circle {
        width: 200px;
        height: 200px;
    }
    
    .stopwatch-time {
        font-size: 2.25rem;
    }
    
    .control-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .control-buttons .btn {
        width: auto;
        min-width: 120px;
        padding: 0.625rem 0.875rem;
        font-size: 0.95rem;
        flex: 1 1 45%;
        max-width: 220px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stopwatch-display {
        margin-bottom: 0.75rem;
        padding: 0.5rem;
    }
    .stopwatch-circle {
        width: 160px;
        height: 160px;
    }
    
    .stopwatch-time {
        font-size: 1.75rem;
    }
    
    .stopwatch-status {
        font-size: 0.95rem;
    }
    
    .control-buttons .btn {
        min-width: 110px;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        flex: 1 1 45%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 2rem;
    }
}

@media (max-width: 360px) {
    .stopwatch-circle {
        width: 140px;
        height: 140px;
    }
    
    .stopwatch-time {
        font-size: 1.5rem;
    }
    
    .stopwatch-status {
        font-size: 0.9rem;
    }
}

/* Animation for lap items */
.lap-item {
    animation: slideInRight 0.3s ease-out;
}

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

/* Focus states for accessibility */
.stopwatch-circle:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
}

.control-buttons .btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .stopwatch-controls,
    .quick-actions,
    .adsense-section {
        display: none;
    }
    
    .stopwatch-circle {
        border: 2px solid var(--text-primary);
        box-shadow: none;
    }
    
    .lap-list {
        max-height: none;
        overflow: visible;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .stopwatch-circle {
        border-width: 12px;
    }
    
    .stopwatch-time {
        text-shadow: none;
    }
    
    .lap-item.fastest,
    .lap-item.slowest {
        border-left-width: 6px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .stopwatch-circle.running {
        animation: none;
    }
    
    .stopwatch-circle,
    .stat-card,
    .action-btn {
        transition: none;
    }
    
    .lap-item {
        animation: none;
    }
}
