/* ======================================================================
 *  每日喝水打卡 /tool/water-tracker
 *  依赖 calc-common.css 共享样式 + home.css 全局变量，支持黑夜模式
 * ====================================================================== */

@import url('./calc-common.css');

/* ---------- 打卡主舞台 ---------- */
.wt-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 8px 0 2px;
    animation: calcFade 0.28s ease;
}

/* ---------- 水杯填充动画 ---------- */
.wt-cup {
    position: relative;
    width: 120px;
    height: 150px;
    flex: none;
}
.wt-cup-glass {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(0, 150, 220, 0.55);
    border-top-width: 2px;
    border-radius: 10px 10px 22px 22px;
    background: linear-gradient(180deg, rgba(0, 150, 220, 0.04), rgba(0, 150, 220, 0.02));
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
    pointer-events: none;
    z-index: 3;
}
.wt-cup-water {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 4px;
    height: 0%;
    border-radius: 5px 5px 17px 17px;
    background: linear-gradient(180deg, rgba(64, 190, 250, 0.92), rgba(0, 140, 220, 0.95));
    transition: height 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
    z-index: 1;
}
/* 水面波纹 */
.wt-cup-water::before {
    content: '';
    position: absolute;
    top: -7px;
    left: -25%;
    width: 150%;
    height: 14px;
    background: radial-gradient(circle at 10px -3px, transparent 8px, rgba(64, 190, 250, 0.92) 9px);
    background-size: 20px 14px;
    animation: wtWave 2.4s linear infinite;
}
.wt-cup-water::after {
    content: '';
    position: absolute;
    top: -7px;
    left: -25%;
    width: 150%;
    height: 14px;
    background: radial-gradient(circle at 10px -3px, transparent 8px, rgba(255, 255, 255, 0.35) 9px);
    background-size: 20px 14px;
    background-position: 10px 0;
    animation: wtWave 2.4s linear infinite reverse;
}
@keyframes wtWave {
    from { transform: translateX(0); }
    to { transform: translateX(20px); }
}
/* 水花（打卡瞬间） */
.wt-cup-splash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}
.wt-cup-splash span {
    position: absolute;
    left: 50%;
    bottom: 40%;
    width: 8px;
    height: 8px;
    border-radius: 50% 50% 50% 0;
    background: rgba(64, 190, 250, 0.95);
    transform: rotate(-45deg);
    animation: wtSplash 0.75s ease-out forwards;
}
@keyframes wtSplash {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) rotate(-45deg) scale(0.4);
    }
    30% { opacity: 1; }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--sx, 0px)), -72px) rotate(-45deg) scale(1);
    }
}
/* 打卡时杯身轻弹 */
.wt-cup.is-bounce { animation: wtBounce 0.45s ease; }
@keyframes wtBounce {
    0% { transform: scale(1); }
    35% { transform: scale(1.05, 0.95); }
    70% { transform: scale(0.97, 1.03); }
    100% { transform: scale(1); }
}
/* 达成目标：杯壁高亮 */
.wt-cup.is-full .wt-cup-glass {
    border-color: rgba(52, 199, 89, 0.75);
    box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.15), inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

/* ---------- SVG 进度环 ---------- */
.wt-ring-wrap {
    position: relative;
    width: 150px;
    height: 150px;
    flex: none;
}
.wt-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.wt-ring circle {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
}
.wt-ring-bg { stroke: var(--c-border); opacity: 0.45; }
.wt-ring-fill {
    stroke: #0a9be0;
    stroke-dasharray: 326.73; /* 2πr, r = 52 */
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.wt-ring-fill.is-done { stroke: #2fbf5e; }
.wt-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.wt-ring-text b {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--c-text);
}
.wt-ring-text small {
    font-size: 11.5px;
    color: var(--c-text-muted);
}
.wt-stage .calc-metrics { width: 100%; }
.wt-stage .calc-note { width: 100%; text-align: center; }

/* 目标达成提示条 */
.wt-note-done {
    background: rgba(52, 199, 89, 0.08);
    border: 1px dashed rgba(52, 199, 89, 0.35);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--c-text-sub);
}

/* ---------- 历史表格状态 ---------- */
.wt-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 700;
}
.wt-status.is-done { background: rgba(52, 199, 89, 0.12); color: #1f9d43; }
.wt-status.is-half { background: rgba(0, 150, 220, 0.10); color: #0a7fc0; }
.wt-status.is-none { background: var(--c-surface-soft); color: var(--c-text-muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 620px) {
    .wt-ring-wrap { width: 130px; height: 130px; }
    .wt-ring-text b { font-size: 22px; }
    .wt-cup { width: 104px; height: 130px; }
}

/* ---------- 黑夜模式 ---------- */
[data-theme="dark"] .wt-cup-glass {
    background: linear-gradient(180deg, rgba(64, 190, 250, 0.06), rgba(64, 190, 250, 0.03));
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .wt-ring-fill { stroke: #58bdf0; }
[data-theme="dark"] .wt-ring-fill.is-done { stroke: #4ede78; }
[data-theme="dark"] .wt-status.is-done { background: rgba(52, 199, 89, 0.16); color: #4ede78; }
[data-theme="dark"] .wt-status.is-half { background: rgba(0, 150, 220, 0.16); color: #58bdf0; }
[data-theme="dark"] .wt-note-done {
    background: rgba(52, 199, 89, 0.13);
    border-color: rgba(52, 199, 89, 0.34);
}
