/* ============================================
   pomodoro.css —— 番茄钟 Pro
   ============================================ */

.app-main {
    padding: calc(var(--topbar-h) + 1.25rem) 1.25rem 2rem;
}

.pomo-layout {
    display: grid;
    grid-template-columns: minmax(380px, 1fr) minmax(320px, 420px);
    gap: 1.25rem;
    max-width: 1180px;
    margin: 0 auto;
    align-items: start;
}

.side-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ===== 计时卡片 ===== */
.timer-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 1.5rem 1.75rem;
}

.ring-wrap {
    position: relative;
    width: 260px;
    height: 260px;
    max-width: 72vw;
    max-height: 72vw;
}

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

.ring-track {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 12;
}

.ring-progress {
    fill: none;
    stroke: url(#ringGrad);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 653.45;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.35s linear, stroke 0.4s ease;
    filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.22));
}

.ring-progress.rest {
    stroke: url(#ringGradRest);
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.5));
}

.ring-wrap.running .ring-progress {
    transition: stroke-dashoffset 0.35s linear;
}

.ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    text-align: center;
    padding: 0 2rem;
}

.time-display {
    font-family: var(--font-mono);
    font-size: 3.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 24px rgba(37, 99, 235, 0.18);
}

.time-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timer-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-lg {
    padding: 0.7rem 2rem;
    font-size: 1rem;
    border-radius: 12px;
}

.timer-tip {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* 休息模式配色 */
.timer-card.is-rest .time-display {
    text-shadow: 0 0 30px rgba(16, 185, 129, 0.35);
}

/* 结束闪烁提示 */
@keyframes pulseGlow {
    0%, 100% { box-shadow: var(--shadow-md); }
    50%      { box-shadow: 0 0 50px rgba(16, 185, 129, 0.55); }
}

.timer-card.finished {
    animation: pulseGlow 1.1s ease-in-out infinite;
}

/* ===== 任务清单 ===== */
.task-add {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.task-add input {
    flex: 1;
}

.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 260px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.task-item:hover {
    background: rgba(15, 23, 42, 0.05);
    border-color: var(--border-color);
}

.task-item.active {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.08);
}

.task-item.done .task-name {
    text-decoration: line-through;
    opacity: 0.45;
}

.task-check-btn {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 1.5px solid var(--text-muted);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    padding: 0;
}

.task-check-btn:hover {
    border-color: var(--accent-green);
}

.task-item.done .task-check-btn {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.task-item.done .task-check-btn::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.task-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-item.active .task-name {
    color: var(--text-primary);
}

.task-pomo {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent-purple);
    background: rgba(37, 99, 235, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 5px;
    flex-shrink: 0;
}

.task-del {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    opacity: 0;
    transition: all var(--transition-fast);
}

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

.task-del:hover {
    color: var(--accent-red);
}

/* ===== 统计 ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.stat-box {
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-num {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-cap {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 90px;
}

.chart-bar-wrap {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    position: relative;
}

.chart-bar {
    width: 100%;
    border-radius: 5px 5px 2px 2px;
    background: var(--gradient-primary);
    min-height: 3px;
    transition: height var(--transition-slow);
    position: relative;
}

.chart-bar.today {
    background: var(--gradient-rainbow);
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
}

.chart-bar-wrap:hover .chart-bar {
    filter: brightness(1.2);
}

.chart-bar-val {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-muted);
}

.chart-labels {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.chart-label {
    flex: 1;
    text-align: center;
    font-size: 0.66rem;
    color: var(--text-muted);
}

.chart-label.today {
    color: var(--accent-pink);
    font-weight: 600;
}

/* ===== 设置抽屉 ===== */
.drawer {
    position: fixed;
    top: 0;
    right: -360px;
    width: 360px;
    max-width: 92vw;
    height: 100vh;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 300;
    transition: right var(--transition-normal);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 2;
}

.drawer-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.drawer-body {
    padding: 1.1rem;
}

.drawer-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 299;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.drawer-mask.show {
    opacity: 1;
    pointer-events: auto;
}

.form-row-inline {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 55%;
}

.form-row-inline input[type="range"] {
    flex: 1;
}

/* ===== 响应式 ===== */
@media (max-width: 968px) {
    .pomo-layout {
        grid-template-columns: 1fr;
    }

    .side-col {
        order: 2;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: calc(var(--topbar-h) + 0.75rem) 0.75rem 1.5rem;
    }

    .pomo-layout {
        gap: 0.85rem;
    }

    .timer-body {
        padding: 1.25rem 1rem 1.25rem;
        gap: 1.1rem;
    }

    .time-display {
        font-size: 2.6rem;
    }

    .btn-lg {
        padding: 0.6rem 1.5rem;
    }

    .timer-tip {
        display: none;
    }
}
