/* ===== 運動彩劵分析平台 - 主要樣式檔案 ===== */

/* 基礎設定 */
:root {
    --primary-color: #1e3a8a;      /* 深藍色 - 主要品牌色 */
    --secondary-color: #3b82f6;     /* 藍色 - 次要色 */
    --success-color: #10b981;       /* 綠色 - 成功/勝利 */
    --danger-color: #ef4444;        /* 紅色 - 失敗/失利 */
    --warning-color: #f59e0b;       /* 橙色 - 警告 */
    --info-color: #06b6d4;          /* 青色 - 資訊 */
    --light-bg: #f8fafc;            /* 淺灰背景 */
    --card-bg: #ffffff;             /* 卡片背景 */
    --text-primary: #1f2937;        /* 主要文字色 */
    --text-secondary: #6b7280;      /* 次要文字色 */
    --border-color: #e5e7eb;        /* 邊框色 */
    --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ===== 導航列樣式 ===== */
.navbar-custom {
    background: var(--gradient-primary);
    padding: 0.75rem 0;
    box-shadow: var(--shadow-md);
    border: none;
}

/* 下拉式子選單樣式 */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -1px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.dropdown-submenu:hover .dropdown-menu {
    display: block;
}

/* 主題選項樣式 */
.theme-option {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.theme-option:hover {
    background-color: var(--light-bg);
}

.theme-option.active {
    background-color: var(--primary-color);
    color: white;
}

.theme-option.active .theme-indicator {
    border-color: white;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: white !important;
    display: flex;
    align-items: center;
}

.navbar-brand i {
    margin-right: 0.5rem;
    font-size: 1.8rem;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    margin: 0 0.25rem;
}

.navbar-nav .nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.2);
}

/* ===== 主要內容區域 ===== */
.main-content {
    min-height: calc(100vh - 80px);
    padding-top: 2rem;
}

/* ===== 英雄區域 (首頁橫幅) ===== */
.hero-section {
    background: var(--gradient-primary);
    color: white;
    padding: 4rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="pattern" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23pattern)"/></svg>');
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* ===== 快速搜尋區域 ===== */
.quick-search {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-top: -3rem;
    position: relative;
    z-index: 2;
}

.search-tabs {
    margin-bottom: 1.5rem;
}

.search-tab {
    background: none;
    border: 2px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    margin-right: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.search-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.search-tab:hover:not(.active) {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.search-form {
    /* PC版預設為水平一行佈局 */
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: flex-end;
}

.form-group {
    margin-bottom: 1rem;
    flex: 1;
    min-width: 0; /* 防止元素溢出 */
}

.form-group:last-child {
    margin-bottom: 0;
    flex: 0 0 auto; /* 按鈕不縮放 */
    min-width: 120px;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-select,
.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
}

.form-select:focus,
.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== 按鈕樣式 ===== */
.btn-primary-custom {
    background: var(--gradient-primary);
    border: none;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: white;
}

.btn-success-custom {
    background: var(--gradient-success);
    border: none;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-custom {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-custom:hover {
    background: var(--primary-color);
    color: white;
}

/* ===== 首頁專用元件樣式 ===== */

/* 載入動畫 */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
}

.pulse {
    animation: pulse 1.5s infinite;
}

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

.animate-on-load {
    opacity: 0;
    transform: translateY(30px);
    animation: slideInUp 1s ease-out forwards;
}

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 區段標題 */
.section-title {
    position: relative;
    margin-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* 即時比分區域樣式 */
.live-score-section {
    border-radius: 0.5rem;
}

.live-score-layout {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.live-score-header {
    flex-shrink: 0;
    min-width: 120px;
}

.live-score-flipper {
    flex: 1;
    overflow: hidden;
    height: 60px;
    position: relative;
}

.flipper-container {
    height: 100%;
    position: relative;
}

.score-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 60px;
    padding: 0.75rem 1.5rem;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.5s ease-in-out;
}

.score-item.active {
    opacity: 1;
    transform: translateY(0);
}

.score-item.prev {
    opacity: 0;
    transform: translateY(-100%);
}

.score-item.winning {
    border-left: 4px solid var(--success-color);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.score-item.losing {
    border-left: 4px solid var(--danger-color);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.score-teams {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: white;
}

.score-display {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.score-numbers {
    font-weight: 700;
    font-size: 1.2rem;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.score-inning {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

/* 比賽結果樣式 */
.match-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.match-item:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: translateX(5px);
}

/* 球隊卡片樣式 */
.team-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.team-card:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: translateX(5px);
}

.team-rank {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 1rem;
    min-width: 2rem;
}

.team-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.team-logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    margin-right: 1rem;
}

.team-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.2rem;
}

.team-name {
    margin: 0;
    font-size: 1rem;
}

.team-record {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.win-rate {
    color: var(--success-color);
    font-weight: 500;
}

/* ===== 卡片樣式 ===== */
.card-custom {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

.card-header-custom {
    background: var(--light-bg);
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body-custom {
    padding: 1.5rem;
}

/* ===== 統計數據樣式 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

.stat-icon.primary { color: var(--primary-color); }
.stat-icon.success { color: var(--success-color); }
.stat-icon.danger { color: var(--danger-color); }
.stat-icon.warning { color: var(--warning-color); }

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== 表格樣式 ===== */
.table-custom {
    background: white;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-custom table {
    margin: 0;
}

.table-custom thead {
    background: var(--light-bg);
}

.table-custom th {
    border-bottom: 2px solid var(--border-color);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.table-custom td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table-custom tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

/* ===== 徽章樣式 ===== */
.badge-win {
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-lose {
    background: var(--danger-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-draw {
    background: var(--warning-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ===== 響應式設計 ===== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .search-tab {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar-nav {
        text-align: center;
        padding-top: 1rem;
    }
    
    /* 首頁響應式 */
    .live-score-layout {
        gap: 1rem;
    }
    
    .live-score-header {
        min-width: 100px;
    }
    
    .live-score-flipper {
        height: 55px;
    }
    
    .score-item {
        height: 55px;
        padding: 0.6rem 1.2rem;
    }
    
    .score-teams {
        font-size: 0.9rem;
    }
    
    .score-numbers {
        font-size: 1.1rem;
    }
    
    .score-inning {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
    }
}

@media (max-width: 576px) {
    .quick-search {
        margin: -2rem 1rem 0;
        padding: 1.5rem;
    }
    
    .hero-section {
        padding: 3rem 0;
    }
    
    .main-content {
        padding-top: 1rem;
    }
    
    /* 手機版搜尋表單改為垂直佈局 */
    .search-form {
        display: block;
        gap: 0;
    }
    
    .search-form .form-group {
        flex: none;
        min-width: auto;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .search-form .form-group:last-child {
        flex: none;
        min-width: auto;
        width: 100%;
        margin-bottom: 0;
    }
    
    .search-form .btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .form-select {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* 首頁小螢幕響應式 */
    .live-score-layout {
        gap: 0.5rem;
    }
    
    .live-score-header {
        min-width: 60px;
    }
    
    /* 隱藏"即時比分"文字，只保留圖標和LIVE標籤 */
    .live-score-header strong {
        display: none;
    }
    
    .live-score-flipper {
        height: 50px;
    }
    
    .score-item {
        height: 50px;
        padding: 0.5rem 1rem;
    }
    
    .score-teams {
        font-size: 0.8rem;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .score-numbers {
        font-size: 1rem;
    }
    
    .score-inning {
        font-size: 0.7rem;
        padding: 0.15rem 0.3rem;
    }
}

/* ===== 載入動畫 ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 圖表容器 ===== */
.chart-container {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* ===== 工具提示 ===== */
.tooltip-custom {
    position: relative;
    cursor: help;
}

.tooltip-custom::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tooltip-custom:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ===== 預計開始比賽卡片 ===== */
.upcoming-match-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.upcoming-match-item:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-2px);
}

.match-time {
    text-align: center;
    margin-right: 1rem;
    min-width: 80px;
}

.match-date {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.match-time-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.match-days-text {
    font-size: 0.8rem;
    font-weight: 500;
}

.match-teams {
    flex: 1;
    text-align:center;
}

.team-vs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.team-name {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.vs-text {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0 0.5rem;
    font-weight: bold;
}

.match-league {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.match-league .badge {
    font-size: 0.75rem;
}

body.theme-default footer .text-muted {
    color: #999999 !important;
}