/* style.css — Layout específico do Espaço Zen (Pomodoro).
   Tokens de cor, tipografia, .panel, .btn e blobs ambiente vêm de theme.css. */

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Top padding clears the fixed .navbar (~87px) plus a small gap — a fixed
       floor, not fluid like the bottom, since the navbar's own height doesn't
       shrink on short viewports either. Bottom keeps scaling with viewport
       height, alongside the timer and gaps below. */
    padding-top: 104px;
    padding-bottom: clamp(1rem, 3vh, 2rem);
    padding-left: 2rem;
    padding-right: 2rem;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

body.mode-breathe { --accent: var(--accent-violet); }
body.mode-focus { --accent: var(--accent-blue); }

/* Dashboard Layout */
.dashboard-container {
    margin: auto;
    display: flex;
    align-items: flex-start;
    gap: 3.5rem;
    max-width: 1080px;
    width: 100%;
    z-index: 1;
}

/* Timer: the hero. Dominant width, deepest presence — lives directly on the page,
   no card, its own glow is the only boundary it needs.

   Gap scales with viewport height (not a fixed rem) so the whole column keeps
   fitting as the window gets shorter, instead of jumping at one breakpoint —
   a 300px ring plus fixed 2.5rem gaps needed ~750px of height, enough to push
   the mode switcher below the fold on an ordinary laptop window. */
.timer-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 3vh, 2.5rem);
}

.timer-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.timer-header > div:first-child {
    min-width: 0;
}

.pomodoro-counter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.pomodoro-counter svg { flex-shrink: 0; color: var(--accent); transition: color 0.6s ease; }

#pomodoro-count {
    color: var(--color-text);
}

/* Tasks: secondary support. Fixed, contained width, separated from the timer
   by a thin rule instead of a second card — no glow, quieter presence. */
.tasks-panel {
    display: flex;
    flex-direction: column;
    flex: 0 0 300px;
    margin-top: clamp(1.5rem, 4vh, 4rem);
    border-left: 1px solid var(--color-border);
    padding-left: 2rem;
    overflow-y: auto;
}

/* Typography */
h1 {
    font-size: 2.6rem;
    letter-spacing: -0.01em;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    font-style: italic;
    margin-top: 0.2rem;
}

/* Section label, not a co-equal heading — the tasks panel is supporting, not a second hero */
.tasks-panel h2 {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

/* Timer. Sized off viewport height, not a fixed 300px, for the same reason as
   .timer-panel's gap above — it's the single biggest thing on the page, so it's
   also the biggest lever for keeping everything above the fold. */
.timer-container {
    position: relative;
    width: clamp(160px, 30vh, 300px);
    height: clamp(160px, 30vh, 300px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 0;
}

.timer-container::before {
    content: '';
    position: absolute;
    inset: -8%;
    z-index: -1;
    background: var(--accent);
    opacity: 0.24;
    filter: blur(40px);
    border-radius: 55% 45% 40% 60% / 50% 55% 45% 50%;
    animation: blobBreathe 6.5s ease-in-out infinite alternate;
    transition: background-color 0.8s ease;
    will-change: transform;
}

body.is-running .timer-container::before {
    animation-duration: 3.2s;
    opacity: 0.36;
}

/* Only `transform` animates — see theme.css for why (border-radius animation
   forces a repaint of the blur every frame; transform is compositor-only). */
@keyframes blobBreathe {
    0%   { transform: scale(0.92); }
    100% { transform: scale(1.07); }
}

.progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring__circle-bg {
    stroke: rgba(255, 255, 255, 0.08);
}

.progress-ring__circle {
    stroke: var(--accent);
    stroke-dasharray: 880;
    stroke-dashoffset: 0;
    stroke-width: 9;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear, stroke 0.6s ease;
}

.time-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 9vh, 4.8rem);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    text-align: center;
}

/* Respirar mode swaps the MM:SS countdown for a breath-phase word ("Inspire",
   "Segure", "Expire") while running — shorter and wider than the digits, so it
   gets its own smaller, calmer treatment instead of trying to reuse 4.8rem. */
.time-display.is-word {
    font-size: clamp(1.5rem, 5.5vh, 2.4rem);
    font-style: italic;
    font-variant-numeric: normal;
    letter-spacing: 0.01em;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn.icon-btn {
    /* Menor que o 0.85rem do .btn de texto de propósito: o conteúdo aqui é um SVG
       de 24px, contra as 20px de altura de linha de um rótulo. A diferença de 4px
       sai do padding para os dois ficarem com a mesma altura na fileira. */
    padding: 0.725rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1.5px solid var(--color-border-strong);
}

.btn.icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.btn.icon-btn:active {
    transform: translateY(0);
}

/* Mode Selection */
.modes {
    display: flex;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.35rem;
    border-radius: 999px;
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    padding: 0.55rem 1.15rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.88rem;
    transition: var(--transition-smooth);
}

.mode-btn:hover { color: var(--color-text); }
.mode-btn.active {
    background: var(--color-surface-raised);
    color: var(--color-text);
    box-shadow: inset 0 0 0 1px var(--color-border-strong);
}

/* Tasks */
.tasks-panel header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.tasks-count {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    padding: 0.2rem 0.8rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
}

.task-input-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

#task-input {
    flex: 1;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 1rem;
    color: var(--color-text);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition-smooth);
}

#task-input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.02);
}

#task-input::placeholder {
    color: var(--color-text-dim);
}

#btn-add-task {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    width: 3rem;
    border-radius: 14px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

#btn-add-task:hover {
    background: rgba(255, 255, 255, 0.1);
}

.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--color-border);
    transition: var(--transition-smooth);
    animation: growIn 0.35s var(--ease-organic);
}

.task-list .task-item:last-child {
    border-bottom: none;
}

.task-item:hover {
    border-bottom-color: var(--color-border-strong);
}

.task-item.dragging {
    opacity: 0.4;
}

.task-item.completed {
    animation: taskSettle 0.4s var(--ease-organic);
}

@keyframes growIn {
    from { opacity: 0; transform: scale(0.94) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes taskSettle {
    0% { transform: scale(1); }
    35% { transform: scale(1.015); }
    100% { transform: scale(1); }
}

.drag-handle {
    cursor: grab;
    color: var(--color-text-dim);
    opacity: 0;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    padding-right: 0.25rem;
}

.task-item:hover .drag-handle { opacity: 0.6; }
.drag-handle:hover { opacity: 1 !important; }

.task-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

/* Checkbox that lights up with the active mode's accent when completed */
.task-checkbox {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border: 2px solid var(--color-text-dim);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.task-item.completed .task-checkbox {
    background: var(--accent);
    border-color: var(--accent);
    animation: checkPop 0.4s var(--ease-organic);
}

@keyframes checkPop {
    0% { transform: scale(0.6); }
    60% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.check-icon path {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    transition: stroke-dashoffset 0.4s var(--ease-organic) 0.05s;
}

.task-item.completed .check-icon path {
    stroke-dashoffset: 0;
}

.task-text {
    font-size: 1rem;
    transition: var(--transition-smooth);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    outline: none;
}

.task-text[contenteditable="true"] {
    white-space: normal;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.1rem 0.4rem;
    cursor: text;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--color-text-muted);
}

.task-delete {
    background: transparent;
    border: none;
    color: var(--color-text-dim);
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0;
    transition: var(--transition-smooth);
}

.task-item:hover .task-delete {
    opacity: 1;
}

.task-delete:hover {
    color: var(--color-danger);
}

.task-empty {
    color: var(--color-text-dim);
    font-size: 0.9rem;
    font-style: italic;
    line-height: 1.6;
}

.session-cta {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: growIn 0.5s var(--ease-organic);
}

.session-cta p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    max-width: 24rem;
    line-height: 1.6;
}

@media (max-width: 980px) {
    .dashboard-container {
        flex-direction: column;
        min-height: auto;
        padding: 2rem 0;
    }

    .tasks-panel {
        flex: 1 1 auto;
        margin-top: 0 !important;
        width: 100%;
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--color-border);
        padding-top: 2.5rem;
    }
}

/* Movimento reduzido: pausa o halo contínuo do timer (decorativo). O guia de
   respiração e os micro-feedbacks de tarefa (growIn/checkPop, one-shot de
   ~0.4s) permanecem: são resposta funcional à ação do usuário, não ambiente. */
@media (prefers-reduced-motion: reduce) {
    .timer-container::before {
        animation: none;
    }
}
