/* --- 原始典雅風格設定 --- */
:root {
    --bg-color: #fdfbf7; /* 溫暖的米白色背景 */
    --card-bg: #ffffff;
    --text-color: #2d3748;
    --accent-color: #4a5568;
    --border-color: #e2e8f0;
    --font-heading: 'Playfair Display', 'Noto Sans TC', serif;
    --font-body: 'Noto Sans TC', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.8;
}

/* --- 容器與通用 --- */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- 導覽列 --- */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1.2rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-weight: 500;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.btn-text {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: #718096;
    padding: 4px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-text:hover {
    color: var(--text-color);
    background-color: #edf2f7;
}

.btn-text.logged-in {
    color: #e53e3e;
}

/* --- 頁首 --- */
header {
    background: linear-gradient(135deg, #f7f3ec 0%, #fdfbf7 100%);
    padding: 4.5rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.header-content h1 {
    font-family: var(--font-heading);
    font-size: 2.6rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.header-sub {
    font-size: 1.8rem;
    color: #555;
}

.decorative-line {
    width: 50px;
    height: 2px;
    background-color: #cbd5e0;
    margin: 0 auto 1.2rem auto;
}

.header-content p {
    color: #718096;
    font-size: 1.05rem;
    letter-spacing: 1px;
}

/* --- 發文表單區塊 --- */
.editor-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2.5rem;
    margin: 3rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.admin-badge {
    background-color: #feebc8;
    color: #c05621;
    font-size: 0.85rem;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.form-group {
    margin-top: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    color: #4a5568;
}

.form-group input[type="text"],
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-body);
    background-color: #faf8f5;
}

.form-group input:focus, .form-select:focus {
    outline: none;
    border-color: #a0aec0;
    background-color: #fff;
}

/* --- 上傳進度條樣式 --- */
.progress-container {
    margin-top: 1.5rem;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    border-radius: 6px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #4a5568;
    margin-bottom: 8px;
    font-weight: 500;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: #edf2f7;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background-color: #3182ce;
    transition: width 0.2s ease-in-out;
    border-radius: 4px;
}

.btn-submit {
    background-color: #2d3748;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-body);
    margin-top: 2rem;
    transition: background-color 0.2s;
    width: 100%;
    letter-spacing: 1px;
}

.btn-submit:hover {
    background-color: #1a202c;
}

/* --- 富文本編輯器樣式 --- */
.editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    background: #edf2f7;
    padding: 8px 12px;
    border: 1px solid #cbd5e0;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.editor-toolbar button {
    background: #fff;
    border: 1px solid #cbd5e0;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #2d3748;
}

.editor-toolbar button:active {
    background: #cbd5e0;
}

.toolbar-divider {
    color: #a0aec0;
    margin: 0 4px;
}

#rich-content-editor {
    width: 100%;
    min-height: 200px;
    padding: 14px;
    border: 1px solid #cbd5e0;
    border-top: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    background-color: #faf8f5;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.8;
    overflow-y: auto;
}

#rich-content-editor:focus {
    outline: none;
    background-color: #fff;
    border-color: #a0aec0;
}

/* --- 分類篩選列 --- */
.category-filters {
    display: flex;
    gap: 12px;
    margin: 3rem 0 2rem 0;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: #4a5568;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #cbd5e0;
    background-color: #f7fafc;
}

.filter-btn.active {
    background-color: #2d3748;
    color: white;
    border-color: #2d3748;
}

/* 下拉選單樣式 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    min-width: 140px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    z-index: 10;
    margin-top: 5px;
}

.dropdown-content.show {
    display: block;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 10px 14px;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
}

.dropdown-content a:hover {
    background-color: #f7fafc;
}

/* --- 文章卡片與 IG 風格輪播牆樣式 --- */
.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 2.5rem;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.post-carousel {
    position: relative;
    width: 100%;
    background: #000;
    max-height: 450px;
    overflow: hidden;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-item {
    display: none;
    width: 100%;
    height: 100%;
    text-align: center;
}

.carousel-item.active {
    display: block;
}

.post-img, .post-video {
    width: 100%;
    max-height: 450px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background-color: #111;
}

/* 左右切換按鈕 */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.prev-btn { left: 12px; }
.next-btn { right: 12px; }

/* 底部圓點指示器 */
.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background 0.2s;
}

.dot.active {
    background: rgba(255, 255, 255, 0.9);
}

.post-content {
    padding: 1.8rem;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.post-category-tag {
    background: #edf2f7;
    color: #4a5568;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 500;
}

.tag-協會介紹 { background: #ebf8ff; color: #3182ce; }
.tag-課輔班介紹 { background: #f0fff4; color: #38a169; }
.tag-故事 { background: #fffaf0; color: #dd6b20; }

.post-date {
    color: #a0aec0;
}

.post-content h3 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    margin-bottom: 1rem;
    color: #1a202c;
}

.post-rich-text {
    margin-bottom: 1.5rem;
    color: #4a5568;
    word-break: break-word;
}

.btn-delete {
    background-color: #fff5f5;
    color: #e53e3e;
    border: 1px solid #feb2b2;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.btn-delete:hover {
    background-color: #fed7d7;
}

.no-posts {
    text-align: center;
    color: #a0aec0;
    padding: 4rem 0;
}

/* --- 頁尾 --- */
footer {
    padding: 3rem 0;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: 5rem;
    text-align: center;
}

.footer-links {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.footer-links a {
    color: #4a5568;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #2d3748;
    text-decoration: underline;
}

.footer-divider {
    color: #cbd5e0;
    margin: 0 10px;
}

.footer-copyright {
    color: #a0aec0;
    font-size: 0.85rem;
    line-height: 1.6;
}
/* 文章/內容卡片容器 */
.article-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #eaeaea;
}

/* 滑鼠懸停時的微互動效果 */
.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.09);
}

/* 文章標題裝飾 */
.article-title {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 12px;
    font-weight: 700;
    position: relative;
    padding-left: 14px;
}

/* 標題左側的精緻小色塊裝飾 */
.article-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 4px;
    background-color: #3498db;
    border-radius: 2px;
}

/* 文章內文排版 */
.article-content {
    color: #4a5568;
    line-height: 1.8;
    font-size: 1rem;
}

/* 圖片與多媒體呈現優化 */
.article-content img, 
.article-media img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
/* 精緻質感標題裝飾條 */
.post-card h3, 
#about-display-title, 
.editor-header h3, 
.editor-header h2 {
    position: relative;
    padding-left: 16px;
    font-weight: 700;
}

/* 左側裝飾條本體 */
.post-card h3::before, 
#about-display-title::before, 
.editor-header h3::before, 
.editor-header h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 75%;
    background: linear-gradient(135deg, #3182ce, #63b3ed);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(49, 130, 206, 0.3);
}
/* 1. 精緻質感標題與漸層裝飾條 */
.post-card h3, 
#about-display-title, 
.editor-header h3, 
.editor-header h2 {
    position: relative;
    padding-left: 18px;
    font-weight: 700;
    color: #2d3748;
    letter-spacing: 0.5px;
}

.post-card h3::before, 
#about-display-title::before, 
.editor-header h3::before, 
.editor-header h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 70%;
    background: linear-gradient(135deg, #3182ce, #63b3ed);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(49, 130, 206, 0.3);
}

/* 2. 美化分類標籤 (膠囊風格與微互動) */
.post-category-tag {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 50px; /* 完美圓角膠囊 */
    background: linear-gradient(135deg, #ebf8ff, #bee3f8);
    color: #2b6cb0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    border: 1px solid #bee3f8;
}

/* 滑鼠懸停分類標籤時的小浮動效果 */
.post-category-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(43, 108, 176, 0.15);
    background: linear-gradient(135deg, #bee3f8, #90cdf4);
}

/* 針對不同分類的專屬柔和色調 (可選) */
.post-category-tag.tag-協會介紹 { background: linear-gradient(135deg, #e6fffa, #b2f5ea); color: #234e52; border-color: #b2f5ea; }
.post-category-tag.tag-課輔班介紹 { background: linear-gradient(135deg, #fffaf0, #feebc8); color: #744210; border-color: #feebc8; }
.post-category-tag.tag-故事 { background: linear-gradient(135deg, #f7fafc, #edf2f7); color: #4a5568; border-color: #cbd5e0; }