﻿/* ============================================================
   StudyBuddy — Focus Timer (page 2)
   Signature element: a split-flap "flip clock".
   Theme: navy / teal / steel.
   ============================================================ */

.timer-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
    padding-top: 2.8rem;
}

/* mode toggle */
.mode-row {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}

.mode-pill {
    font-family: var(--body);
    font-weight: 600;
    font-size: .9rem;
    color: var(--muted);
    border: none;
    background: none;
    padding: .5rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

    .mode-pill.is-active {
        background: var(--card);
        color: var(--text);
        box-shadow: var(--shadow-sm);
    }

.timer-stage[data-mode="study"] .mode-pill.is-active {
    color: #1F4959;
}
/* teal */
.timer-stage[data-mode="break"] .mode-pill.is-active {
    color: #5C7C89;
}
/* steel */

/* ===================== FLIP CLOCK ===================== */
.flip-clock {
    display: flex;
    align-items: center;
    gap: .5rem;
    perspective: 1000px;
    --card-w: clamp(64px, 18vw, 118px);
    --card-h: clamp(96px, 26vw, 168px);
    --digit: clamp(3.2rem, 12vw, 6.2rem);
    --flap-bg: #011425; /* deep navy */
    --flap-bg2: #1F495940;
    --flap-fg: #EAF1F3;
    --seam: #00070F;
}

.timer-stage[data-mode="break"] .flip-clock {
    --flap-bg: #0A2434;
}

.flip-group {
    width: var(--card-w);
}

.flip-card {
    position: relative;
    width: var(--card-w);
    height: var(--card-h);
    font-family: var(--mono);
    font-weight: 700;
    font-size: var(--digit);
    color: var(--flap-fg);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(1,20,37,.32), inset 0 0 0 1px rgba(255,255,255,.05);
    background: var(--flap-bg);
}

.timer-stage[data-mode="study"] .flip-card {
    box-shadow: 0 18px 40px rgba(31,73,89,.30), inset 0 0 0 1px rgba(255,255,255,.06);
}

.timer-stage[data-mode="break"] .flip-card {
    box-shadow: 0 18px 40px rgba(92,124,137,.26), inset 0 0 0 1px rgba(255,255,255,.06);
}

/* halves + flaps share geometry */
.flip-card .face, .flip-card .flap {
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    overflow: hidden;
    display: block;
    backface-visibility: hidden;
}

.flip-card .d {
    position: absolute;
    left: 0;
    right: 0;
    height: var(--card-h);
    line-height: var(--card-h);
    text-align: center;
}

.face.top, .flap-top {
    top: 0;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(#0A2434, var(--flap-bg));
}

.face.bottom, .flap-bottom {
    bottom: 0;
    border-radius: 0 0 14px 14px;
    background: linear-gradient(var(--flap-bg), #00060D);
}

.face.top .d, .flap-top .d {
    top: 0;
}

.face.bottom .d, .flap-bottom .d {
    bottom: 0;
}

/* center seam */
.flip-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    transform: translateY(-1px);
    background: var(--seam);
    z-index: 5;
    opacity: .85;
}

/* flap pivots */
.flap-top {
    transform-origin: bottom center;
    transform: rotateX(0deg);
    z-index: 3;
}

.flap-bottom {
    transform-origin: top center;
    transform: rotateX(90deg);
    z-index: 3;
}

.flip-card.go .flap-top {
    animation: foldTop .28s ease-in forwards;
}

.flip-card.go .flap-bottom {
    animation: unfoldBottom .28s ease-out .28s forwards;
}

@keyframes foldTop {
    from {
        transform: rotateX(0deg);
    }

    to {
        transform: rotateX(-90deg);
    }
}

@keyframes unfoldBottom {
    from {
        transform: rotateX(90deg);
    }

    to {
        transform: rotateX(0deg);
    }
}

/* colon */
.flip-colon {
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 4vw, 30px);
    padding: 0 .1rem;
}

    .flip-colon span {
        width: clamp(8px, 2.4vw, 14px);
        height: clamp(8px, 2.4vw, 14px);
        border-radius: 50%;
        background: var(--muted);
    }

.timer-stage[data-mode="study"] .flip-colon span {
    background: #1F4959;
}
/* teal */
.timer-stage[data-mode="break"] .flip-colon span {
    background: #5C7C89;
}
/* steel */

/* phase + controls */
.phase-label {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--muted);
    margin: 0;
}

.timer-stage[data-mode="study"] .phase-label {
    color: #1F4959;
}

.timer-stage[data-mode="break"] .phase-label {
    color: #5C7C89;
}

.controls {
    display: flex;
    gap: .8rem;
}

    .controls .btn-lg {
        min-width: 130px;
    }

/* sessions meta */
.meta-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--muted);
    font-size: .9rem;
}

.dots {
    display: flex;
    gap: 5px;
}

    .dots i {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: var(--line-2);
        display: block;
    }

        .dots i.on {
            background: #1F4959;
        }

.meta-sep {
    opacity: .5;
}

.sessions-text b {
    font-family: var(--mono);
    color: var(--text);
}

/* settings */
.settings {
    width: min(440px, 100%);
    margin-top: .4rem;
}

    .settings summary {
        cursor: pointer;
        color: var(--muted);
        font-size: .88rem;
        font-weight: 600;
        list-style: none;
        text-align: center;
        padding: .4rem;
    }

        .settings summary::-webkit-details-marker {
            display: none;
        }

        .settings summary:hover {
            color: var(--text);
        }

.adjust-summary {
    color: var(--muted);
    cursor: pointer;
}

    .adjust-summary:hover {
        color: var(--accent);
    }

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .9rem;
    margin-top: .8rem;
    padding: 1.1rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
}

    .settings-grid .toggle {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        gap: .6rem;
        font-size: .9rem;
        font-weight: 500;
        cursor: pointer;
    }

        .settings-grid .toggle input {
            accent-color: var(--accent);
            width: 17px;
            height: 17px;
        }

@media (prefers-reduced-motion: reduce) {
    .flip-card.go .flap-top, .flip-card.go .flap-bottom {
        animation: none;
    }
}

/* ---- overrides: float the clock, theme the buttons ---- */

/* flip clock sits directly on the page — no backing box */
.flip-clock {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Start button in theme teal (beats Bootstrap + inline) */
#startBtn,
.timer-stage .btn-primary {
    background: #1F4959 !important;
    border-color: #1F4959 !important;
    color: #fff !important;
}

    #startBtn:hover,
    .timer-stage .btn-primary:hover {
        background: #163742 !important;
        border-color: #163742 !important;
    }

/* Reset button: clean white with teal text */
#resetBtn {
    background: #fff !important;
    border-color: #C5D0D4 !important;
    color: #1F4959 !important;
}

    #resetBtn:hover {
        background: #F3F6F7 !important;
    }
