/**
 * 台北捷兔 - 全站自訂樣式
 * Taipei Hash House Harriers - Global Stylesheet
 * 
 * 設計原則：統一風格，重複使用，避免一頁一風格
 */

/* ===== 全域基礎 ===== */
:root {
    --th3-green: #198754;
    --th3-green-dark: #146c43;
    --th3-green-light: #d1e7dd;
}

body {
    font-family: 'Microsoft JhengHei', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ===== 導覽列 ===== */
.navbar-brand {
    font-weight: 700;
}

.nav-link {
    font-weight: 500;
}

/* ===== 卡片 ===== */
.card {
    border-radius: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

.card-header {
    border-radius: 0.5rem 0.5rem 0 0 !important;
    font-weight: 600;
}

/* ===== 按鈕統一 ===== */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn-success {
    background-color: var(--th3-green);
    border-color: var(--th3-green);
}

.btn-success:hover {
    background-color: var(--th3-green-dark);
    border-color: var(--th3-green-dark);
}

/* ===== 頁面標題 ===== */
.page-header {
    background-color: var(--th3-green-light);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.page-header h2 {
    color: var(--th3-green-dark);
    font-weight: 700;
}

/* ===== 表格 ===== */
.table th {
    background-color: var(--th3-green-light);
    color: var(--th3-green-dark);
    font-weight: 600;
}

/* ===== 頁尾 ===== */
footer a:hover {
    color: var(--th3-green) !important;
}

/* ===== RWD 行動版 ===== */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* 觸控優化：最小點擊區域 44x44px */
    .btn, .nav-link {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* ===== 里程碑標章 ===== */
.badge-milestone {
    background-color: #ffc107;
    color: #333;
    font-weight: 700;
}

.badge-century {
    background-color: #dc3545;
    color: #fff;
    font-weight: 700;
}

/* ===== 載入動畫 ===== */
.loading-placeholder {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== 列印樣式（跑次禮名單等） ===== */
@media print {
    .navbar, footer, .btn, .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
    }

    .card {
        border: 1px solid #000;
        box-shadow: none !important;
    }
}

/* ============================================
   後台管理介面 (Admin Layout)
   ============================================ */

/* --- 基礎佈局 --- */
.admin-body {
    padding-top: 56px; /* 頂部列高度 */
}

.admin-topbar {
    height: 56px;
    z-index: 1040;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* --- 側邊欄 --- */
.admin-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 250px;
    background: #1a2332;
    color: #c2c7d0;
    overflow-y: auto;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 0.75rem 1rem;
    text-align: right;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: #c2c7d0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(25, 135, 84, .15);
    color: #fff;
    border-left-color: var(--th3-green);
    font-weight: 600;
}

.sidebar-link .bi {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar-footer {
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* --- 主內容區 --- */
.admin-main {
    margin-left: 250px;
    min-height: calc(100vh - 56px);
    background: #f4f6f9;
}

/* --- 側邊欄遮罩（行動版）--- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1025;
}

.sidebar-overlay.active {
    display: block;
}

/* --- RWD：行動版收合側邊欄 --- */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }
}

/* --- 後台卡片：取消 hover 效果避免干擾 --- */
.admin-main .card:hover {
    transform: none;
}

/* ===== PWA 佇列同步 Banner ===== */
.th3-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: #0d6efd;
    color: #fff;
    text-align: center;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.th3-offline-banner.show {
    transform: translateY(0);
}

.th3-offline-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 8px;
    font-size: 0.8rem;
}

@keyframes th3-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.th3-spin {
    animation: th3-spin 1s linear infinite;
    display: inline-block;
}

/* 離線 banner 出現時推移 sticky navbar */
.th3-offline-banner.show ~ .navbar.sticky-top,
.th3-offline-banner.show ~ nav.fixed-top {
    top: 32px;
}

/* ===== 友會管理 ===== */
.club-logo-preview {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8f9fa;
}

.club-logo-card {
    width: 120px;
    height: 120px;
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    display: inline-block;
}

.status-pending  { color: #fd7e14; }
.status-approved { color: #198754; }
.status-rejected { color: #dc3545; }

.col-logo  { width: 70px; }
.col-actions { width: 160px; }

/* ===== 關於我們 ===== */
.about-hero { min-height: 280px; display: flex; align-items: center; }
.about-hero-logo { width: 120px; height: 120px; object-fit: cover; border: 3px solid rgba(255,255,255,.5); }
.about-divider { width: 60px; height: 3px; background: var(--th3-green); border-radius: 2px; margin-top: 8px; }
.about-icon-circle { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.about-card { transition: transform 0.2s ease; }
.about-card:hover { transform: translateY(-4px); }
.about-custom-content img { max-width: 100%; height: auto; border-radius: 8px; }

/* ===== 公告內容 ===== */
.announcement-content { overflow-x: auto; word-break: break-word; line-height: 1.8; font-size: 1.05rem; }
.announcement-content p { margin-bottom: .75rem; }
.announcement-content table { width: 100%; margin-bottom: 1rem; }
.announcement-content table th,
.announcement-content table td { padding: .5rem .75rem; border: 1px solid #dee2e6; vertical-align: top; }
.announcement-content table thead th { background-color: var(--th3-green-light); color: var(--th3-green-dark); font-weight: 600; }
.announcement-content img { max-width: 100%; height: auto; }
.announcement-content ul,
.announcement-content ol { padding-left: 1.5rem; margin-bottom: .75rem; }
.announcement-content li { padding: .35rem 0; border-bottom: 1px dashed #e9ecef; }
.announcement-content li:last-child { border-bottom: none; }
.announcement-content li strong { color: var(--th3-green-dark); }
/* Quill 2.x data-list="bullet" 相容：若殘留在 DB 中，前台仍顯示圓點 */
.announcement-content li[data-list="bullet"] { list-style-type: disc; }
.announcement-content .list-group { padding-left: 0; }
