/* ============================================
   Event Page Core Styles
   共用功能性樣式 - 所有模板皆載入
   ============================================ */

/* ============================================
   CSS Variables - 預設值（可被模板覆寫）
   ============================================ */
:root {
    /* 主要顏色 - Primary Colors */
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-light: #a78bfa;

    /* 背景顏色 - Background Colors */
    --bg: #f9fafb;
    --bg-card: #ffffff;
    --bg-muted: #f3f4f6;

    /* 文字顏色 - Text Colors */
    --text: #111827;
    --text-muted: #6b7280;
    --text-light: #9ca3af;

    /* 邊框顏色 - Border Colors */
    --border: #e5e7eb;
    --border-light: #f3f4f6;

    /* 狀態顏色 - Status Colors */
    --success: #22c55e;
    --error: #ef4444;

    /* 圓角 - Border Radius */
    --radius: 0.5rem;
    --radius-lg: 1rem;
}

/* ============================================
   Base Styles - 基礎樣式
   ============================================ */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
}

/* 確保滾動時不會被 sticky 導航遮擋 */
[id] {
    scroll-margin-top: 60px;
}

/* ============================================
   Utility Classes - 工具類
   ============================================ */

/* 顯示/隱藏 */
.hidden {
    display: none !important;
}

/* 文字顏色 */
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }

/* 背景顏色 */
.bg-primary { background-color: var(--primary); }
.bg-card { background-color: var(--bg-card); }
.bg-muted { background-color: var(--bg-muted); }

/* 邊框顏色 */
.border-default { border-color: var(--border); }
.border-light { border-color: var(--border-light); }

/* ============================================
   Component Styles - 共用組件樣式
   ============================================ */

/* 主要按鈕 */
.btn-primary {
    background-color: var(--primary);
    color: white;
    border-radius: var(--radius);
    transition: background-color 0.2s;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}

/* 輸入框聚焦 */
input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

/* 表單欄位錯誤 */
.field-error {
    border-color: var(--error) !important;
}
.field-error:focus {
    border-color: var(--error) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 20%, transparent) !important;
}

/* Prose 樣式 */
.prose { line-height: 1.75; }
.prose p { margin-bottom: 1em; }
.prose ul, .prose ol { margin-left: 1.5em; margin-bottom: 1em; }
.prose li { margin-bottom: 0.5em; }
.prose a { color: var(--primary); text-decoration: underline; }
.prose a:hover { color: var(--primary-hover); }

/* ============================================
   Animations - 動畫
   ============================================ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.toast-enter { animation: slideIn 0.3s ease-out forwards; }
.toast-exit { animation: slideOut 0.3s ease-in forwards; }

/* ============================================
   Navigation - Hamburger Menu & Side Drawer
   ============================================ */

/* 固定頂部導航列（桌面和手機共用） */
#fixed-nav-bar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 997;
    background-color: var(--bg-card, #ffffff);
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    padding: 0 2rem;
    height: 64px;
    justify-content: space-between;
    align-items: center;
}

/* 導航列 Logo */
#fixed-nav-bar .nav-logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#fixed-nav-bar .nav-logo {
    height: 36px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

#fixed-nav-bar .nav-logo-placeholder {
    width: 1px;
    flex-shrink: 0;
}

/* 桌面版導航項目（置中） */
#fixed-nav-bar .desktop-nav-items {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

#fixed-nav-bar .desktop-nav-items a {
    padding: 0.5rem 1rem;
    color: var(--text, #111827);
    text-decoration: none;
    font-size: 0.875rem;
    transition: opacity 0.2s ease;
}

#fixed-nav-bar .desktop-nav-items a:hover {
    opacity: 0.7;
}

/* 漢堡選單按鈕（預設隱藏，手機版顯示） */
#fixed-nav-bar .nav-hamburger {
    display: none;
    align-items: center;
    padding: 0.875rem 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text, #111827);
}

#fixed-nav-bar .nav-hamburger:hover {
    opacity: 0.8;
}

#fixed-nav-bar .nav-hamburger .close-icon {
    display: none;
}

#fixed-nav-bar .nav-hamburger.open .hamburger-icon {
    display: none;
}

#fixed-nav-bar .nav-hamburger.open .close-icon {
    display: block;
}

/* 頁面內容需要給頂部導航留空間（桌面版） */
.page {
    padding-top: 64px;
}

/* 隱藏原本的內容內導航 */
#nav-menu {
    display: none !important;
}

/* 側邊抽屜遮罩 */
.nav-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-drawer-backdrop.open {
    display: block;
    opacity: 1;
}

/* 側邊抽屜樣式 */
#mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-card, #ffffff);
    z-index: 999;
    display: none;
    flex-direction: column;
    padding: 0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    overflow-y: auto;
}

#mobile-nav-drawer.open {
    right: 0;
}

/* 抽屜頭部 */
#mobile-nav-drawer .drawer-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
}

#mobile-nav-drawer .drawer-title {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
}

#mobile-nav-drawer .drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted, #6b7280);
    transition: color 0.2s;
}

#mobile-nav-drawer .drawer-close:hover {
    color: var(--text, #111827);
}

#mobile-nav-drawer .drawer-items a {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    color: var(--text, #111827);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

#mobile-nav-drawer .drawer-items a:hover {
    background-color: var(--bg-muted, #f3f4f6);
}

#mobile-nav-drawer .drawer-items a:last-child {
    border-bottom: none;
}

/* 響應式 - 手機版 (640px 以下) */
@media (max-width: 640px) {
    /* 級聯下拉手機版改為上下排列 */
    .cascading-select-group {
        flex-direction: column;
    }

    /* 調整手機版導航列高度和間距 */
    #fixed-nav-bar {
        height: 56px;
        padding: 0 1rem;
    }

    #fixed-nav-bar .nav-logo {
        height: 28px;
        max-width: 100px;
    }

    /* 顯示漢堡按鈕，隱藏桌面導航項目 */
    #fixed-nav-bar .nav-hamburger {
        display: flex;
    }

    #fixed-nav-bar .desktop-nav-items {
        display: none;
    }

    #mobile-nav-drawer {
        display: flex;
    }

    /* 頁面內容預留手機版導航高度 */
    .page {
        padding-top: 56px;
    }

    /* 防止背景滾動 */
    body.nav-open {
        overflow: hidden;
    }
}

/* 響應式 - 桌面版 (641px 以上) */
@media (min-width: 641px) {
    /* 隱藏漢堡按鈕和抽屜，顯示桌面導航項目 */
    #fixed-nav-bar .nav-hamburger {
        display: none;
    }

    #fixed-nav-bar .desktop-nav-items {
        display: flex;
    }

    #mobile-nav-drawer,
    .nav-drawer-backdrop {
        display: none !important;
    }
}

/* ============================================
   Logo / Header
   ============================================ */
/* 隱藏原本的 site-header（Logo 已整合到固定導航列） */
#site-header {
    display: none !important;
}

#event-logo {
    transition: opacity 0.3s ease;
}

#event-logo:hover {
    opacity: 0.8;
}

/* 當沒有 banner 圖片時的 logo 樣式 */
.no-banner #site-header {
    background: transparent !important;
}

.no-banner #event-logo {
    filter: none !important;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    #loading-screen,
    #toast-container,
    #site-header {
        display: none !important;
    }
}
