/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.5s ease-in-out;
    background-color: #2c3e50;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Timer Display */
#timer-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 2rem;
}

.clock {
    font-size: 8rem;
    font-weight: 300;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    letter-spacing: 0.1em;
}

.status {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.current-interval {
    font-size: 3rem;
    font-weight: 300;
    opacity: 0.9;
    max-width: 80%;
    line-height: 1.4;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    letter-spacing: 0.05em;
}

/* Audio Enable Button */
.audio-enable-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.audio-enable-container.hidden {
    opacity: 0;
    visibility: hidden;
}

.enable-audio-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 1.5rem 3rem;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulse 2s infinite;
}

.enable-audio-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(231, 76, 60, 0.6);
    background: linear-gradient(135deg, #c0392b, #a93226);
}

.enable-audio-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

@keyframes pulse {
    0% {
        box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
    }
    50% {
        box-shadow: 0 8px 25px rgba(231, 76, 60, 0.8);
    }
    100% {
        box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
    }
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
}

.settings-panel.hidden {
    transform: translateX(100%);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.settings-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #e74c3c;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Range Inputs */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Settings Toggle */
.settings-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.settings-toggle:hover {
    background: white;
    transform: scale(1.1);
}

/* Intervals List */
.intervals-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.interval-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
}

.interval-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.interval-minute {
    font-weight: bold;
    color: #2c3e50;
}

.interval-actions {
    display: flex;
    gap: 0.5rem;
}

.interval-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-edit {
    background: #f39c12;
    color: white;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.interval-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.interval-details input,
.interval-details textarea {
    font-size: 0.9rem;
    padding: 0.5rem;
}

.interval-details textarea {
    grid-column: 1 / -1;
    resize: vertical;
    min-height: 60px;
}

/* Color picker styling */
input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Responsive Design */
@media (max-width: 768px) {
    .clock {
        font-size: 4rem;
    }
    
    .status {
        font-size: 1.5rem;
    }
    
    .settings-panel {
        width: 100%;
        right: 0;
    }
    
    .checkbox-group {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Animation for color transitions */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Hidden class utility */
.hidden {
    display: none !important;
}

/* Screen flickering effect with lights - STRONGER VERSION */
@keyframes screenFlicker {
    0% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    3% { 
        opacity: 0.3; 
        filter: brightness(3) contrast(2) saturate(2);
    }
    6% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    9% { 
        opacity: 0.2; 
        filter: brightness(4) contrast(2.5) saturate(2.5);
    }
    12% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    15% { 
        opacity: 0.4; 
        filter: brightness(2.5) contrast(1.8) saturate(1.8);
    }
    18% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    21% { 
        opacity: 0.1; 
        filter: brightness(5) contrast(3) saturate(3);
    }
    24% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    27% { 
        opacity: 0.5; 
        filter: brightness(2) contrast(1.5) saturate(1.5);
    }
    30% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    33% { 
        opacity: 0.2; 
        filter: brightness(4.5) contrast(2.8) saturate(2.8);
    }
    36% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    39% { 
        opacity: 0.3; 
        filter: brightness(3.5) contrast(2.2) saturate(2.2);
    }
    42% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    45% { 
        opacity: 0.1; 
        filter: brightness(6) contrast(3.5) saturate(3.5);
    }
    48% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    51% { 
        opacity: 0.4; 
        filter: brightness(2.8) contrast(1.9) saturate(1.9);
    }
    54% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    57% { 
        opacity: 0.2; 
        filter: brightness(4.2) contrast(2.6) saturate(2.6);
    }
    60% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    63% { 
        opacity: 0.3; 
        filter: brightness(3.2) contrast(2.1) saturate(2.1);
    }
    66% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    69% { 
        opacity: 0.1; 
        filter: brightness(5.5) contrast(3.2) saturate(3.2);
    }
    72% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    75% { 
        opacity: 0.4; 
        filter: brightness(2.3) contrast(1.6) saturate(1.6);
    }
    78% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    81% { 
        opacity: 0.2; 
        filter: brightness(4.8) contrast(2.9) saturate(2.9);
    }
    84% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    87% { 
        opacity: 0.3; 
        filter: brightness(3.8) contrast(2.4) saturate(2.4);
    }
    90% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    93% { 
        opacity: 0.1; 
        filter: brightness(6.5) contrast(3.8) saturate(3.8);
    }
    96% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
    99% { 
        opacity: 0.2; 
        filter: brightness(4.3) contrast(2.7) saturate(2.7);
    }
    100% { 
        opacity: 1; 
        filter: brightness(1) contrast(1) saturate(1);
    }
}

@keyframes lightFlash {
    0% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    5% { 
        box-shadow: 0 0 200px 100px rgba(255, 255, 255, 0.8);
    }
    10% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    15% { 
        box-shadow: 0 0 300px 150px rgba(255, 255, 255, 0.9);
    }
    20% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    25% { 
        box-shadow: 0 0 250px 120px rgba(255, 255, 255, 0.85);
    }
    30% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    35% { 
        box-shadow: 0 0 400px 200px rgba(255, 255, 255, 0.95);
    }
    40% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    45% { 
        box-shadow: 0 0 350px 175px rgba(255, 255, 255, 0.9);
    }
    50% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    55% { 
        box-shadow: 0 0 500px 250px rgba(255, 255, 255, 1);
    }
    60% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    65% { 
        box-shadow: 0 0 450px 225px rgba(255, 255, 255, 0.95);
    }
    70% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    75% { 
        box-shadow: 0 0 600px 300px rgba(255, 255, 255, 1);
    }
    80% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    85% { 
        box-shadow: 0 0 550px 275px rgba(255, 255, 255, 0.98);
    }
    90% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    95% { 
        box-shadow: 0 0 700px 350px rgba(255, 255, 255, 1);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.flickering {
    animation: screenFlicker 0.2s ease-in-out infinite;
}

.light-flash {
    animation: lightFlash 0.4s ease-in-out infinite;
}

/* Flickering overlay for more dramatic effect */
.flicker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: transparent;
    animation: screenFlicker 0.15s ease-in-out infinite;
}

/* Additional flicker flash effect for 10-flicker sequence */
.flicker-flash {
    animation: flickerFlash 0.3s ease-in-out;
}

@keyframes flickerFlash {
    0% { 
        opacity: 1; 
        filter: brightness(1) contrast(1);
    }
    20% { 
        opacity: 0.1; 
        filter: brightness(5) contrast(3);
    }
    40% { 
        opacity: 1; 
        filter: brightness(1) contrast(1);
    }
    60% { 
        opacity: 0.2; 
        filter: brightness(4) contrast(2.5);
    }
    80% { 
        opacity: 1; 
        filter: brightness(1) contrast(1);
    }
    100% { 
        opacity: 1; 
        filter: brightness(1) contrast(1);
    }
}
