/* ===== 天人玄學院 前台專用 CSS — 學院風（強化版） ===== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@400;500;600;700;900&family=Noto+Sans+TC:wght@300;400;500;700&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    /* 學院主色 — 深藍學袍色 */
    --brand-primary: #1a3a5c;
    --brand-accent: #b8923c;
    --brand-accent-light: #d4b86a;
    --brand-accent-dark: #8a6d2a;
    --brand-ivory: #faf8f3;
    --brand-cream: #f5f0e6;
    --brand-parchment: #f7f3ea;
    --brand-dark: #0f1e30;
    --brand-deep: #0a1520;
    --brand-burgundy: #6b2737;
    --brand-forest: #2d4a3e;
    /* 文字色 */
    --text-dark: #1a1a1a;
    --text-body: #3a3a3a;
    --text-muted: #7a7a7a;
    --text-light: #9a9a9a;
    /* 邊框色 */
    --border-gold: #c9b988;
    --border-gold-light: #e0d5b0;
    --border-light: #e8e4dc;
    --border-medium: #d0ccc4;
    /* 陰影 */
    --shadow-soft: 0 2px 12px rgba(26,58,92,0.06);
    --shadow-card: 0 4px 20px rgba(26,58,92,0.05);
    --shadow-hover: 0 10px 36px rgba(26,58,92,0.12);
    --shadow-deep: 0 8px 32px rgba(10,21,32,0.18);
    /* 字型 */
    --font-serif: 'Noto Serif TC', 'STSong', 'SimSun', serif;
    --font-sans: 'Noto Sans TC', 'PingFang SC', 'Microsoft JhengHei', sans-serif;
    --font-latin: 'Cormorant Garamond', 'Noto Serif TC', serif;
    /* 圓角 */
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 10px;
}

/* ===== 基礎重置 ===== */
* { box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background-color: var(--brand-ivory);
    background-image:
        radial-gradient(ellipse at top, rgba(184,146,60,0.03) 0%, transparent 60%),
        radial-gradient(ellipse at bottom, rgba(26,58,92,0.02) 0%, transparent 60%);
    color: var(--text-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.75;
    letter-spacing: 0.02em;
}

main { flex: 1 0 auto; }

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--brand-accent-dark); }

/* ===== 排版 ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--brand-primary);
    letter-spacing: 0.04em;
    line-height: 1.4;
}

h1 { font-weight: 700; }
h2 { font-weight: 700; }
h3 { font-weight: 600; }

p { margin-bottom: 1rem; }

.text-brand-accent { color: var(--brand-accent) !important; }
.text-brand-primary { color: var(--brand-primary) !important; }

/* ===== 裝飾線與標題 ===== */
.divider-gold {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 24px 0;
}
.divider-gold::before,
.divider-gold::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
}
.divider-gold span {
    padding: 0 20px;
    color: var(--brand-accent);
    font-family: var(--font-serif);
    font-size: 0.88rem;
    letter-spacing: 0.25em;
    font-weight: 500;
    white-space: nowrap;
}

/* 學院風標題裝飾 */
.section-title {
    text-align: center;
    margin-bottom: 16px;
    position: relative;
    font-size: 1.85rem;
}
.section-title::after {
    content: '';
    display: block;
    width: 56px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
    margin: 14px auto 0;
    border-radius: 2px;
}
.section-title::before {
    content: '◆';
    display: block;
    font-size: 0.6rem;
    color: var(--brand-accent);
    margin-bottom: 8px;
    letter-spacing: 0;
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 48px;
    letter-spacing: 0.06em;
}

/* 學院卷標 */
.academy-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-serif);
    font-size: 0.82rem;
    color: var(--brand-accent);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 500;
}
.academy-label::before,
.academy-label::after {
    content: '';
    width: 24px;
    height: 1px;
    background: var(--border-gold);
}

/* ===== 導覽列 ===== */
#mainNavbar {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-dark) 100%);
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
    border-bottom: 2px solid var(--brand-accent);
    transition: all 0.3s ease;
}

.navbar-emblem {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    border: 2px solid var(--brand-accent-light);
    box-shadow: 0 0 0 1px rgba(184,146,60,0.2), 0 2px 8px rgba(0,0,0,0.2);
}

.brand-text {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.navbar-nav .nav-link {
    color: rgba(255,255,255,0.80);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    transition: all 0.25s ease;
    font-size: 0.90rem;
    font-weight: 400;
    white-space: nowrap;
    letter-spacing: 0.05em;
    position: relative;
}

.navbar-nav .nav-link:hover {
    color: var(--brand-accent-light);
    background: rgba(255,255,255,0.05);
}

.navbar-nav .nav-link.active {
    color: var(--brand-accent-light);
    font-weight: 500;
}
.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 18px;
    right: 18px;
    height: 2px;
    background: var(--brand-accent);
    border-radius: 1px;
}

#mainNavbar.navbar-scrolled {
    background: rgba(15,30,48,0.96);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.nav-label {
    margin-left: 4px;
}

/* 手機導覽列 */
@media (max-width: 991px) {
    .navbar-nav .nav-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 18px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        border-radius: 0;
    }
    .navbar-nav .nav-link.active::after {
        display: none;
    }
}

/* ===== Hero 區塊 ===== */
.hero-section {
    background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand-primary) 50%, var(--brand-dark) 100%);
    color: #fff;
    padding: 90px 0 110px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('https://www.fate-academy.com/cm/html/school_emblem.jpeg');
    background-size: 460px;
    background-position: right -120px center;
    background-repeat: no-repeat;
    opacity: 0.05;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--brand-accent), var(--brand-accent-light), var(--brand-accent), transparent);
}

.hero-title {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: 0.15em;
    text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.hero-subtitle {
    font-family: var(--font-latin);
    font-size: 1.2rem;
    color: var(--brand-accent-light);
    margin-bottom: 32px;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.06em;
}

.hero-divider {
    width: 64px;
    height: 3px;
    background: var(--brand-accent);
    margin: 28px 0;
    position: relative;
}
.hero-divider::before,
.hero-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border: 1.5px solid var(--brand-accent);
    transform: translateY(-50%) rotate(45deg);
}
.hero-divider::before { left: -16px; }
.hero-divider::after { right: -16px; }

.hero-motto {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    color: rgba(255,255,255,0.72);
    font-style: italic;
    margin-top: 18px;
    letter-spacing: 0.3em;
}

/* ===== 卡片通用 ===== */
.card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: transform 0.3s cubic-bezier(0.25,0.46,0.45,0.94), box-shadow 0.3s;
    overflow: hidden;
}

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

.card-title {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--brand-primary);
}

/* 課程卡片 */
.course-card {
    height: 100%;
    border-top: 3px solid var(--brand-accent);
}
.course-card .card-img-top {
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-light);
}
.course-card .card-body {
    padding: 22px;
}
.course-card .course-code {
    font-family: var(--font-latin);
    font-size: 0.78rem;
    color: var(--brand-accent);
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.course-card .course-title {
    font-size: 1.15rem;
    margin: 8px 0 12px;
}
.course-card .course-meta {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.9;
}
.course-card .course-price {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    color: var(--brand-primary);
    font-weight: 700;
}

/* 導師卡片 */
.tutor-card {
    text-align: center;
    height: 100%;
    border-top: 3px solid var(--brand-accent);
}
.tutor-card .tutor-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 22px auto 14px;
    border: 3px solid var(--border-gold);
    box-shadow: 0 0 0 4px rgba(184,146,60,0.08);
}
.tutor-card .tutor-name {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}
.tutor-card .tutor-title {
    font-family: var(--font-latin);
    font-size: 0.82rem;
    color: var(--brand-accent);
    margin-bottom: 10px;
    letter-spacing: 0.1em;
    font-style: italic;
}
.tutor-card .tutor-bio {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* 文章卡片 */
.article-card {
    height: 100%;
}
.article-card .card-img-top {
    height: 200px;
    object-fit: cover;
}
.article-card .article-category {
    display: inline-block;
    font-size: 0.74rem;
    color: var(--brand-accent);
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.article-card .article-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brand-primary);
    margin-bottom: 8px;
    letter-spacing: 0.03em;
}
.article-card .article-excerpt {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.7;
}
.article-card .article-meta {
    font-size: 0.78rem;
    color: var(--text-light);
}

/* ===== 統計數字 ===== */
.stats-section {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-dark) 100%);
    color: #fff;
    padding: 64px 0;
    position: relative;
}
.stats-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
}
.stats-section::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
}
.stat-item {
    text-align: center;
    position: relative;
}
.stat-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    bottom: 25%;
    width: 1px;
    background: rgba(255,255,255,0.1);
}
@media (max-width: 768px) {
    .stat-item:not(:last-child)::after { display: none; }
}
.stat-number {
    font-family: var(--font-serif);
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--brand-accent-light);
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.stat-label {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.65);
    margin-top: 6px;
    letter-spacing: 0.1em;
}

/* ===== 課程詳情 ===== */
.course-detail-header {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-dark));
    color: #fff;
    padding: 64px 0 44px;
    position: relative;
    overflow: hidden;
}
.course-detail-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
}
.course-detail-header h1 {
    color: #fff;
    letter-spacing: 0.1em;
}

.course-info-box {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 32px;
    box-shadow: var(--shadow-card);
    border-top: 4px solid var(--brand-accent);
}
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
}
.info-row:last-child { border-bottom: none; }
.info-label {
    color: var(--text-muted);
    font-size: 0.88rem;
    letter-spacing: 0.05em;
}
.info-value {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.92rem;
}

/* ===== 月曆 ===== */
.calendar-grid {
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.calendar-grid th {
    background: var(--brand-primary);
    color: #fff;
    padding: 14px;
    text-align: center;
    font-weight: 500;
    font-size: 0.88rem;
    letter-spacing: 0.05em;
}
.calendar-grid td {
    padding: 10px;
    vertical-align: top;
    border: 1px solid var(--border-light);
    min-height: 80px;
    height: 80px;
    width: calc(100% / 7);
}
.calendar-event {
    background: var(--brand-cream);
    border-left: 3px solid var(--brand-accent);
    padding: 4px 8px;
    font-size: 0.80rem;
    margin: 2px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-dark);
    line-height: 1.5;
}

/* ===== 學員專區 ===== */
.dashboard-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 26px;
    box-shadow: var(--shadow-card);
    border-top: 3px solid var(--brand-accent);
    margin-bottom: 20px;
    transition: transform 0.25s, box-shadow 0.25s;
}
.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.dashboard-card .icon {
    font-size: 2rem;
    color: var(--brand-accent);
}
.dashboard-card .label {
    color: var(--text-muted);
    font-size: 0.84rem;
    margin-top: 8px;
    letter-spacing: 0.05em;
}
.dashboard-card .value {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--brand-primary);
}

/* ===== 表單 ===== */
.form-control, .form-select {
    border-color: var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.92rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 0.15rem rgba(184,146,60,0.12);
    background: #fff;
}
.form-label {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 6px;
    font-size: 0.90rem;
    letter-spacing: 0.03em;
}

/* ===== 按鈕 ===== */
.btn-brand {
    background: var(--brand-primary);
    color: #fff;
    border: 1px solid var(--brand-primary);
    border-radius: var(--radius-sm);
    padding: 10px 30px;
    font-weight: 500;
    font-size: 0.92rem;
    letter-spacing: 0.05em;
    transition: all 0.25s;
}
.btn-brand:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: var(--brand-accent-light);
    box-shadow: 0 4px 12px rgba(26,58,92,0.2);
}

.btn-accent {
    background: var(--brand-accent);
    color: #fff;
    border: 1px solid var(--brand-accent);
    border-radius: var(--radius-sm);
    padding: 10px 30px;
    font-weight: 500;
    font-size: 0.92rem;
    letter-spacing: 0.05em;
    transition: all 0.25s;
}
.btn-accent:hover {
    background: var(--brand-accent-dark);
    border-color: var(--brand-accent-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(184,146,60,0.25);
}

.btn-outline-brand {
    background: transparent;
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
    border-radius: var(--radius-sm);
    padding: 10px 30px;
    font-weight: 500;
    font-size: 0.92rem;
    letter-spacing: 0.05em;
    transition: all 0.25s;
}
.btn-outline-brand:hover {
    background: var(--brand-primary);
    color: #fff;
}

.btn-outline-light {
    border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
}

/* ===== 頁尾 ===== */
.footer {
    background: var(--brand-deep);
    color: rgba(255,255,255,0.65);
    border-top: 3px solid var(--brand-accent);
    position: relative;
}
.footer::before {
    content: '';
    position: absolute;
    top: 3px; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(184,146,60,0.3), transparent);
}
.footer h5, .footer h6 {
    color: #fff;
    font-family: var(--font-serif);
    letter-spacing: 0.08em;
}
.footer h6 {
    font-size: 0.82rem;
    text-transform: uppercase;
    color: var(--brand-accent-light);
    font-weight: 500;
}
.footer-link {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.88rem;
}
.footer-link:hover {
    color: var(--brand-accent-light);
}
.footer-divider {
    border-color: rgba(255,255,255,0.06);
    margin: 24px 0;
}

/* ===== 區塊間距 ===== */
.section-pad { padding: 64px 0; }
.section-pad-sm { padding: 44px 0; }

/* ===== 標籤 ===== */
.badge-brand {
    background: var(--brand-primary);
    color: #fff;
    font-weight: 400;
    letter-spacing: 0.05em;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}
.badge-accent {
    background: var(--brand-accent);
    color: #fff;
    font-weight: 400;
    letter-spacing: 0.05em;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}
.badge-light-brand {
    background: var(--brand-cream);
    color: var(--brand-primary);
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

/* ===== 分頁 ===== */
.page-item .page-link {
    color: var(--brand-primary);
    border-color: var(--border-medium);
    padding: 8px 14px;
    font-size: 0.90rem;
    border-radius: var(--radius-sm);
    margin: 0 2px;
}
.page-item.active .page-link {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}
.page-item .page-link:hover {
    background: var(--brand-cream);
    color: var(--brand-dark);
}

/* ===== 列表群組 ===== */
.list-group-item {
    border-color: var(--border-light);
    padding: 14px 16px;
}

/* ===== 輸入群組（登入/註冊用）===== */
.input-group-text {
    background: var(--brand-cream);
    border-color: var(--border-medium);
    color: var(--text-muted);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-group .form-control {
    border-radius: 0;
}
.input-group .form-control:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.input-group .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.alert {
    border-radius: var(--radius-sm);
    font-size: 0.90rem;
}
.alert-light {
    background: var(--brand-cream);
}

/* ===== 響應式 ===== */
@media (max-width: 768px) {
    .hero-title { font-size: 1.9rem; letter-spacing: 0.1em; }
    .hero-subtitle { font-size: 1rem; }
    .hero-motto { font-size: 1.1rem; letter-spacing: 0.2em; }
    .hero-section { padding: 52px 0 68px; }
    .section-pad { padding: 42px 0; }
    .section-title { font-size: 1.5rem; }
    .navbar-emblem { width: 34px; height: 34px; }
    .brand-text { font-size: 1.08rem; }
    .stat-number { font-size: 1.9rem; }
    .course-info-box { padding: 22px; }
    .divider-gold span { font-size: 0.80rem; letter-spacing: 0.18em; }
}

/* ===== 觸控友善 ===== */
@media (pointer: coarse) {
    .nav-link, .btn { min-height: 44px; }
    .card { cursor: pointer; }
    .form-control, .form-select { font-size: 16px; }
}

/* ===== 動畫 ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeInUp 0.5s ease backwards; }
.col-md-6.col-lg-4:nth-child(1) .card { animation-delay: 0.05s; }
.col-md-6.col-lg-4:nth-child(2) .card { animation-delay: 0.10s; }
.col-md-6.col-lg-4:nth-child(3) .card { animation-delay: 0.15s; }
.col-md-6.col-lg-4:nth-child(4) .card { animation-delay: 0.20s; }
.col-md-6.col-lg-4:nth-child(5) .card { animation-delay: 0.25s; }
.col-md-6.col-lg-4:nth-child(6) .card { animation-delay: 0.30s; }
