/* 睡眠周期计算器样式表 */

/* 1. 全局样式 */
:root {
    --bg-primary: #0F172A;
    --bg-card: #1E293B;
    --text-primary: #E2E8F0;
    --text-highlight: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #CBD5E1;
    --border-color: #475569;
    --accent-gold: #FACC15;
    --btn-primary: #4F46E5;
    --btn-primary-hover: #4338CA;
    --btn-secondary: #6B7280;
    --btn-secondary-hover: #4B5563;
    --toast-success: #10B981;
    --toast-info: #3B82F6;
    --text-white: #F1F5F9;
    --text-pure-white: #FFFFFF;
    --bg-suggested: rgba(191, 219, 254, 0.2);
    --text-footer: #64748B;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.6;
}

/* 2. 布局 */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    gap: 3rem;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    /* 控制图标和文字之间的间距 */
}

header h1 {
    font-size: 2.5rem;
    color: var(--text-highlight);
    margin: 0;
}

section {
    width: 100%;
}

/* 计算器区域样式 */
#calculator-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    width: 100%;
}

.wake-up-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.wake-up-section label {
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--text-white);
}

.wake-up-section input[type="time"] {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-white);
    font-size: 1.2rem;
    padding: 1rem 1.5rem;
    width: 280px;
    text-align: center;
}

/* 时间选择器样式 */
#time-picker-container {
    display: flex;
    justify-content: center;
    position: relative;
}

.swiper-container {
    width: 80px;
    height: 150px;
    overflow: hidden;
}

.swiper-slide {
    text-align: center;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* 中间的高亮选中效果 */
#time-picker-container::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 2.5rem;
    /* 大约是每个选项的高度 */
    border-top: 2px solid var(--accent-gold);
    /* 金色上边框 */
    border-bottom: 2px solid var(--accent-gold);
    /* 金色下边框 */
    pointer-events: none;
    /* 让鼠标可以点击到下方的滚轮 */
}

.separator-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin: 0;
}

.sleep-now-section {
    display: flex;
    justify-content: center;
}

/* 3. 按钮样式 */
button {
    background-color: var(--btn-primary);
    color: var(--text-pure-white);
    border: none;
    border-radius: 25px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 300px;
    margin: 0;
}

button:hover {
    background-color: var(--btn-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

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

/* 返回按钮样式 */
#go-back-btn {
    background-color: var(--btn-secondary);
    color: var(--text-pure-white);
    border: none;
    border-radius: 25px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 300px;
    margin-top: 1rem;
}

#go-back-btn:hover {
    background-color: var(--btn-secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.3);
}

#go-back-btn:active {
    transform: translateY(0);
}

/* 4. 结果视图样式 */
#results-view {
    display: none;
    /* 初始时隐藏 */
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

#results-view h2 {
    font-size: 2rem;
    color: var(--text-highlight);
    font-weight: 400;
    margin: 0;
}

#results-view h3 {
    font-size: 1.4rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 2rem 0 1rem 0;
    text-align: center;
}

#result-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: center;
    margin: 0;
    max-width: 600px;
}

#result-capsules-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
}

.explanation-text {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    /* 一个柔和的灰色 */
    max-width: 350px;
    /* 避免在宽屏上文字太长 */
}

/* 这是新的父容器的样式 */
.result-item-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    /* 胶囊和下方标签之间的小间距 */
}

/* 这是"SUGGESTED"标签本身的样式 */
.suggested-label {
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--border-color);
    /* 更深的灰色，确保在新背景上清晰可见 */
    letter-spacing: 0.05em;
    /* 让字母之间稍微有点距离 */
    text-transform: uppercase;
    background-color: #BFDBFE33;
    /* 淡蓝色背景，20% 透明度 */
    padding: 0.2rem 0.5rem;
    /* 内边距，给文字留出呼吸空间 */
    border-radius: 4px;
    /* 圆角，让标签看起来更柔和 */
}

.result-text {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-white);
    font-weight: 400;
    width: 100%;
}

.result-capsule {
    background-color: var(--text-primary);
    color: var(--bg-card);
    border: none;
    border-radius: 20px;
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    width: auto;
    min-width: 180px;
}

.result-capsule:hover {
    background-color: var(--text-muted);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}



/* 页脚样式 */
footer {
    margin-top: 2rem;
    color: var(--text-footer);
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .calculator-form {
        padding: 1.5rem;
    }

    main {
        padding: 15px;
    }
}

/* Toast Notification Styles */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
    /* Respect safe area for mobile devices with notches */
    padding-top: env(safe-area-inset-top);
}

.toast {
    background-color: var(--toast-success);
    /* Default success green */
    color: var(--text-pure-white);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 1rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.info {
    background-color: var(--toast-info);
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: none;
        transform: none;
    }
}

/* Streak Info Styles - Explicitly styled to fix visibility issues */
.check-in-info {
    font-size: 1rem;
    color: var(--text-footer);
    margin-top: 1.5rem;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    /* Subtle background */
    border-radius: 12px;
    display: inline-block;
    font-weight: 500;
}

#streak-days {
    color: var(--accent-gold);
    /* Highlight the number */
    font-weight: bold;
    font-size: 1.1rem;
}