/* ===== 共用樣式 ===== */

/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* 確保頁面寬度固定，不受滾動條影響 */
    width: 100vw;
    box-sizing: border-box;
    /* 修正：確保 body 可以正確容納所有內容 */
    height: 100vh;
    /* 修正：允許 body 滾動 */
    overflow-y: auto;
}

/* 頁面容器 */
.page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
    /* 修正：確保頁面容器不會干擾主頁面佈局 */
    height: auto;
    /* 修正：為底部導航欄留出空間 */
    padding-bottom: 90px;
}

/* 頁首樣式 */
.header {
    background: #ff8c00;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.page-title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    margin: 0 1rem;
}

.page-title-main {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
}

.page-title-sub {
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
    opacity: 0.9;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
}

.user-name {
    font-size: 0.9rem;
    color: #fff;
    font-weight: 500;
}

.back-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 主要內容區域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    /* 確保容器寬度固定，滾動條覆蓋在內容上 */
    width: 100%;
    box-sizing: border-box;
    min-height: 0; /* 確保 flex 子元素可以正確縮放 */
    /* 修正：確保內容區域可以正確滾動 */
    overflow-y: auto;
    /* 修正：確保主內容區域可以正確分配空間 */
    position: relative;
    /* 修正：確保主內容區域不會超出容器 */
    max-height: calc(100vh - 90px);
    /* 為底部導航欄留出額外空間 */
    padding-bottom: 20px;
}

/* 空狀態樣式 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #666;
}

.empty-icon {
    margin-bottom: 16px;
    color: #ccc;
}

.empty-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.empty-description {
    font-size: 14px;
    color: #999;
    line-height: 1.4;
}

/* 底部導航樣式 */
.bottom-nav {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    color: #666;
}

.nav-item.active {
    color: #ff8c00;
    background: rgba(255, 140, 0, 0.1);
}

.nav-item:hover {
    color: #ff8c00;
    transform: translateY(-2px);
}

.nav-icon {
    width: 24px;
    height: 24px;
}

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

/* 頁首左側區域樣式 */
.header-left {
    display: flex;
    align-items: center;
}

/* 手機號碼驗證彈窗樣式 */
.phone-verification-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-family: 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
}

.phone-verification-modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 90%;
    width: 360px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.phone-verification-modal-header {
    background: linear-gradient(135deg, #ff8c00, #ffa500);
    color: #fff;
    padding: 1rem 1.5rem;
    text-align: center;
    border-radius: 16px 16px 0 0;
}

.phone-verification-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.phone-verification-modal-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.verification-message {
    text-align: center;
}

.verification-message p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.verification-button-container {
    display: flex;
    justify-content: center;
}

.verification-btn {
    background: linear-gradient(135deg, #ff8c00, #ffa500);
    color: #fff;
    border: none;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
    text-align: center;
    min-width: 200px;
}

.verification-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 140, 0, 0.4);
    background: linear-gradient(135deg, #ffa500, #ff8c00);
}

.verification-btn:active {
    transform: translateY(0);
}

.phone-verification-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: center;
}

.phone-verification-modal-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
    background: #f8f9fa;
    color: #666;
}

.phone-verification-modal-btn:hover {
    background: #e9ecef;
    color: #333;
}

.verification-status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    margin-top: 1rem;
    display: none;
}

.verification-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.verification-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 投票選擇彈窗樣式 */
.vote-selection-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.vote-selection-modal-content {
    background: white;
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.2s ease;
}

.vote-selection-modal-content.show {
    opacity: 1;
    transform: scale(1);
}

.vote-selection-modal-title {
    padding: 20px;
    background: #ff8c00;
    color: white;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
}

.vote-selection-buttons {
    background: white;
    display: flex;
    flex-direction: column;
}

.vote-selection-btn {
    padding: 16px 20px;
    border: none;
    background: white;
    color: #333;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    font-family: 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
}

.vote-selection-btn:hover {
    background-color: #f8f9fa;
}

.vote-selection-btn:last-child {
    border-bottom: none;
}

.vote-selection-btn-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    color: #ff8c00;
    flex-shrink: 0;
}

.vote-selection-btn-text {
    flex: 1;
    text-align: left;
}

.vote-selection-race-number {
    color: #ff8c00;
    font-weight: 700;
}

.vote-selection-btn.weak {
    opacity: 0.6;
    font-size: 14px;
}

.vote-selection-btn.weak .vote-selection-btn-icon {
    width: 18px;
    height: 18px;
    color: #999;
}

.vote-selection-btn.weak:hover {
    opacity: 0.8;
}

/* ==================== 選膽彈窗共用樣式 ==================== */

/* 選膽彈窗覆蓋層 */
.favorite-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-family: 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
}

/* 選膽彈窗內容 */
.favorite-modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 90%;
    width: 360px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

/* 選膽彈窗頭部 */
.favorite-modal-header {
    background: linear-gradient(135deg, #ff8c00, #ffa500);
    color: #fff;
    padding: 1rem 1.5rem;
    text-align: center;
    border-radius: 16px 16px 0 0;
}

.favorite-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* 選膽彈窗主體 */
.favorite-modal-body {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

/* 馬匹列表 */
.favorite-horse-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 馬匹項目 */
.favorite-horse-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.favorite-horse-item:hover {
    background: #fff8f0;
    border-color: #ff8c00;
    transform: translateY(-1px);
}

.favorite-horse-item.selected {
    background: linear-gradient(135deg, #fff8f0, #fff);
    border: 2px solid #ff8c00;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.2);
}

/* 馬匹號碼 */
.favorite-horse-number {
    background: linear-gradient(135deg, #ff8c00, #ffa500);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* 馬匹信息 */
.favorite-horse-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.favorite-horse-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 馬膽標籤 */
.favorite-badge {
    background: linear-gradient(135deg, #ff8c00, #ffa500);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(255, 140, 0, 0.3);
}

.favorite-horse-details {
    font-size: 0.75rem;
    color: #666;
}

/* 馬匹賠率 */
.favorite-horse-odds {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ff8c00;
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* 選膽彈窗底部 */
.favorite-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 0.75rem;
}

/* 選膽彈窗按鈕 */
.favorite-modal-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
}

.favorite-modal-btn.cancel {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e9ecef;
}

.favorite-modal-btn.cancel:hover {
    background: #e9ecef;
    color: #333;
}

.favorite-modal-btn.confirm {
    background: linear-gradient(135deg, #ff8c00, #ffa500);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
}

.favorite-modal-btn.confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.4);
}

.favorite-modal-btn.confirm:disabled {
    background: #ccc;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 響應式設計 */
@media (max-width: 480px) {
    .app-title {
        font-size: 1.3rem;
    }
    
    .page-title-main {
        font-size: 1.1rem;
    }
    
    .page-title-sub {
        font-size: 0.8rem;
    }
    
    .page-title-container {
        margin: 0 0.5rem;
    }
    
    .vote-selection-modal-overlay {
        padding: 15px;
    }
    
    .vote-selection-modal-title {
        padding: 18px 16px;
        font-size: 15px;
    }
    
    .vote-selection-btn {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .vote-selection-btn-icon {
        width: 18px;
        height: 18px;
        margin-right: 10px;
    }
    
    .vote-selection-btn.weak {
        font-size: 13px;
    }
    
    .vote-selection-btn.weak .vote-selection-btn-icon {
        width: 16px;
        height: 16px;
    }
    
    /* 選膽彈窗響應式 */
    .favorite-modal-content {
        width: 320px;
        max-height: 70vh;
    }
    
    .favorite-modal-header h3 {
        font-size: 1rem;
    }
    
    .favorite-horse-item {
        padding: 0.6rem;
    }
    
    .favorite-horse-number {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
    
    .favorite-horse-name {
        font-size: 0.8rem;
        gap: 8px;
    }
    
    .favorite-badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
    }
    
    .favorite-horse-details {
        font-size: 0.7rem;
    }
    
    .favorite-modal-footer {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .favorite-modal-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 375px) {
    .app-title {
        font-size: 1.3rem;
    }
    
    .page-title-main {
        font-size: 1rem;
    }
    
    .page-title-sub {
        font-size: 0.75rem;
    }
    
    .page-title-container {
        margin: 0 0.3rem;
    }
    
    .vote-selection-modal-overlay {
        padding: 12px;
    }
    
    .vote-selection-modal-title {
        padding: 16px 14px;
        font-size: 14px;
    }
    
    .vote-selection-btn {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .vote-selection-btn-icon {
        width: 16px;
        height: 16px;
        margin-right: 8px;
    }
    
    .vote-selection-btn.weak {
        font-size: 12px;
    }
    
    .vote-selection-btn.weak .vote-selection-btn-icon {
        width: 14px;
        height: 14px;
    }
}
