/**
 * Koizumi 記帳本 - 主要樣式表
 * 
 * 設計理念：
 * - 採用動物森友會遊戲中溫馨可愛的配色
 * - 圓角設計營造柔和感
 * - 日夜模式切換增加沉浸感
 * - 響應式設計支援電腦和手機
 */

/* ====================================
   CSS 變數 - 動物森友會溫暖風格
   ==================================== */
:root {
    /* 日間模式配色 - 動物森友會溫暖風格 */
    --ac-cream: #FFF8E7;
    /* 溫暖奶油色背景 */
    --ac-mint: #7DD3C0;
    /* 薄荷綠 - 更亮 */
    --ac-sky: #9BD5E8;
    /* 天空藍 - 更亮 */
    --ac-grass: #8FD694;
    /* 草地綠 - 更亮 */
    --ac-sand: #FFF5E1;
    /* 沙灘暖黃 */
    --ac-leaf: #5DBE6E;
    /* 樹葉綠 */
    --ac-ocean: #6BB8D0;
    /* 海洋藍 - 更亮 */
    --ac-sunset: #FFB366;
    /* 日落橙 - 更溫暖 */
    --ac-cherry: #FFCCD5;
    /* 櫻花粉 - 更淡 */
    --ac-brown: #9B8567;
    /* 木質棕 */

    /* 文字顏色 - 溫暖棕色 */
    --text-primary: #6B5A45;
    /* 主要文字 - 溫暖棕色 */
    --text-secondary: #8B7A65;
    /* 次要文字 */
    --text-light: #A89B8A;
    /* 淺色文字 */

    /* 功能色 - 更明亮 */
    --success: #7DD694;
    --warning: #FFB366;
    --danger: #FF8080;
    --info: #7DD3C0;

    /* 鈴錢金色 - 動森經典金 */
    --bells-gold: #FFD93D;
    --bells-shadow: #F5C518;

    /* 陰影 - 溫暖柔和 */
    --shadow-sm: 0 2px 8px rgba(139, 115, 85, 0.1);
    --shadow-md: 0 4px 16px rgba(139, 115, 85, 0.12);
    --shadow-lg: 0 8px 32px rgba(139, 115, 85, 0.15);

    /* 圓角 - 圓潤可愛 */
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* 動畫時間 */
    --transition-fast: 0.15s;
    --transition-normal: 0.3s;
    --transition-slow: 0.5s;

    /* 背景 - 溫暖明亮 */
    --bg-primary: #FFF8E7;
    --bg-secondary: #FFFDF5;
    --bg-card: #FFFFFF;

    /* 邊框 - 淡暖色 */
    --border-color: #F0E6D8;
}

/* 夜間模式配色 - 動物森友會溫暖夜晚 */
.night-mode {
    --ac-cream: #3D4F5F;
    --ac-mint: #5EC4B6;
    --ac-sky: #6BB8D0;
    --ac-grass: #6BCB77;
    --ac-sand: #4A5A68;

    --text-primary: #F5F0E8;
    --text-secondary: #D4CFC5;
    --text-light: #A8A095;

    --bg-primary: #2D3E4A;
    --bg-secondary: #3A4D5C;
    --bg-card: #445566;

    --border-color: #5A6A78;

    /* 鈴錢金色保持明亮 */
    --bells-gold: #FFD93D;
    --bells-shadow: #F5C518;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* 夜間模式下的標題和內容樣式 */
.night-mode .record-card h3,
.night-mode .card-body h3,
.night-mode .card-header h3 {
    color: var(--text-primary);
}

.night-mode .record-card .note,
.night-mode .card-body p {
    color: var(--text-secondary);
}

.night-mode .record-card .date {
    color: var(--text-light);
}

.night-mode .tag {
    background: linear-gradient(135deg, #7A5A8A, #9A7A6A);
}

/* ====================================
   基礎重置與字型
   ==================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ====================================
   背景裝飾 - 動森風格
   ==================================== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(152, 216, 200, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(135, 206, 235, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(144, 238, 144, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.night-mode body::before {
    background-image:
        radial-gradient(circle at 10% 20%, rgba(26, 188, 156, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(52, 152, 219, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(39, 174, 96, 0.05) 0%, transparent 70%);
}

/* ====================================
   連結樣式
   ==================================== */
a {
    color: var(--ac-ocean);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--ac-leaf);
}

/* ====================================
   容器
   ==================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    width: 100%;
    padding: 0 20px;
}

/* ====================================
   導航列 - UI Style Museum 風格
   ==================================== */
.navbar {
    background: var(--bg-card);
    padding: 15px 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

.navbar-brand .icon {
    font-size: 2rem;
}

.navbar-nav {
    display: flex;
    gap: 8px;
    list-style: none;
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: var(--radius-xl);
}

.nav-link {
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--ac-mint);
    color: #FFFFFF;
    box-shadow: var(--shadow-sm);
}

/* ====================================
   手機版底部導航列 - 動物森友會溫暖風格
   ==================================== */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, var(--ac-mint), var(--ac-ocean));
    display: flex;
    justify-content: space-around;
    padding: 12px 0 8px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.7rem;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.mobile-nav-item .icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.25);
}

/* ====================================
   卡片樣式 - UI Style Museum 風格
   ==================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: var(--bg-secondary);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: var(--bg-secondary);
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* 記帳卡片特殊樣式 */
.record-card {
    margin-bottom: 15px;
    position: relative;
}

.record-card .amount {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.record-card .amount.expense {
    color: var(--danger);
}

.record-card .amount.income {
    color: var(--ac-leaf);
}

.record-card .amount::before {
    content: '🔔';
    font-size: 1.2rem;
}

.record-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    background: linear-gradient(135deg, var(--ac-cherry), var(--ac-sunset));
    color: #FFFFFF;
    padding: 4px 12px;
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.record-card .note {
    color: var(--text-secondary);
    margin-top: 10px;
    font-size: 0.9rem;
}

.record-card .date {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 10px;
}

.record-card .images {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.record-card .images img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.record-card .images img:hover {
    transform: scale(1.1);
}

/* ====================================
   按鈕樣式 - UI Style Museum 風格
   ==================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-normal);
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--ac-mint);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: #45B8AC;
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger);
    color: #FFFFFF;
}

.btn-danger:hover {
    background: #E55555;
    box-shadow: var(--shadow-md);
}

.btn-gold {
    background: var(--bells-gold);
    color: #FFFFFF;
}

.btn-gold:hover {
    background: var(--bells-shadow);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
}

/* 浮動新增按鈕 */
.fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    z-index: 100;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ====================================
   表單樣式 - UI Style Museum 風格
   ==================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    background-color: var(--bg-card);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--ac-mint);
    box-shadow: 0 0 0 4px rgba(78, 205, 196, 0.15);
}

.form-control::placeholder {
    color: var(--text-light);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ====================================
   日期選擇器 - 動物森友會風格
   ==================================== */

/* 輸入框樣式 */
.ac-date-picker {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
    border: 2px solid var(--ac-mint);
    font-weight: 500;
    cursor: pointer;
    position: relative;
}

.ac-date-picker:focus {
    border-color: var(--ac-leaf);
    box-shadow: 0 0 0 4px rgba(93, 190, 110, 0.2);
}

/* 日曆彈窗 */
.ac-datepicker {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--ac-mint);
    width: 320px;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 日曆標題列 */
.ac-datepicker-header {
    background: linear-gradient(135deg, var(--ac-mint), var(--ac-grass));
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #FFFFFF;
}

.ac-datepicker-title {
    font-size: 1.1rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.ac-datepicker-nav {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #FFFFFF;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.ac-datepicker-nav:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* 星期標題 */
.ac-datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 10px;
    background: var(--bg-secondary);
    border-bottom: 2px dashed var(--border-color);
}

.ac-datepicker-weekdays span {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 5px;
}

.ac-datepicker-weekdays span.weekend {
    color: var(--ac-sunset);
}

/* 日期格子 */
.ac-datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 10px;
}

.ac-datepicker-days span {
    text-align: center;
    padding: 10px 5px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    color: var(--text-primary);
}

.ac-datepicker-days span:hover:not(.other-month) {
    background: var(--ac-sand);
    transform: scale(1.1);
}

.ac-datepicker-days span.other-month {
    color: var(--text-light);
    cursor: default;
}

.ac-datepicker-days span.today {
    background: var(--ac-cherry);
    color: #FFFFFF;
    font-weight: bold;
}

.ac-datepicker-days span.selected {
    background: linear-gradient(135deg, var(--ac-mint), var(--ac-leaf));
    color: #FFFFFF;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(93, 190, 110, 0.4);
}

.ac-datepicker-days span.weekend:not(.other-month):not(.selected) {
    color: var(--ac-sunset);
}

/* 日曆底部 */
.ac-datepicker-footer {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: var(--bg-secondary);
    border-top: 2px dashed var(--border-color);
}

/* ====================================
   自訂彈出視窗 - 動森風格
   ==================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 4px solid var(--ac-mint);
    max-width: 90%;
    min-width: 400px;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.8);
    transition: transform var(--transition-normal);
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    background: linear-gradient(135deg, var(--ac-mint), var(--ac-sky));
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #FFFFFF;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 2px dashed var(--border-color);
}

/* ====================================
   Alert/Confirm 彈出視窗 - 動森風格
   ==================================== */
.ac-alert {
    max-width: 400px;
    text-align: center;
}

.ac-alert .modal-body {
    padding: 30px;
}

.ac-alert-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.ac-alert-message {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* ====================================
   計算機彈出視窗 - 動森風格
   ==================================== */
.calculator {
    max-width: 350px;
}

.calculator-display {
    background: linear-gradient(135deg, #2C3E50, #34495E);
    color: var(--bells-gold);
    font-size: 2rem;
    font-weight: bold;
    text-align: right;
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.calculator-display::before {
    content: '🔔 ';
    font-size: 1.5rem;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.calc-btn {
    padding: 15px;
    font-size: 1.25rem;
    font-weight: bold;
    border: 3px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calc-btn.number {
    background: var(--bg-card);
    color: var(--text-primary);
}

.calc-btn.number:hover {
    background: var(--ac-sand);
}

.calc-btn.operator {
    background: linear-gradient(135deg, var(--ac-sunset), var(--warning));
    color: #FFFFFF;
}

.calc-btn.operator:hover {
    transform: scale(1.05);
}

.calc-btn.clear {
    background: linear-gradient(135deg, var(--danger), #FF8E8E);
    color: #FFFFFF;
}

.calc-btn.enter {
    background: linear-gradient(135deg, var(--ac-mint), var(--ac-grass));
    color: #FFFFFF;
    grid-column: span 2;
}

/* ====================================
   儲蓄目標進度條 - 房貸風格
   ==================================== */
.savings-goal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 15px;
    border: 3px solid var(--border-color);
}

.savings-goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.savings-goal-icon {
    font-size: 2rem;
}

.savings-goal-name {
    font-size: 1.1rem;
    font-weight: bold;
    flex: 1;
    margin-left: 10px;
}

.savings-goal-progress {
    height: 30px;
    background: linear-gradient(135deg, #E8DCC8, #D4C4A8);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    border: 2px solid var(--border-color);
}

.savings-goal-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, var(--bells-gold), var(--bells-shadow));
    border-radius: var(--radius-xl);
    transition: width var(--transition-slow);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.savings-goal-progress-bar::after {
    content: '🔔';
    position: absolute;
    right: 5px;
    animation: ring 1s infinite;
}

@keyframes ring {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(10deg);
    }

    75% {
        transform: rotate(-10deg);
    }
}

.savings-goal-progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    font-weight: bold;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.savings-goal-amounts {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.savings-goal.completed {
    border-color: var(--bells-gold);
    background: linear-gradient(135deg, #FFF8DC, #FFFACD);
}

.savings-goal.completed .savings-goal-name::after {
    content: ' ✨';
}

/* ====================================
   分頁元件
   ==================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 30px 0;
}

.page-btn {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-btn:hover {
    background: var(--ac-sand);
}

.page-btn.active {
    background: linear-gradient(135deg, var(--ac-mint), var(--ac-sky));
    color: #FFFFFF;
    border-color: var(--ac-ocean);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ====================================
   搜尋列
   ==================================== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar .form-control {
    flex: 1;
}

.search-bar .btn {
    flex-shrink: 0;
}

/* ====================================
   日夜模式切換按鈕 - Toggle 開關風格
   ==================================== */
.theme-toggle {
    position: fixed;
    bottom: 80px;
    left: 20px;
    width: 64px;
    height: 32px;
    border-radius: 16px;
    background: linear-gradient(135deg, #9BD5E8, #7DD3C0);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 太陽圖示 - 左側 */
.theme-toggle::before {
    content: '☀️';
    font-size: 0.9rem;
    z-index: 1;
}

/* 月亮圖示 - 右側 */
.theme-toggle::after {
    content: '🌙';
    font-size: 0.9rem;
    z-index: 1;
}

/* 滑動圓鈕 */
.toggle-knob {
    position: absolute;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFFFFF, #F0F0F0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: left 0.3s ease;
    z-index: 2;
}

/* 圓鈕樣式已在 .toggle-knob 定義 */

/* 夜晚模式時的樣式 */
body.night-mode .theme-toggle {
    background: linear-gradient(135deg, #3A4D5C, #2D3E4A);
}

body.night-mode .toggle-knob {
    left: 35px;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 隱藏按鈕內的文字 */
.theme-toggle-text {
    display: none;
}

/* ====================================
   載入動畫
   ==================================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--border-color);
    border-top-color: var(--ac-mint);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 15px;
    color: var(--text-secondary);
}

/* ====================================
   空狀態
   ==================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* ====================================
   登入頁面
   ==================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--ac-mint) 0%, var(--ac-sky) 50%, var(--ac-grass) 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 4px solid var(--bells-gold);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--ac-sand), var(--ac-cream));
    padding: 30px;
    text-align: center;
}

.login-logo {
    font-size: 4rem;
    margin-bottom: 10px;
}

.login-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-body {
    padding: 30px;
}

.login-error {
    background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
    color: #C62828;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #EF9A9A;
}

.login-locked {
    background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
    color: #E65100;
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 2px solid #FFCC80;
}

/* ====================================
   統計圖表區域 - 大頭菜風格
   ==================================== */
.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    border: 3px solid var(--border-color);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-title::before {
    content: '📊';
}

.month-selector {
    padding: 8px 16px;
    border: 3px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stats-item {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 2px solid var(--border-color);
}

.stats-item-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stats-item-value {
    font-size: 1.3rem;
    font-weight: bold;
}

.stats-item-value.expense {
    color: var(--danger);
}

.stats-item-value.income {
    color: var(--ac-leaf);
}

.stats-item-value.balance {
    color: var(--ac-ocean);
}

/* ====================================
   響應式設計 - 手機版
   ==================================== */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 15px;
    }

    .navbar {
        padding: 10px 0;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .card-body {
        padding: 15px;
    }

    .stats-summary {
        grid-template-columns: 1fr;
    }

    .fab {
        bottom: 90px;
        right: 15px;
        width: 50px;
        height: 50px;
    }

    .theme-toggle {
        bottom: 100px;
        left: 15px;
        width: 56px;
        height: 28px;
        border-radius: 14px;
        padding: 0 6px;
    }

    .theme-toggle::before {
        font-size: 0.8rem;
    }

    .theme-toggle::after {
        font-size: 0.8rem;
    }

    .theme-toggle .toggle-knob {
        display: block;
        width: 22px;
        height: 22px;
        left: 3px;
    }

    body.night-mode .theme-toggle .toggle-knob {
        left: 31px;
    }

    /* 手機版內容區域需留給底部導航空間 */
    .main-content {
        padding-bottom: 80px;
    }

    /* 手機版彈窗寬度調整 */
    .modal {
        min-width: auto;
        width: 92%;
    }
}

/* ====================================
   電腦版側邊欄
   ==================================== */
@media (min-width: 992px) {
    .desktop-layout {
        display: grid;
        grid-template-columns: 280px 1fr;
        min-height: calc(100vh - 70px);
    }

    .sidebar {
        background: var(--bg-card);
        border-right: 3px solid var(--border-color);
        padding: 20px;
        position: sticky;
        top: 70px;
        height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .sidebar-section {
        margin-bottom: 25px;
    }

    .sidebar-title {
        font-size: 0.9rem;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .main-content {
        padding: 20px;
    }
}

/* ====================================
   工具提示
   ==================================== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-card);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ====================================
   圖片檢視器
   ==================================== */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.image-viewer.show {
    opacity: 1;
    visibility: visible;
}

.image-viewer img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius-md);
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #FFFFFF;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.4);
}