/* ========================================
   紀念日計時器 - 浪漫星空主題
   ======================================== */

/* CSS 變數 */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --accent-blue: #3b82f6;
    --glow-purple: rgba(168, 85, 247, 0.5);
    --glow-pink: rgba(236, 72, 153, 0.3);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* 重置樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ========================================
   星空背景 Canvas
   ======================================== */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ========================================
   主容器
   ======================================== */
.container {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ========================================
   標題區域
   ======================================== */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeInDown 1s ease-out;
}

.title {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 40px var(--glow-purple);
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.1em;
}

/* ========================================
   日期輸入區域
   ======================================== */
.date-input-section {
    width: 100%;
    animation: fadeInUp 1s ease-out 0.2s both;
}

.input-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.input-label {
    display: block;
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}

.input-label .icon {
    font-size: 1.3rem;
    margin-right: 0.5rem;
}

.date-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    font-family: var(--font-main);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    color: var(--text-primary);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.date-input:hover,
.date-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 20px var(--glow-purple);
}

/* 日期選擇器樣式 */
.date-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.confirm-btn {
    margin-top: 1.5rem;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-family: var(--font-main);
    font-weight: 500;
    color: white;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    border: none;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--glow-purple);
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--glow-purple);
}

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

/* ========================================
   天數顯示區域
   ======================================== */
.counter-section {
    width: 100%;
    position: relative;
    animation: fadeIn 1s ease-out;
}

.edit-date-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-date-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--accent-purple);
}

.edit-date-btn .icon {
    font-size: 1rem;
}

.counter-display {
    text-align: center;
    padding: 2rem 0;
}

.counter-label {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.day-counter {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, #fff 0%, var(--accent-purple) 50%, var(--accent-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 30px var(--glow-purple)) drop-shadow(0 0 60px var(--glow-pink));
    animation: glow-pulse 3s ease-in-out infinite;
}

.counter-unit {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    letter-spacing: 0.3em;
}

.start-date-display {
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* 光暈脈動動畫 */
@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 30px var(--glow-purple)) drop-shadow(0 0 60px var(--glow-pink));
    }
    50% {
        filter: drop-shadow(0 0 50px var(--glow-purple)) drop-shadow(0 0 100px var(--glow-pink));
    }
}

/* ========================================
   里程碑區域
   ======================================== */
.milestone-section {
    width: 100%;
    margin-top: 2rem;
    animation: fadeInUp 1s ease-out 0.3s both;
}

.milestone-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.milestone-title .icon {
    font-size: 1.2rem;
}

/* 下一個里程碑（高亮） */
.next-milestone {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.milestone-highlight {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.milestone-days {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-purple);
    text-shadow: 0 0 20px var(--glow-purple);
}

.milestone-arrow {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.milestone-date {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.milestone-countdown {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.milestone-countdown span {
    color: var(--accent-pink);
    font-weight: 600;
}

/* 即將到來的里程碑列表 */
.upcoming-milestones,
.achieved-milestones {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.milestone-list {
    list-style: none;
}

.milestone-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--card-border);
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.5s ease forwards;
}

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

/* 動畫延遲 */
.milestone-item:nth-child(1) { animation-delay: 0.1s; }
.milestone-item:nth-child(2) { animation-delay: 0.15s; }
.milestone-item:nth-child(3) { animation-delay: 0.2s; }
.milestone-item:nth-child(4) { animation-delay: 0.25s; }
.milestone-item:nth-child(5) { animation-delay: 0.3s; }
.milestone-item:nth-child(6) { animation-delay: 0.35s; }
.milestone-item:nth-child(7) { animation-delay: 0.4s; }
.milestone-item:nth-child(8) { animation-delay: 0.45s; }
.milestone-item:nth-child(9) { animation-delay: 0.5s; }
.milestone-item:nth-child(10) { animation-delay: 0.55s; }

.milestone-item-label {
    display: flex;
    flex-direction: column;
}

.milestone-item-days {
    font-weight: 600;
    color: var(--text-primary);
}

.milestone-item-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.milestone-item-info {
    text-align: right;
}

.milestone-item-date {
    color: var(--accent-purple);
    font-weight: 500;
}

.milestone-item-until {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* 已達成的里程碑 */
.achieved-milestones {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.achieved-milestones .milestone-title {
    color: rgba(16, 185, 129, 0.8);
}

.milestone-list.achieved .milestone-item-days {
    color: rgba(16, 185, 129, 0.9);
}

.milestone-list.achieved .milestone-item-date {
    color: rgba(16, 185, 129, 0.7);
}

/* ========================================
   動畫效果
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   響應式設計
   ======================================== */
@media (max-width: 480px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .title {
        font-size: 1.8rem;
    }

    .day-counter {
        font-size: 3.5rem;
    }

    .counter-unit {
        font-size: 1.5rem;
    }

    .milestone-highlight {
        flex-direction: column;
        gap: 0.5rem;
    }

    .milestone-days {
        font-size: 1.8rem;
    }

    .milestone-date {
        font-size: 1.1rem;
    }

    .input-card {
        padding: 1.5rem;
    }
}

/* ========================================
   滾動條樣式
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

/* ========================================
   隱藏類
   ======================================== */
.hidden {
    display: none !important;
}
