/* =========================================
   TIX RABBIT - Professional Stylesheet
   (Mobile Optimized Version)
   ========================================= */

:root {
    --primary: #543b4f;       /* Deep Purple */
    --primary-dark: #432f3f;
    --secondary: #d4af37;     /* Champagne Gold */
    --secondary-hover: #b5952f;
    --text-main: #333333;
    --text-light: #666666;
    --bg-light: #f8f9fa;
    --border: #e9ecef;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

html {
    scroll-behavior: smooth;
    box-sizing: border-box; /* 全局盒模型設定，防止 padding 撐破寬度 */
}
*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-light);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* 防止橫向滾動條 */
}

main { flex: 1; }

/* ============================
   Header & Nav
   ============================ */
.header-top { background: #000; color: #fff; font-size: 12px; padding: 6px 0; }
.header-main {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Desktop Nav Links */
.nav-link {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    padding: 0.5rem 1rem;
    position: relative;
    transition: color 0.3s;
}
.nav-link:hover { color: var(--secondary); }
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--secondary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}
.nav-link:hover::after { width: 80%; }

/* Mobile Menu */
#mobile-menu {
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
    overflow: hidden;
    background-color: var(--primary-dark);
}
#mobile-menu.hidden { display: none; }

/* ============================
   Hero Section
   ============================ */
.hero-section {
    background: linear-gradient(135deg, rgba(84, 59, 79, 0.95), rgba(40, 28, 38, 0.85)), url('https://images.unsplash.com/photo-1459749411177-229323b35340?w=1600&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding: 80px 20px 100px;
    text-align: center;
    color: white;
}

/* Mobile Hero Optimization */
@media (max-width: 768px) {
    .hero-section {
        padding: 40px 20px 60px;
        background-attachment: scroll; /* 手機端取消固定背景，提升性能 */
        min-height: auto;
    }
    .hero-title { font-size: 1.75rem; line-height: 1.3; }
}

/* ============================
   Cards
   ============================ */
.event-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid rgba(0,0,0,0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}
/* Disable hover effects on touch devices to prevent sticky states */
@media (hover: hover) {
    .event-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-hover);
    }
    .event-card:hover .card-image-wrapper img { transform: scale(1.05); }
}

.card-image-wrapper {
    position: relative;
    padding-top: 66%;
    overflow: hidden;
}
.card-image-wrapper img {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* ============================
   Tables (Mobile Optimized)
   ============================ */
.table-container {
    width: 100%;
    overflow-x: auto; /* 允許橫向滾動 */
    -webkit-overflow-scrolling: touch; /* iOS 回彈效果 */
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    margin-bottom: 1rem;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap; /* 默認不換行，保證表格形狀 */
}

.custom-table th {
    background-color: #f8f9fa;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 1rem;
    border-bottom: 2px solid var(--border);
    text-align: left;
}

.custom-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.custom-table tr:last-child td { border-bottom: none; }

/* Mobile Table Tweaks */
@media (max-width: 768px) {
    .custom-table th,
    .custom-table td {
        padding: 0.75rem 0.5rem; /* 減小內邊距以便在小屏幕顯示更多內容 */
        font-size: 13px;
    }
}

/* ============================
   Buttons & Inputs
   ============================ */
.btn-primary {
    background-color: var(--primary);
    color: #fff;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}
.btn-primary:active { transform: translateY(0); background-color: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Desktop Hover */
@media (hover: hover) {
    .btn-primary:hover { background-color: var(--primary-dark); transform: translateY(-1px); }
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    /* 關鍵：iOS上小於16px會自動放大頁面，這裡強制設為16px */
    font-size: 16px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(84, 59, 79, 0.1);
}

/* Mobile Input Tweaks */
@media (max-width: 768px) {
    .form-input {
        padding: 0.6rem; /* 稍微減小高度 */
    }
}

/* ============================
   Account Sidebar (Responsive)
   ============================ */
.account-sidebar {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

/* Desktop Sidebar */
@media (min-width: 769px) {
    .account-sidebar {
        position: sticky;
        top: 100px; /* 調整 sticky 位置 */
    }
    .sidebar-link {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 1rem 1.25rem;
        color: var(--text-main);
        border-bottom: 1px solid var(--bg-light);
        transition: all 0.2s;
    }
    .sidebar-link:hover { background-color: #f8f9fa; padding-left: 1.5rem; }
    .sidebar-link.active {
        background-color: #fdfbf7;
        color: var(--primary);
        font-weight: 600;
        border-left: 4px solid var(--primary);
    }
}

/* Mobile Sidebar - 變為橫向滾動條 */
@media (max-width: 768px) {
    .account-sidebar {
        margin-bottom: 1.5rem; /* 與下方內容拉開距離 */
        border-radius: 0; /* 手機版通常滿版或直角較好看，可選 */
        border: none;
        background: transparent;
    }

    .sidebar-profile {
        background: var(--primary);
        border-radius: 8px 8px 0 0;
        padding: 1rem !important;
        display: flex;
        align-items: center;
        gap: 1rem;
        text-align: left !important;
    }
    .sidebar-profile .avatar {
        margin: 0 !important;
        width: 3rem !important;
        height: 3rem !important;
    }

    .account-sidebar nav {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        background: white;
        border: 1px solid var(--border);
        border-top: none;
        border-radius: 0 0 8px 8px;
        scrollbar-width: none; /* Firefox 隱藏滾動條 */
        -ms-overflow-style: none; /* IE/Edge 隱藏滾動條 */
    }
    .account-sidebar nav::-webkit-scrollbar {
        display: none; /* Chrome/Safari 隱藏滾動條 */
    }

    .sidebar-link {
        flex: 0 0 auto; /* 防止壓縮 */
        padding: 1rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        color: var(--text-main);
        border-right: 1px solid var(--bg-light);
        border-bottom: none;
    }

    .sidebar-link.active {
        color: var(--primary);
        font-weight: 700;
        background-color: #fdfbf7;
        border-bottom: 3px solid var(--primary);
        border-left: none; /* 移除桌面的左邊框 */
    }

    /* 登出按鈕特殊處理 */
    .sidebar-link:last-child {
        color: #ef4444;
        border-right: none;
    }
}

/* ============================
   Checkout / Summary
   ============================ */
.checkout-summary {
    position: relative;
}
@media (min-width: 1024px) {
    .checkout-summary {
        position: sticky;
        top: 120px;
    }
}
/* =========================================
   TIX RABBIT - Core Stylesheet
   (Mobile Optimized Fix)
   ========================================= */

:root {
    --primary: #543b4f;       /* 深紫色 */
    --primary-dark: #432f3f;
    --secondary: #d4af37;     /* 香檳金 */
    --text-main: #333333;
    --text-light: #666666;
    --bg-light: #f8f9fa;
    --border: #e9ecef;
}

/* --- 全局重置 --- */
html {
    -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-light);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* 关键：防止手机端左右晃动 */
    overflow-x: hidden;
    width: 100%;
}

/* --- 头部 Header --- */
.header-main {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    /* 关键：确保头部始终在最上层 */
    position: sticky;
    top: 0;
    z-index: 100;
}

/* --- 移动端侧边栏 (变身为顶部滑动 Tab) --- */
.account-sidebar {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .account-sidebar {
        /* 手机端取消圆角和边框，变成通栏 */
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border);

        /* 关键：吸顶效果，位于 Header 下方 */
        position: sticky;
        top: 64px; /* Header 的高度 (h-16 = 4rem = 64px) */
        z-index: 90;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    }

    /* 隐藏手机端的头像区域，节省空间 (可选，或者通过 HTML hidden 类控制) */
    .account-sidebar .sidebar-profile {
        display: none;
    }

    /* 导航容器：横向滚动 */
    .account-sidebar nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        background: #fff;

        /* iOS 顺滑滚动 */
        -webkit-overflow-scrolling: touch;

        /* 隐藏滚动条 */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    .account-sidebar nav::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    /* 导航链接样式 */
    .sidebar-link {
        flex: 0 0 auto; /* 防止被压缩 */
        padding: 14px 20px; /* 增加点击区域 */
        font-size: 15px;
        color: var(--text-light);
        border-bottom: 3px solid transparent; /* 预留激活状态边框 */
        border-left: none !important; /* 覆盖桌面端样式 */
        transition: all 0.3s;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    /* 激活状态 */
    .sidebar-link.active {
        color: var(--primary);
        font-weight: 600;
        background-color: transparent;
        border-bottom-color: var(--primary); /* 底部线条 */
    }

    /* 登出按钮特殊处理 */
    .sidebar-link:last-child {
        color: #ef4444;
        margin-left: auto; /* 把它推到最右边(如果 Flex 空间足够) 或者保持跟随 */
    }
}

/* --- 桌面端侧边栏 (保持原样优化) --- */
@media (min-width: 769px) {
    .account-sidebar {
        position: sticky;
        top: 90px; /* 距离 Header 的间距 */
    }
    .sidebar-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 20px;
        color: var(--text-main);
        border-left: 4px solid transparent;
        transition: all 0.2s;
    }
    .sidebar-link:hover {
        background-color: #f8f9fa;
        padding-left: 24px;
    }
    .sidebar-link.active {
        background-color: #fdfbf7;
        color: var(--primary);
        border-left-color: var(--primary);
        font-weight: 600;
    }
}

/* --- 按钮与表单 --- */
.btn-primary {
    background-color: var(--primary);
    color: #fff;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-primary:active {
    background-color: var(--primary-dark);
}

/* 防止 iOS 输入框放大 */
.form-input {
    font-size: 16px !important;
}