/* ==========================================
   RESET
   ========================================== */

* {
    box-sizing: border-box;
}


body {
    margin: 0;

    min-height: 100vh;

    background: #0f172a;

    color: white;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    transition:
        background 0.2s;
}


/* ==========================================
   HEADER
   ========================================== */

.top-header {
    width: calc(100% - 30px);

    max-width: 900px;

    height: 70px;

    margin: 15px auto 25px;

    padding: 0 22px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    background: #1e293b;

    border: 1px solid #334155;

    border-radius: 16px;
}


/* ==========================================
   TITOLO
   ========================================== */

.header-title {
    font-size: 22px;

    font-weight: 600;

    color: #f8fafc;

    letter-spacing: 0.3px;

    white-space: nowrap;
}


/* ==========================================
   CONTROLLI HEADER
   ========================================== */

.header-controls {
    display: flex;

    align-items: center;

    gap: 14px;
}


.volume-box {
    display: flex;

    align-items: center;

    gap: 9px;
}


.volume-icon {
    font-size: 18px;
}


#volume {
    width: 130px;

    height: 6px;

    accent-color: #38bdf8;

    cursor: pointer;
}


#volumeValue {
    min-width: 42px;

    color: #cbd5e1;

    font-size: 13px;

    text-align: right;
}


/* ==========================================
   PULSANTE TEST AUDIO
   ========================================== */

.test-button {
    width: 40px;

    height: 40px;

    padding: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    border: none;

    border-radius: 50%;

    background: #38bdf8;

    color: #082f49;

    font-size: 16px;

    cursor: pointer;

    transition:
        transform 0.15s,
        background 0.15s;
}


.test-button:hover {
    background: #7dd3fc;

    transform: scale(1.08);
}


.test-button:active {
    transform: scale(0.95);
}


/* ==========================================
   CONTENITORE PRINCIPALE
   ========================================== */

.container {
    width: min(92vw, 520px);

    margin: 0 auto;

    padding-bottom: 30px;

    text-align: center;
}


/* ==========================================
   TIMER CIRCOLARE
   ========================================== */

.timer-wrapper {
    position: relative;

    width: min(80vw, 380px);

    height: min(80vw, 380px);

    margin: 0 auto 30px;
}


.timer-wrapper svg {
    width: 100%;

    height: 100%;

    transform: rotate(-90deg);
}


.circle-bg {
    fill: none;

    stroke: #1e293b;

    stroke-width: 12;
}


.circle-progress {
    fill: none;

    stroke: #38bdf8;

    stroke-width: 12;

    stroke-linecap: round;

    transition:
        stroke-dashoffset 0.3s linear,
        stroke 0.3s;
}


.circle-progress.finished {
    stroke: #22c55e;
}


/* ==========================================
   TESTO TIMER
   ========================================== */

.timer-text {
    position: absolute;

    inset: 0;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;
}


#time {
    font-size: clamp(48px, 14vw, 76px);

    font-weight: bold;

    letter-spacing: 2px;

    font-variant-numeric: tabular-nums;
}


#status {
    margin-top: 10px;

    color: #94a3b8;

    font-size: 16px;
}


/* ==========================================
   PROSSIMO INTERVALLO
   ========================================== */

.next {
    padding: 15px 20px;

    margin-bottom: 22px;

    background: #1e293b;

    border-radius: 14px;

    font-size: 16px;
}


.next strong {
    color: #38bdf8;
}


/* ==========================================
   PULSANTI TIMER
   ========================================== */

.buttons {
    display: flex;

    justify-content: center;

    gap: 12px;

    flex-wrap: wrap;
}


.buttons button {
    border: none;

    border-radius: 12px;

    padding: 13px 25px;

    font-size: 16px;

    font-weight: bold;

    cursor: pointer;

    transition:
        transform 0.15s,
        opacity 0.15s;
}


.buttons button:hover {
    transform: translateY(-2px);
}


.buttons button:active {
    transform: translateY(0);
}


.buttons button:disabled {
    opacity: 0.4;

    cursor: not-allowed;

    transform: none;
}


.start-button {
    background: #38bdf8;

    color: #082f49;
}


.pause-button {
    background: #fbbf24;

    color: #422006;
}


.reset-button {
    background: #334155;

    color: white;
}


/* ==========================================
   INTERVALLI
   ========================================== */

.intervals {
    display: flex;

    justify-content: center;

    flex-wrap: wrap;

    gap: 8px;

    margin-top: 30px;
}


.interval {
    padding: 5px 9px;

    display: inline-flex;

    align-items: center;

    gap: 4px;

    border-radius: 20px;

    background: #1e293b;

    color: #94a3b8;

    font-size: 13px;

    transition:
        background 0.2s,
        color 0.2s,
        transform 0.2s,
        box-shadow 0.2s;
}


/* ==========================================
   INPUT INTERVALLO
   ========================================== */

.interval-input {
    width: 42px;

    padding: 2px 0;

    border: none;

    outline: none;

    background: transparent;

    color: #94a3b8;

    font-family: inherit;

    font-size: 13px;

    font-weight: 600;

    text-align: center;
}


/* Rimuove le frecce del campo numerico */

.interval-input::-webkit-inner-spin-button,
.interval-input::-webkit-outer-spin-button {
    margin: 0;

    appearance: none;
}


.interval-input {
    appearance: textfield;
}


/* Focus */

.interval-input:focus {
    color: white;

    text-decoration: underline;
}


/* Unità */

.interval-unit {
    color: #64748b;

    font-size: 12px;

    user-select: none;
}


/* ==========================================
   INTERVALLO COMPLETATO
   ========================================== */

.interval.done {
    background: #166534;

    color: #bbf7d0;
}


.interval.done .interval-input {
    color: #bbf7d0;
}


.interval.done .interval-unit {
    color: #86efac;
}


/* ==========================================
   INTERVALLO CORRENTE
   ========================================== */

.interval.current {
    background: #0369a1;

    color: white;

    box-shadow:
        0 0 12px rgba(56, 189, 248, 0.4);

    transform: scale(1.05);
}


.interval.current .interval-input {
    color: white;
}


.interval.current .interval-unit {
    color: #bae6fd;
}


/* ==========================================
   INPUT NON VALIDO
   ========================================== */

.interval-input.invalid {
    color: #fca5a5;

    text-decoration: underline;

    text-decoration-color: #ef4444;
}


.interval:has(.interval-input.invalid) {
    background: #450a0a;

    border: 1px solid #ef4444;
}


/* ==========================================
   MESSAGGIO ERRORE
   ========================================== */

.interval-error {
    min-height: 20px;

    margin-top: 12px;

    color: #fca5a5;

    font-size: 13px;
}


/* ==========================================
   FLASH QUANDO SUONA
   ========================================== */

.flash {
    animation:
        flash 0.6s ease-in-out 3;
}


@keyframes flash {

    0%,
    100% {
        background: #0f172a;
    }

    50% {
        background: #166534;
    }

}


/* ==========================================
   MOBILE
   ========================================== */

@media (max-width: 600px) {

    .top-header {
        width: calc(100% - 20px);

        height: 62px;

        padding: 0 14px;

        margin-top: 10px;

        margin-bottom: 20px;

        border-radius: 12px;
    }


    .header-title {
        font-size: 18px;
    }


    .header-controls {
        gap: 8px;
    }


    .volume-icon {
        font-size: 16px;
    }


    #volume {
        width: 80px;
    }


    #volumeValue {
        min-width: 35px;

        font-size: 12px;
    }


    .test-button {
        width: 36px;

        height: 36px;

        font-size: 14px;
    }


    .container {
        width: 94vw;
    }

}


@media (max-width: 430px) {

    .header-title {
        font-size: 17px;
    }


    #volume {
        width: 60px;
    }


    #volumeValue {
        display: none;
    }

}
