/* 基礎變數與重設 */
:root {
    --primary-color: #06c755; /* LINE Green */
    --secondary-color: #333333;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333;
    --text-muted: #666;
    --border-color: #e9ecef;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding-bottom: 20px;
}

/* 頁面切換動畫 */
.page {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
}

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

/* 按鈕樣式 */
.btn {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: #e9ecef;
    color: var(--text-color);
}

.btn-line {
    background-color: #06c755;
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    width: auto;
    display: inline-block;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
}

/* 卡片與元件 */
.message {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.message-info { background-color: #e7f3ff; color: #004085; }
.message-success { background-color: #d4edda; color: #155724; }
.message-warning { background-color: #fff3cd; color: #856404; }

.header {
    background-color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin: -20px -20px 20px -20px;
}

.header-title {
    font-size: 18px;
    font-weight: bold;
}

.user-info {
    display: flex;
    align-items: center;
    font-size: 14px;
}

/* 登入日曆 */
.login-calendar {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.calendar-header {
    text-align: center;
    font-weight: bold;
    margin-bottom: 10px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day-label {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 50%;
}

.calendar-day.logged {
    background-color: var(--primary-color);
    color: white;
}

.calendar-day.today {
    border: 2px solid var(--primary-color);
}

/* 書櫃樣式 */
.bookshelf {
    background-color: #8b4513;
    padding: 20px 10px;
    border-radius: 8px;
}

.shelf {
    display: flex;
    justify-content: space-around;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 8px solid #a0522d;
}

.book {
    width: 60px;
    height: 90px;
    background-color: #fdf5e6;
    border-radius: 4px 12px 12px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    font-size: 12px;
    text-align: center;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    position: relative;
}

.book-title {
    font-weight: bold;
    writing-mode: vertical-rl;
}

.book-progress-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 10px;
}

/* 經典卡片 */
.classic-card {
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.classic-name { font-weight: bold; font-size: 18px; }
.classic-meta { font-size: 14px; color: var(--text-muted); margin: 5px 0; }

/* 閱讀介面 */
.scripture-section {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 5px solid transparent;
    transition: all 0.3s;
}

.scripture-section.completed {
    border-left-color: var(--primary-color);
    background-color: #f0fff4;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-content {
    font-size: 18px;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.complete-badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #ddd;
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s;
}

/* 載入中 */
.loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
}

.loading.active {
    visibility: visible;
    opacity: 1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-20 { margin-bottom: 20px; }
.divider { border: none; border-top: 1px solid var(--border-color); margin: 15px 0; }

.env-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
}

.env-liff { background-color: #06c755; color: white; }
.env-web { background-color: #6c757d; color: white; }

/* 簽到卡片 */
.checkin-card {
    background: linear-gradient(135deg, #06c755, #05a346);
    color: white;
    padding: 30px 20px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 20px;
}

.checkin-date { font-size: 20px; margin-bottom: 10px; }
.checkin-streak { font-size: 18px; font-weight: bold; }

/* 選單卡片 */
.menu-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.menu-icon { font-size: 30px; margin-right: 15px; }
.menu-title { font-weight: bold; font-size: 18px; flex-grow: 1; }
.menu-desc { font-size: 14px; color: var(--text-muted); }

/* 統計卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value { font-size: 24px; font-weight: bold; color: var(--primary-color); }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* 計時器卡片 */
.timer-card {
    background: #333;
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 20px;
}

.timer-display { font-size: 36px; font-family: monospace; margin: 10px 0; }

.record-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #06c755;
}

.record-date { font-weight: bold; font-size: 14px; }
.record-details { font-size: 13px; color: var(--text-muted); }

/* 完成卡片 */
.completion-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    margin: 40px 0;
    border: 3px solid #06c755;
}

.completion-card-icon { font-size: 80px; margin-bottom: 20px; }
.completion-card-title { font-size: 28px; font-weight: bold; color: #06c755; margin-bottom: 15px; }
.completion-card-message { font-size: 18px; color: #333; margin-bottom: 30px; }
.completion-card-stats { display: flex; justify-content: space-around; margin-bottom: 30px; }
.btn-return-home { background: #06c755; color: white; padding: 15px 30px; border-radius: 50px; border: none; font-size: 18px; font-weight: bold; margin: 10px; cursor: pointer; }
.btn-continue-learning { background: #fff; color: #06c755; border: 2px solid #06c755; padding: 15px 30px; border-radius: 50px; font-size: 18px; font-weight: bold; margin: 10px; cursor: pointer; }
