/* ========================================
   全域樣式
   寶可夢 ZA 資訊查詢網站
   ======================================== */

/* --- 基礎設定 --- */
:root {
    --primary-color: #0066cc;
    --secondary-color: #667eea;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --text-color: #333;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: #f5f5f5;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

/* --- Header 樣式 --- */
header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #764ba2 100%);
    color: white;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* --- Header 按鈕 (自訂) --- */
.header-action-buttons {
    gap: 0.5rem;
}
.header-action-buttons .header-action-btn {
    color: #fff;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.9);
    padding: 0.32rem 0.68rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    text-decoration: none;
}
.header-action-buttons .header-action-btn:hover,
.header-action-buttons .header-action-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.22);
    background: rgba(255,255,255,0.12);
}
.header-action-buttons .header-action-btn:active {
    transform: translateY(0);
}
.header-action-buttons .header-action-btn.me-2 { margin-right: 0.5rem; }

/* 小螢幕時縮小按鈕文字並維持可點擊 */
@media (max-width: 576px) {
    .header-action-buttons .header-action-btn {
        padding: 0.28rem 0.5rem;
        font-size: 0.9rem;
    }
}

/* 寶可夢縮圖 */
.pokemon-thumbnail {
    width: 40px;
    height: 40px;
    vertical-align: middle;
    margin-right: 8px;
}

.pokemon-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pokemon-types {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
}

.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* --- 浮動選單樣式 (FloatingMenu) --- */
.floating-menu {
    position: fixed;
    z-index: 1000;
    transition: all 0.3s ease;
}

.floating-menu__button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.floating-menu__button:hover {
    background: #0052a3;
    transform: scale(1.1);
}

.floating-menu__items {
    position: absolute;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    min-width: 200px;
    display: none;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.floating-menu__items.show {
    display: block;
    opacity: 1;
    transform: scale(1);
}

.floating-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s ease;
}

.floating-menu__item:hover {
    background-color: var(--light-color);
}

.floating-menu__item i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* --- 回到頂部按鈕 (BackToTop) --- */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#back-to-top:hover {
    background: #0052a3;
    transform: scale(1.1);
}

#back-to-top.show {
    display: flex;
}

/* 廣告相關樣式已移至 css/ad-switch.css */

/* 主內容區域 - 限制最大寬度避免被廣告遮擋 */
main.container {
    max-width: 1200px;
    padding-left: 15px;
    padding-right: 15px;
}

/* 大螢幕時,為側邊欄廣告預留空間 */
@media (min-width: 1400px) {
    main.container {
        max-width: 1100px;
        margin-right: auto;
        margin-left: auto;
    }
}

/* --- 錯誤訊息樣式 --- */

/* --- 載入中動畫 --- */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* --- 焦點可見性 (無障礙性) --- */
button:focus,
a:focus,
th:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 隱藏但保留給螢幕閱讀器 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   多語言優化樣式
   ======================================== */

/* 英文版本 - 文字較長 */
html[data-lang="en"] {
    font-size: 14px;
}

html[data-lang="en"] h1,
html[data-lang="en"] h2,
html[data-lang="en"] h3 {
    line-height: 1.3;
}

html[data-lang="en"] button {
    white-space: nowrap;
    padding: 0.4rem 0.8rem;
}

/* 日文版本 - 字符通常較短 */
html[data-lang="ja"] {
    font-size: 15px;
}

/* 中文版本 - 預設值 */
html[data-lang="zh-TW"],
html[data-lang=""] {
    font-size: 16px;
}

/* 確保在所有語言中浮動選單文字不會超出邊界 */
html[data-lang="en"] .floating-menu__items {
    min-width: 230px;
}

html[data-lang="ja"] .floating-menu__items {
    min-width: 210px;
}

html[data-lang="zh-TW"] .floating-menu__items,
html[data-lang=""] .floating-menu__items {
    min-width: 220px;
}

/* 按鈕在不同語言中的適應 */
html[data-lang="en"] .btn {
    padding: 0.45rem 0.85rem;
}

html[data-lang="ja"] .btn {
    padding: 0.5rem 0.75rem;
}

html[data-lang="zh-TW"] .btn,
html[data-lang=""] .btn {
    padding: 0.5rem 0.8rem;
}