/* --- Countdown Creation Form --- */
.countdown-form {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.countdown-form input {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--card);
    color: var(--fg);
    border: 1px solid var(--border);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
}

.countdown-form input[type="text"] {
    flex-grow: 1;
}

.countdown-form button {
    flex-shrink: 0;
}

/* --- Preset Links --- */
.preset-links {
    margin-top: 40px;
    color: var(--muted);
}
.preset-links h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--fg);
}
.preset-links a {
    color: var(--muted);
    text-decoration: none;
    margin-right: 20px;
    line-height: 1.8;
}
.preset-links a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* --- Countdown Display --- */
.countdown-display {
    text-align: center;
    margin-top: 60px;
}

.countdown-display h2 {
    font-size: clamp(24px, 5vw, 42px);
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 30px;
}

.timer-grid {
    display: flex;
    justify-content: center;
    gap: clamp(20px, 6vw, 60px);
}

.timer-unit {
    display: flex;
    flex-direction: column;
    position: relative;
}

.timer-number {
    font-family: 'Time Traveler', sans-serif;
    font-weight: 800;
    font-size: clamp(48px, 15vw, 120px);
    line-height: 1;
    color: var(--fg);
    font-variant-numeric: tabular-nums;
}

.timer-label {
    font-size: clamp(14px, 3vw, 18px);
    color: var(--muted);
    margin-top: 10px;
    text-transform: lowercase;
}

/* Vertical separator line */
.timer-unit:not(:last-child)::after {
    content: '';
    position: absolute;
    right: calc(clamp(20px, 6vw, 60px) / -2);
    top: 15%;
    bottom: 30%;
    width: 1px;
    background-color: #f9fafb;
}

.finished-message {
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: clamp(48px, 15vw, 120px);
    color: var(--accent);
    margin-top: 30px;
    letter-spacing: -0.05em;
}

.hidden {
    display: none !important;
}


/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .countdown-form {
        flex-direction: column;
    }
}

/* --- Timer Controls --- */
.timer-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

/* Base style for the new timer buttons */
.timer-btn {
    background-color: var(--card);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 999px; /* This creates the pill shape */
    padding: 8px 20px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Hover state for the buttons */
.timer-btn:hover {
    background-color: var(--chip);
    border-color: var(--muted);
}

/* Active state for the 'Sound: On' button */
.timer-btn.active {
    background-color: var(--accent-color); /* Red color */
    color: #fff; /* White text */
    border-color: var(--accent-color);
}

.timer-controls .ghost-btn.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
}

/* --- Saved Countdowns Section --- */
.saved-countdowns {
    margin-top: 60px;
}

.saved-countdowns h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 18px;
    color: var(--fg);
}

#savedCountdownsList {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 20px;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.saved-item-info .event-name {
    font-weight: 700;
    font-size: 17px;
    color: var(--fg);
}

.saved-item-info .time-remaining {
    font-size: 14px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.saved-item-actions {
    display: flex;
    gap: 10px;
}

.saved-item-actions .timer-btn {
    padding: 6px 15px; /* Smaller padding for these buttons */
}

/* Red hover state specifically for the delete button */
.saved-item-actions .delete-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff; /* Makes the text white for better contrast */
}

/* --- Dedicated styles for Date and Time inputs --- */
.countdown-form input[type="date"],
.countdown-form input[type="time"] {
    /* Visual styles to match other inputs */
    background: var(--card);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    padding: 12px 14px;

    /* Crucial fix: Ensures the inputs have a visible height on mobile */
    min-height: 49px; 
}

.countdown-form input[type="date"]:focus { outline: none; border-color: var(--accent-color); }
.countdown-form input[type="time"]:focus { outline: none; border-color: var(--accent-color); }


/* --- Mobile Styles for Countdown Page --- */
@media (max-width: 600px) {
    /* Allow control buttons to wrap onto multiple lines */
    .timer-controls {
        flex-wrap: wrap;
        gap: 12px;
    }

    /* Stack the saved countdown items vertically */
    .saved-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
        /* Reduce the space between the numbers */
    .timer-grid {
        gap: 25px;
    }
    
        /* Make the numbers themselves a bit smaller */
    .timer-number {
        font-size: clamp(40px, 12vw, 72px);
    }

    .saved-item-info {
        /* Make sure info takes full width */
        width: 100%; 
    }
    
        /* Re-center the vertical separator line for the new, smaller gap */
    .timer-unit:not(:last-child)::after {
        right: -12.5px; /* This is half of the new 25px gap */
    }

    .saved-item-actions {
        /* Make buttons take full width for easier tapping */
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}