/* Base Layout & Theme */
.clk-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--taskbar-bg);
    font-family: var(--system-font);
    color: var(--start-menu-text);
}

/* Tabs */
.clk-tabs {
    display: flex;
    background: linear-gradient(to right, var(--bg-light), var(--bg-mid));
    border-bottom: 1px solid var(--border-light);
    padding: 2px;
    gap: 4px;
}

.clk-tab-button {
    padding: 4px 12px;
    margin-right: 2px;
    background-color: var(--bg-light);
    border: 1px solid var(--purple-dark);
    border-bottom: none;
    cursor: pointer;
    color: var(--start-menu-text);
    font-size: 12px;
    transition: all 0.2s ease;
}

.clk-tab-button:hover {
    background-color: var(--bg-lightest);
    transform: translateY(-1px);
}

.clk-tab-button.active {
    background-color: var(--bg-lightest);
    position: relative;
    z-index: 1;
    margin-bottom: -1px;
    border-bottom: 1px solid var(--bg-lightest);
}

/* Content Area */
.clk-content {
    flex: 1;
    padding: 15px;
    background-color: var(--bg-lightest);
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.clk-tab-pane {
    display: none;
    flex: 1;
    background-color: var(--bg-lightest);
    padding: 10px;
}

.clk-tab-pane.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

/* Clock Display */
.clk-time-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.clk-digital-clock {
    font-size: 72px;
    font-weight: bold;
    color: var(--start-menu-text);
    text-align: center;
    padding: 20px;
    background-color: var(--bg-explorer-window);  
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-family: "Courier New", monospace;
    box-shadow: 0 4px 8px var(--shadow-light);
    transition: all 0.3s ease;
}

.clk-digital-clock:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 12px var(--shadow-medium);
}

.clk-date-display {
    font-size: 24px;
    color: var(--start-menu-text);
    text-align: center;
    padding: 10px;
    background-color: var(--bg-explorer-window);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* Timer Styles */
.clk-timer-container {
    background-color: var(--bg-explorer-window);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 6px var(--shadow-light);
    transition: all 0.3s ease;
}

.clk-timer-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
}

.clk-progress-ring {
    transform: rotate(-90deg);
    transition: all 0.3s ease;
}

.clk-progress-ring-bg {
    fill: none;
    stroke: var(--bg-light);
    stroke-width: 8;
}

.clk-progress-ring-circle {
    fill: none;
    stroke: var(--accent-text);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s ease;
}

.clk-timer-display {
    font-size: 36px;
    font-family: "Courier New", monospace;
    color: var(--start-menu-text);
    text-align: center;
    margin: 10px 0;
    font-weight: bold;
}

/* Timer Animation States */
.clk-timer-ending {
    animation: pulse 0.5s ease-in-out infinite alternate;
}

.clk-timer-complete {
    animation: celebrate 0.5s ease-in-out;
}

.clk-timer-complete-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--parple-dark);
    color: var(--accent-text);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 24px;
    animation: popIn 0.3s ease-out;
}

/* Stopwatch Styles */
.clk-stopwatch {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.clk-stopwatch-display {
    font-size: 64px;
    font-weight: bold;
    color: var(--start-menu-text);
    text-align: center;
    padding: 20px;
    background-color: var(--bg-explorer-window);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-family: "Courier New", monospace;
    min-width: 300px;
    box-shadow: 0 4px 8px var(--shadow-light);
    transition: all 0.3s ease;
}

.clk-stopwatch-controls button {
    padding: 10px 20px;
    font-size: 16px;
    background-color: var(--bg-mid);
    border: 2px solid var(--border-light);
    border-radius: 4px;
    color: var(--start-menu-text);
    cursor: pointer;
    min-width: 80px;
    transition: all 0.2s ease;
}

.clk-stopwatch-controls button:hover:not(:disabled) {
    background-color: var(--purple-dark);
    color: var(--accent-text);
    transform: translateY(-2px);
}

.clk-stopwatch-controls button.active {
    background-color: var(--purple-dark);
    color: var(--start-menu-text);
    animation: buttonPulse 2s infinite;
}

/* Lap Times */
.clk-lap-times {
    width: 100%;
    max-width: 400px;
    background-color: var(--bg-explorer-window);
    border-radius: 8px;
    padding: 10px;
    margin-top: 20px;
}

.clk-lap-time {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid var(--bg-light);
    font-family: "Courier New", monospace;
    animation: slideIn 0.3s ease-out;
}

/* Alarm Styles */
.clk-alarm-container {
    background-color: var(--bg-explorer-window);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.clk-alarm-container.clk-alarm-triggered {
    animation: shake 0.5s ease-in-out;
    background-color: var(--purple-dark);
    color: var(--text-light);
}

.clk-alarm-message {
    width: 150px;
}

.clk-alarm-message-display {
    font-style: italic;
    color: var(--accent-text);
    margin-left: 10px;
}

.clk-alarm-triggered-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--purple-dark);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 24px;
    animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    white-space: nowrap;
    box-shadow: 0 4px 12px var(--shadow-medium);
}

@keyframes bounceIn {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    70% {
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

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

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.02); }
}

@keyframes celebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

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

@keyframes buttonPulse {
    0% { box-shadow: 0 0 0 0 rgba(68, 29, 87, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(68, 29, 87, 0); }
    100% { box-shadow: 0 0 0 0 rgba(68, 29, 87, 0); }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Input Styles */
.clk-app input {
    padding: 8px;
    border: 2px solid var(--border-light);
    background-color: var(--bg-lightest);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.clk-app input:focus {
    border-color: var(--purple-dark);
    outline: none;
    box-shadow: 0 0 0 2px var(--purple-medium-alpha);
}

/* Button Styles */
.clk-app button:not(.clk-tab-button) {
    padding: 8px 16px;
    background-color: var(--bg-mid);
    border: 2px solid var(--border-light);
    border-radius: 4px;
    color: var(--start-menu-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.clk-app button:not(.clk-tab-button):hover:not(:disabled) {
    background-color: var(--purple-dark);
    color: var(--accent-text);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px var(--shadow-light);
}

.clk-app button:not(.clk-tab-button):active:not(:disabled) {
    transform: translateY(0);
}

/* Presets Section */
.clk-timer-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.clk-preset-btn {
    font-size: 14px;
    height: 40px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Adjustments */
@media (max-width: 500px) {
    .clk-digital-clock {
        font-size: 48px;
    }
    
    .clk-stopwatch-display {
        font-size: 40px;
    }
    
    .clk-timer-presets {
        grid-template-columns: 1fr;
    }
}