/* ===== 基礎設定 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --mint-light: #e8f5f0;
    --mint: #a8e6cf;
    --mint-dark: #7bc9a8;
    --coral: #ff8b94;
    --peach: #ffaaa5;
    --cream: #ffd3b6;
    --yellow: #ffe66d;
    --blue: #88d8f5;
    --purple: #c9b1ff;
    --pink: #ffb6c1;

    /* 每日顏色 - 彩虹漸層 */
    --monday-color: #ff6b6b;
    --monday-light: #ffe0e0;
    --tuesday-color: #ffa94d;
    --tuesday-light: #fff0e0;
    --wednesday-color: #ffd43b;
    --wednesday-light: #fff8e0;
    --thursday-color: #69db7c;
    --thursday-light: #e0ffe8;
    --friday-color: #4dabf7;
    --friday-light: #e0f4ff;
    --saturday-color: #9775fa;
    --saturday-light: #f0e8ff;
    --sunday-color: #f783ac;
    --sunday-light: #ffe8f0;
    --remarks-color: #a8e6cf;
    --remarks-light: #e8f5f0;

    --text-dark: #2d3436;
    --text-light: #636e72;
    --white: #ffffff;
    --bg-cream: #fef9f3;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: linear-gradient(180deg, var(--mint-light) 0%, var(--bg-cream) 100%);
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

/* ===== 容器 ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-cream);
    border-radius: 30px;
    padding: 25px;
    box-shadow: var(--shadow);
    position: relative;
    border: 3px solid var(--mint);
}

/* ===== 裝飾元素 ===== */
.decoration {
    position: absolute;
    width: 120px;
    height: 150px;
    pointer-events: none;
    z-index: 0;
}

.leaf-left {
    top: 10px;
    left: 10px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='20' cy='20' r='8' fill='%23ffb7c5' opacity='0.6'/%3E%3Ccircle cx='40' cy='15' r='6' fill='%23ffd1dc' opacity='0.5'/%3E%3Ccircle cx='30' cy='35' r='7' fill='%23ffb7c5' opacity='0.5'/%3E%3Ccircle cx='15' cy='45' r='5' fill='%23ffd1dc' opacity='0.6'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    animation: float 3s ease-in-out infinite;
}

.leaf-right {
    top: 10px;
    right: 10px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='80' cy='20' r='8' fill='%23ffb7c5' opacity='0.6'/%3E%3Ccircle cx='60' cy='15' r='6' fill='%23ffd1dc' opacity='0.5'/%3E%3Ccircle cx='70' cy='35' r='7' fill='%23ffb7c5' opacity='0.5'/%3E%3Ccircle cx='85' cy='45' r='5' fill='%23ffd1dc' opacity='0.6'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    animation: float 3s ease-in-out infinite 0.5s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* ===== 可愛貓咪 ===== */
.cat {
    position: absolute;
    font-size: 50px;
    z-index: 10;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
}

.cat-left {
    top: 5px;
    left: 50%;
    transform: translateX(-80px);
}

.cat-right {
    top: 5px;
    left: 50%;
    transform: translateX(30px);
    animation-delay: 0.3s;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateX(-80px) translateY(0);
    }

    50% {
        transform: translateX(-80px) translateY(-8px);
    }
}

.cat-right {
    animation: bounce-right 2s ease-in-out infinite 0.3s;
}

@keyframes bounce-right {

    0%,
    100% {
        transform: translateX(30px) translateY(0);
    }

    50% {
        transform: translateX(30px) translateY(-8px);
    }
}

/* ===== 標題區域 ===== */
.header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 50px;
    position: relative;
    z-index: 2;
}

.header h1 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 15px;
    font-weight: 700;
}

.header h1::before {
    content: '🌸 ';
}

.header h1::after {
    content: ' 🌸';
}

.header-inputs {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

/* 週選擇器樣式 */
.week-picker {
    padding: 8px 12px;
    border: 2px solid var(--mint);
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--white);
    cursor: pointer;
}

.week-picker:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 10px rgba(255, 183, 197, 0.5);
}

.week-range {
    font-size: 0.85rem;
    color: var(--coral);
    font-weight: 600;
}

/* 歷史選擇器 */
.history-select {
    padding: 8px 12px;
    border: 2px solid var(--blue);
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--white);
    cursor: pointer;
    min-width: 180px;
}

.history-select:focus {
    outline: none;
    border-color: var(--purple);
}

.goal-input {
    padding: 8px 15px;
    border: 2px solid var(--peach);
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--white);
    width: 200px;
}

.goal-input:focus {
    outline: none;
    border-color: var(--coral);
}

.goal-group label {
    background: linear-gradient(135deg, var(--coral), var(--peach));
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ===== 計劃表格 - 桌面版4列 ===== */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.day-card {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 3px solid;
}

.day-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* 每日顏色 - 可愛風格 */
.monday {
    border-color: var(--monday-color);
    background: var(--monday-light);
}

.tuesday {
    border-color: var(--tuesday-color);
    background: var(--tuesday-light);
}

.wednesday {
    border-color: var(--wednesday-color);
    background: var(--wednesday-light);
}

.thursday {
    border-color: var(--thursday-color);
    background: var(--thursday-light);
}

.friday {
    border-color: var(--friday-color);
    background: var(--friday-light);
}

.saturday {
    border-color: var(--saturday-color);
    background: var(--saturday-light);
}

.sunday {
    border-color: var(--sunday-color);
    background: var(--sunday-light);
}

.remarks {
    border-color: var(--remarks-color);
    background: var(--remarks-light);
}

.day-header {
    padding: 12px 15px;
    text-align: center;
}

.day-name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.day-date {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}

/* 日期前加上表情符號 */
.monday .day-name::before {
    content: '🔴 ';
}

.tuesday .day-name::before {
    content: '🟠 ';
}

.wednesday .day-name::before {
    content: '🟡 ';
}

.thursday .day-name::before {
    content: '🟢 ';
}

.friday .day-name::before {
    content: '🔵 ';
}

.saturday .day-name::before {
    content: '🟣 ';
}

.sunday .day-name::before {
    content: '💗 ';
}

.remarks .day-name::before {
    content: '📝 ';
}

.day-content {
    padding: 10px;
    background: var(--white);
}

.tasks {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.task-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    font-family: inherit;
    background: var(--white);
}

.task-input:focus {
    outline: none;
    border-color: var(--mint-dark);
    background: var(--mint-light);
}

.task-input::placeholder {
    color: #bbb;
}

/* ===== 計劃打卡區域 ===== */
.checkin-section {
    background: linear-gradient(135deg, var(--blue), #a5d8ff);
    border-radius: 20px;
    padding: 15px;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
    overflow-x: auto;
}

.checkin-header {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkin-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
}

.checkin-title::before {
    content: '✅ ';
}

.checkin-month {
    background: rgba(255, 255, 255, 0.3);
    padding: 4px 12px;
    border-radius: 15px;
    color: var(--white);
    font-weight: 600;
    font-size: 0.85rem;
}

/* 日期數字行 */
.checkin-numbers {
    display: flex;
    gap: 2px;
    margin-bottom: 3px;
}

.checkin-title-cell {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    padding: 5px;
    background: var(--white);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkin-num-cell {
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--white);
    border-radius: 6px;
    flex-shrink: 0;
}

.checkin-num-cell.week-1 {
    background: linear-gradient(135deg, #74c0fc, #a5d8ff);
}

.checkin-num-cell.week-2 {
    background: linear-gradient(135deg, #b197fc, #d0bfff);
}

.checkin-num-cell.week-3 {
    background: linear-gradient(135deg, #69db7c, #8ce99a);
}

/* 打卡目標行 */
.checkin-goals {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.checkin-goal-row {
    display: flex;
    gap: 2px;
}

.checkin-goal-input {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    padding: 5px;
    border: none;
    border-radius: 8px;
    font-size: 0.65rem;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
}

.checkin-goal-input:focus {
    outline: none;
    background: var(--white);
}

.checkin-goal-input::placeholder {
    color: #aaa;
}

.checkin-box {
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    height: 24px;
    background: var(--white);
    border: 1px solid rgba(200, 200, 200, 0.5);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkin-box:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.checkin-box.checked {
    background: linear-gradient(135deg, var(--coral), var(--peach));
    border-color: var(--coral);
}

.checkin-box.checked::after {
    content: '✓';
    color: var(--white);
    font-weight: bold;
    font-size: 0.7rem;
}

/* ===== 操作按鈕 ===== */
.actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    position: relative;
    z-index: 2;
}

.save-btn,
.clear-btn {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.save-btn {
    background: linear-gradient(135deg, var(--mint), var(--mint-dark));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(168, 230, 207, 0.5);
}

.save-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(168, 230, 207, 0.7);
}

.clear-btn {
    background: linear-gradient(135deg, #ff6b6b, #ff8787);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.clear-btn:hover {
    transform: translateY(-3px);
}

/* ===== 響應式設計 - 平板 ===== */
@media (max-width: 1100px) {
    .schedule-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header h1 {
        font-size: 1.8rem;
    }
}

/* ===== 響應式設計 - 手機版 ===== */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 20px;
    }

    /* 貓咪調整位置 */
    .cat {
        font-size: 35px;
        top: 3px;
    }

    .cat-left {
        transform: translateX(-50px);
    }

    .cat-right {
        transform: translateX(15px);
    }

    @keyframes bounce {

        0%,
        100% {
            transform: translateX(-50px) translateY(0);
        }

        50% {
            transform: translateX(-50px) translateY(-5px);
        }
    }

    @keyframes bounce-right {

        0%,
        100% {
            transform: translateX(15px) translateY(0);
        }

        50% {
            transform: translateX(15px) translateY(-5px);
        }
    }

    .decoration {
        width: 60px;
        height: 80px;
    }

    .header {
        padding-top: 40px;
    }

    .header h1 {
        font-size: 1.4rem;
        margin-bottom: 12px;
    }

    .header-inputs {
        flex-direction: column;
        gap: 10px;
    }

    .input-group {
        width: 100%;
        justify-content: center;
    }

    .week-picker,
    .history-select,
    .goal-input {
        width: 100%;
        max-width: 200px;
    }

    /* 手機版橫向滑動佈局 (Swiper Style) */
    .schedule-grid {
        display: flex;
        overflow-x: auto;
        gap: 15px;
        padding: 5px 10px 20px 10px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        grid-template-columns: none;
        scrollbar-width: none;
        /* Firefox 隱藏滾動條 */
    }

    .schedule-grid::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari 隱藏滾動條，讓畫面更乾淨 */
    }

    .day-card {
        min-width: 88vw;
        /* 使用視窗寬度確保對齊 */
        flex-shrink: 0;
        scroll-snap-align: center;
        border-radius: 20px;
        border-width: 3px;
        margin: 5px 0;
    }

    .day-header {
        padding: 8px 10px;
    }

    .day-name {
        font-size: 0.8rem;
    }

    .day-name::before {
        font-size: 0.7rem;
    }

    .day-date {
        font-size: 0.75rem;
    }

    .day-content {
        padding: 8px;
    }

    .task-input {
        padding: 6px 10px;
        font-size: 0.75rem;
        border-radius: 10px;
    }

    /* 打卡區域手機版 */
    .checkin-section {
        padding: 12px;
        border-radius: 15px;
    }

    .checkin-header {
        flex-wrap: wrap;
    }

    .checkin-title {
        font-size: 0.9rem;
    }

    .checkin-month {
        font-size: 0.75rem;
        padding: 3px 10px;
    }

    .checkin-title-cell,
    .checkin-goal-input {
        width: 55px;
        min-width: 55px;
        max-width: 55px;
        font-size: 0.55rem;
    }

    .checkin-num-cell,
    .checkin-box {
        width: 20px;
        min-width: 20px;
        max-width: 20px;
        height: 20px;
        font-size: 0.55rem;
    }

    .checkin-box.checked::after {
        font-size: 0.6rem;
    }

    /* 按鈕 */
    .actions {
        flex-direction: row;
        gap: 10px;
    }

    .save-btn,
    .clear-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        border-radius: 20px;
    }
}

/* ===== 超小螢幕 ===== */
@media (max-width: 380px) {
    .schedule-grid {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .cat {
        font-size: 28px;
    }
}

/* ===== 提示訊息 ===== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--mint-dark), var(--mint));
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    box-shadow: var(--shadow-hover);
    font-weight: 600;
    z-index: 1000;
    animation: slideUp 0.3s ease, fadeOut 0.3s ease 2.7s;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}