/* ========== GENERAL STYLES ========== */

/* Reset default browser spacing and set a base font */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto; /* centers the page horizontally */
}

h1 {
    text-align: center;
    font-size: 2em;
    margin-bottom: 10px;
}

h2 {
    text-align: center;
    font-size: 1.3em;
    color: #aaa;
    margin-bottom: 20px;
}


/* ========== BUTTONS ========== */

.btn {
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: opacity 0.2s; /* smooth hover effect */
}

.btn:hover {
    opacity: 0.85;
}

.btn-add {
    background-color: #4a90d9;
    color: white;
}

.btn-start {
    background-color: #27ae60;
    color: white;
    font-size: 1.2em;
    padding: 12px 30px;
}

.btn-stop {
    background-color: #e74c3c;
    color: white;
    display: block;
    margin: 30px auto;
    font-size: 1.1em;
}

.btn-remove {
    background-color: #555;
    color: #ccc;
    font-size: 0.85em;
    padding: 6px 12px;
}

.btn-save {
    background-color: #2d6a4f;
    color: #ccc;
    font-size: 0.85em;
    padding: 6px 12px;
}

.btn-load {
    background-color: #4a90d9;
    color: white;
    font-size: 0.85em;
    padding: 6px 14px;
}

.btn-delete {
    background-color: transparent;
    color: #888;
    font-size: 0.85em;
    padding: 6px 10px;
}

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

.btn-add-step {
    background-color: transparent;
    color: #4a90d9;
    border: 1px dashed #4a90d9;
    font-size: 0.9em;
    margin-top: 8px;
}

.btn-remove-step {
    background-color: transparent;
    color: #888;
    font-size: 1em;
    padding: 5px 8px;
    border-radius: 4px;
}

.btn-remove-step:hover {
    color: #e74c3c;
}

.button-row {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}


/* ========== TIMING MODE TOGGLE ========== */

.mode-toggle {
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
    background-color: #16213e;
    border-radius: 12px;
    border: 1px solid #333;
}

.mode-label {
    font-weight: 600;
    font-size: 1em;
    margin-right: 10px;
}

.toggle-buttons {
    display: inline-flex;
    gap: 0;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #444;
}

.btn-mode {
    border-radius: 0;
    padding: 10px 20px;
    background-color: #0f3460;
    color: #888;
    font-size: 0.95em;
    border: none;
}

.btn-mode.active {
    background-color: #4a90d9;
    color: white;
}

.mode-description {
    margin-top: 10px;
    font-size: 0.85em;
    color: #999;
}


/* ========== DISH CARDS (Setup) ========== */

.dish-card {
    background-color: #16213e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.dish-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.dish-header-buttons {
    display: flex;
    gap: 6px;
}

.dish-name {
    font-size: 1.1em;
    padding: 8px 12px;
    border: 1px solid #444;
    border-radius: 6px;
    background-color: #0f3460;
    color: white;
    width: 70%;
}

.dish-name::placeholder {
    color: #777;
}


/* ========== STEP ROWS (Setup) ========== */

.step-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.step-action {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #444;
    border-radius: 6px;
    background-color: #0f3460;
    color: white;
    font-size: 0.95em;
}

.step-action::placeholder {
    color: #777;
}

.step-minutes {
    width: 65px;
    padding: 8px 10px;
    border: 1px solid #444;
    border-radius: 6px;
    background-color: #0f3460;
    color: white;
    font-size: 0.95em;
    text-align: center;
}

.step-label {
    color: #888;
    font-size: 0.9em;
}


/* ========== SAVED DISHES PANEL ========== */

#saved-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

#saved-section h3 {
    text-align: center;
    font-size: 1.1em;
    color: #aaa;
    margin-bottom: 14px;
}

.saved-empty {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    padding: 10px;
}

.saved-dish-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #16213e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.saved-dish-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.saved-dish-name {
    font-weight: 600;
    font-size: 1em;
}

.saved-dish-summary {
    font-size: 0.8em;
    color: #888;
}

.saved-dish-buttons {
    display: flex;
    gap: 6px;
}


/* ========== TIMER CARDS (Cooking View) ========== */

.timer-card {
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    text-align: center;
    transition: background-color 0.3s, transform 0.2s;
}

.timer-dish {
    font-size: 0.9em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.timer-action {
    font-size: 1.2em;
    margin-bottom: 8px;
}

.timer-countdown {
    font-size: 2.5em;
    font-weight: 700;
    font-variant-numeric: tabular-nums; /* keeps digits from shifting */
}

/* Step progress indicator (e.g., "Step 2 of 4") */
.timer-progress {
    font-size: 0.85em;
    color: #999;
    margin-top: 4px;
}

/* Color states for timer cards */

/* Waiting — muted purple, dish hasn't started yet (finish-together mode) */
.timer-card.waiting {
    background-color: #1a1333;
    border: 1px dashed #8e7cc3;
}
.timer-card.waiting .timer-countdown {
    color: #8e7cc3;
}
.timer-card.waiting .timer-action {
    font-style: italic;
    color: #aaa;
}

/* Upcoming — blue, calm, waiting */
.timer-card.upcoming {
    background-color: #16213e;
    border: 1px solid #4a90d9;
}
.timer-card.upcoming .timer-countdown {
    color: #4a90d9;
}

/* Imminent — yellow, almost time! */
.timer-card.imminent {
    background-color: #3d3100;
    border: 1px solid #f39c12;
}
.timer-card.imminent .timer-countdown {
    color: #f39c12;
}

/* Fired — red, action needed NOW */
.timer-card.fired {
    background-color: #4a0e0e;
    border: 2px solid #e74c3c;
    transform: scale(1.03);
}
.timer-card.fired .timer-countdown {
    color: #e74c3c;
    animation: pulse 0.5s infinite alternate;
}

/* Done — green, completed */
.timer-card.done {
    background-color: #0e2a15;
    border: 1px solid #27ae60;
    opacity: 0.6;
}
.timer-card.done .timer-countdown {
    color: #27ae60;
}

/* Pulse animation for the "NOW!" text */
@keyframes pulse {
    from { opacity: 1; }
    to { opacity: 0.4; }
}


/* ========== RESPONSIVE (phones/small screens) ========== */

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .step-row {
        flex-wrap: wrap;
    }

    .step-action {
        width: 100%;
    }

    .timer-countdown {
        font-size: 2em;
    }
}
