/* ========================================
   響應式樣式 - Mobile First
   斷點: 768px (平板), 1024px (桌面)
   ======================================== */

/* ===================================
   預設樣式: 手機 (< 768px)
   =================================== */

/* Header */
header h1 {
    font-size: 1.75rem;
}

/* 區域卡片 */
.area-card {
    padding: 1rem;
}

.area-card__title {
    font-size: 1.5rem;
}

/* 寶可夢表格 - 手機允許水平捲動 */
.pokemon-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pokemon-table {
    min-width: 600px;
    font-size: 14px;
}

.pokemon-table th,
.pokemon-table td {
    padding: 8px 4px;
}

.pokemon-thumbnail {
    width: 32px;
    height: 32px;
}

/* 浮動選單 - 手機 */
.floating-menu__button {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
}

.floating-menu__items {
    min-width: 180px;
}

/* 回到頂部按鈕 - 手機 */
#back-to-top {
    width: 44px;
    height: 44px;
    bottom: 20px;
    right: 20px;
    font-size: 1.25rem;
}

/* 廣告位置 - 手機 */
.ad-header {
    min-height: 100px; /* 320x100 橫幅 */
}

.ad-middle {
    min-height: 250px; /* 300x250 矩形 */
}

.ad-footer {
    min-height: 100px; /* 320x100 橫幅 */
}

.ad-sidebar {
    display: none !important; /* 手機隱藏側邊欄廣告 */
}

/* 確保互動元素最小觸控區域 44x44px */
.pokemon-table th,
.floating-menu__item,
button {
    min-height: 44px;
    min-width: 44px;
}

/* ===================================
   平板樣式 (768px - 1024px)
   =================================== */
@media (min-width: 768px) {
    /* Header */
    header h1 {
        font-size: 2.25rem;
    }
    
    /* 區域卡片 */
    .area-card {
        padding: 1.25rem;
    }
    
    .area-card__title {
        font-size: 1.625rem;
    }
    
    /* 寶可夢表格 */
    .pokemon-table {
        font-size: 15px;
    }
    
    .pokemon-table th,
    .pokemon-table td {
        padding: 10px 6px;
    }
    
    .pokemon-thumbnail {
        width: 36px;
        height: 36px;
    }
    
    /* 區域網格佈局 - 保持單欄以完整顯示表格 */
    #areas-container {
        display: block;
    }
    
    /* 浮動選單 - 平板 */
    .floating-menu__button {
        width: 52px;
        height: 52px;
        font-size: 1.375rem;
    }
    
    .floating-menu__items {
        min-width: 200px;
    }
    
    /* 回到頂部按鈕 - 平板 */
    #back-to-top {
        width: 48px;
        height: 48px;
        bottom: 25px;
        right: 25px;
        font-size: 1.375rem;
    }
    
    /* 廣告位置 - 平板 */
    .ad-header {
        min-height: 90px; /* 728x90 橫幅 */
    }
    
    .ad-middle {
        min-height: 280px; /* 336x280 大矩形 */
    }
    
    .ad-footer {
        min-height: 90px; /* 728x90 橫幅 */
    }
    
    .ad-sidebar {
        display: block !important; /* 平板顯示側邊欄廣告 */
        width: 160px;
        height: 600px; /* 160x600 摩天樓 */
    }
}

/* ===================================
   桌面樣式 (> 1024px)
   =================================== */
@media (min-width: 1024px) {
    /* Header */
    header h1 {
        font-size: 2.5rem;
    }
    
    /* 區域卡片 */
    .area-card {
        padding: 1.5rem;
    }
    
    .area-card__title {
        font-size: 1.75rem;
    }
    
    /* 寶可夢表格 */
    .pokemon-table {
        font-size: 16px;
    }
    
    .pokemon-table th,
    .pokemon-table td {
        padding: 12px 8px;
    }
    
    .pokemon-thumbnail {
        width: 40px;
        height: 40px;
    }
    
    /* 區域網格佈局 - 保持單欄以完整顯示表格 */
    #areas-container {
        display: block;
    }
    
    /* 浮動選單 - 桌面 */
    .floating-menu__button {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
    
    .floating-menu__items {
        min-width: 220px;
    }
    
    /* 回到頂部按鈕 - 桌面 */
    #back-to-top {
        width: 50px;
        height: 50px;
        bottom: 30px;
        right: 30px;
        font-size: 1.5rem;
    }
    
    /* 廣告位置 - 桌面 */
    .ad-header {
        min-height: 90px; /* 970x90 超級橫幅 或 728x90 橫幅 */
    }
    
    .ad-middle {
        min-height: 600px; /* 300x600 半版 */
    }
    
    .ad-footer {
        min-height: 90px; /* 728x90 橫幅 */
    }
    
    .ad-sidebar {
        display: block !important;
        width: 160px;
        height: 600px; /* 160x600 摩天樓 */
        position: fixed;
        right: 20px;
        top: 150px;
    }
    
    /* 主內容區域 - 桌面版留出更多空間給側邊欄 */
    main.container {
        max-width: 1000px;
        padding-right: 30px;
    }
    
    /* 表格不需要水平捲動 */
    .pokemon-table {
        min-width: auto;
    }
}

/* ===================================
   大螢幕優化 (> 1400px)
   =================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    #areas-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
}

/* ===================================
   列印樣式
   =================================== */
@media print {
    /* 隱藏非必要元素 */
    .floating-menu,
    #back-to-top,
    .ad-slot,
    header,
    footer {
        display: none !important;
    }
    
    /* 確保表格完整顯示 */
    .pokemon-table {
        page-break-inside: avoid;
    }
    
    .area-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===================================
   視窗調整大小時的平滑過渡
   =================================== */
@media (prefers-reduced-motion: no-preference) {
    .area-card,
    .pokemon-table,
    #areas-container {
        transition: all 0.3s ease;
    }
}

/* ===================================
   暗色模式支援 (預留)
   =================================== */
@media (prefers-color-scheme: dark) {
    /* 未來可新增暗色模式樣式 */
}
