/* ========================================
   雲書苑AI教育系統授權學校查詢系統
   主樣式表
   ======================================== */

/* CSS 變數 */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #60a5fa;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f1f5f9;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 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);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

/* 基礎重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   Header 頂部導航
   ======================================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo i {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.logo-text {
    background: linear-gradient(to right, #fff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title {
    font-size: 1.25rem;
    font-weight: 500;
    opacity: 0.95;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dealer-info {
    background: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================
   主要內容區
   ======================================== */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* 模式切換器 */
.mode-switcher {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    background: var(--card-background);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: fit-content;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.mode-btn:hover {
    background: var(--background-color);
    color: var(--primary-color);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* 查詢區域 */
.query-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.query-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   地圖區域
   ======================================== */
.map-container {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
}

.map-header {
    text-align: center;
    margin-bottom: 24px;
}

.map-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.map-header h2 i {
    color: var(--primary-color);
}

.map-hint {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 學校統計概覽 */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.stat-item i {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.stat-item:nth-child(1) i {
    background: #d1fae5;
    color: #059669;
}

.stat-item:nth-child(2) i {
    background: #dbeafe;
    color: #2563eb;
}

.stat-item:nth-child(3) i {
    background: #e0e7ff;
    color: #4f46e5;
}

.stat-item:nth-child(4) i {
    background: #fce7f3;
    color: #db2777;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

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

/* 地圖圖例 */
.map-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    padding-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

.legend-color.has-schools {
    background: #22c55e;
}

.legend-color.no-schools {
    background: #64748b;
}

@media (max-width: 768px) {
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.25rem;
    }
}

.map-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    background: linear-gradient(145deg, #f0f9ff 0%, #e0f2fe 50%, #f0fdf4 100%);
    border-radius: var(--radius-lg);
    min-height: 550px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.taiwan-map {
    width: 100%;
    max-width: 550px;
    position: relative;
}

.taiwan-map svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.15));
}

/* 縣市路徑樣式 */
.taiwan-map svg path.county {
    fill: url(#county-gradient);
    fill: #64748b;
    stroke: #ffffff;
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.taiwan-map svg path.county:hover {
    fill: #3b82f6;
    stroke: #ffffff;
    stroke-width: 2.5;
    filter: drop-shadow(0 6px 12px rgba(59, 130, 246, 0.4));
    transform: scale(1.02);
}

.taiwan-map svg path.county.active {
    fill: #2563eb;
    stroke: #1d4ed8;
    stroke-width: 2.5;
    filter: drop-shadow(0 4px 12px rgba(37, 99, 235, 0.5));
}

.taiwan-map svg path.county.has-schools {
    fill: #22c55e;
}

.taiwan-map svg path.county.has-schools:hover {
    fill: #16a34a;
    filter: drop-shadow(0 6px 12px rgba(34, 197, 94, 0.4));
}

.taiwan-map svg path.county.has-schools.active {
    fill: #15803d;
    stroke: #166534;
}

/* 點擊動畫效果 */
.taiwan-map svg path.county.clicked {
    animation: countyPulse 0.4s ease;
}

@keyframes countyPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 8px 16px rgba(37, 99, 235, 0.5));
    }
    100% {
        transform: scale(1);
    }
}

/* 地圖提示框 */
.map-tooltip {
    position: fixed;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.1);
}

.map-tooltip.visible {
    opacity: 1;
}

.map-tooltip strong {
    font-size: 1.1rem;
    display: block;
    margin-bottom: 4px;
}

.map-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #334155;
}

/* 區域快速選擇 */
.region-selector {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.region-selector h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.region-selector h3 i {
    color: var(--primary-color);
}

.region-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.region-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.region-btn i {
    font-size: 0.85rem;
    opacity: 0.6;
}

.region-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #eff6ff;
}

.region-btn:hover i {
    opacity: 1;
}

.region-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.region-btn.active i {
    opacity: 1;
}

/* ========================================
   條件查詢區域
   ======================================== */
.search-container {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 32px;
}

.search-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.search-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-header h2 i {
    color: var(--primary-color);
    background: #eff6ff;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* 不同欄位的圖示顏色 */
.form-group.field-city label i {
    background: #dbeafe;
    color: #2563eb;
}

.form-group.field-district label i {
    background: #fce7f3;
    color: #db2777;
}

.form-group.field-type label i {
    background: #d1fae5;
    color: #059669;
}

.form-group.field-nature label i {
    background: #fef3c7;
    color: #d97706;
}

.form-group.field-name label i {
    background: #e0e7ff;
    color: #4f46e5;
}

/* 欄位 focus 時的邊框顏色 */
.form-group.field-city select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-group.field-district select:focus {
    border-color: #db2777;
    box-shadow: 0 0 0 4px rgba(219, 39, 119, 0.1);
}

.form-group.field-type select:focus {
    border-color: #059669;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
}

.form-group.field-nature select:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.1);
}

.form-group.field-name input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.form-group select,
.form-group input {
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    background: white;
    transition: var(--transition);
    cursor: pointer;
}

.form-group input {
    cursor: text;
}

.form-group select:hover,
.form-group input:hover {
    border-color: #cbd5e1;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-group select:disabled {
    background: var(--background-color);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 自訂 select 樣式 */
.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 44px;
}

/* ========================================
   自訂下拉選單元件
   ======================================== */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.custom-select-trigger:hover {
    border-color: #cbd5e1;
}

.custom-select.open .custom-select-trigger {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.custom-select-trigger .selected-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-trigger .selected-value.placeholder {
    color: var(--text-secondary);
}

.custom-select-trigger .arrow {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.custom-select.open .custom-select-trigger .arrow {
    transform: rotate(180deg);
}

/* 下拉選單面板 */
.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    max-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.custom-select.open .custom-select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 搜尋框 */
.custom-select-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.custom-select-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.custom-select-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.custom-select-search input::placeholder {
    color: var(--text-secondary);
}

/* 選項列表 */
.custom-select-options {
    overflow-y: auto;
    max-height: 320px;
    padding: 8px 0;
}

/* 區域群組標題 */
.custom-select-group {
    padding: 0 8px;
    margin-bottom: 4px;
}

.custom-select-group:not(:first-child) {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.custom-select-group-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-select-group-label i {
    font-size: 0.7rem;
}

/* 北部區域 */
.custom-select-group[data-region="north"] .custom-select-group-label {
    color: #2563eb;
}

/* 中部區域 */
.custom-select-group[data-region="central"] .custom-select-group-label {
    color: #059669;
}

/* 南部區域 */
.custom-select-group[data-region="south"] .custom-select-group-label {
    color: #dc2626;
}

/* 東部區域 */
.custom-select-group[data-region="east"] .custom-select-group-label {
    color: #7c3aed;
}

/* 離島區域 */
.custom-select-group[data-region="island"] .custom-select-group-label {
    color: #0891b2;
}

/* 選項項目 */
.custom-select-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 2px 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.custom-select-option:hover {
    background: #f1f5f9;
}

.custom-select-option.selected {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: var(--primary-color);
    font-weight: 600;
}

.custom-select-option.selected::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.8rem;
    color: var(--primary-color);
}

/* 區域指示圓點 */
.custom-select-option .region-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* 北部 - 藍色 */
.custom-select-option[data-region="north"] .region-dot {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.4);
}

/* 中部 - 綠色 */
.custom-select-option[data-region="central"] .region-dot {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.4);
}

/* 南部 - 紅色 */
.custom-select-option[data-region="south"] .region-dot {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

/* 東部 - 紫色 */
.custom-select-option[data-region="east"] .region-dot {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.4);
}

/* 離島 - 青色 */
.custom-select-option[data-region="island"] .region-dot {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    box-shadow: 0 2px 4px rgba(6, 182, 212, 0.4);
}

.custom-select-option .option-text {
    flex: 1;
}

.custom-select-option .option-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 10px;
}

.custom-select-option.selected .option-count {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-color);
}

/* 全部選項 */
.custom-select-option.option-all {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    margin: 0 0 8px 0;
    border-radius: 0;
    padding: 14px 16px;
    font-weight: 500;
}

.custom-select-option.option-all:hover {
    background: #f1f5f9;
}

.custom-select-option.option-all.selected {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

/* 無結果 */
.custom-select-no-results {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.custom-select-no-results i {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* 學校類型下拉選單選項 */
.custom-select-option .type-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* 國小 */
.custom-select-option[data-type="elementary"] .type-icon {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #db2777;
}

/* 國中 */
.custom-select-option[data-type="junior"] .type-icon {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4f46e5;
}

/* 高中職 */
.custom-select-option[data-type="senior"] .type-icon {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

/* 一般大學 */
.custom-select-option[data-type="university"] .type-icon {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

/* 技專校院 */
.custom-select-option[data-type="tech"] .type-icon {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

/* 學校性質下拉選單選項 */
.custom-select-option[data-nature="public"] .nature-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.custom-select-option[data-nature="private"] .nature-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 禁用狀態 */
.custom-select.disabled .custom-select-trigger {
    background: var(--background-color);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 不同欄位的 focus 顏色 */
.form-group.field-city .custom-select.open .custom-select-trigger {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-group.field-district .custom-select.open .custom-select-trigger {
    border-color: #db2777;
    box-shadow: 0 0 0 4px rgba(219, 39, 119, 0.1);
}

.form-group.field-type .custom-select.open .custom-select-trigger {
    border-color: #059669;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
}

.form-group.field-nature .custom-select.open .custom-select-trigger {
    border-color: #d97706;
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.1);
}

.form-actions {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* 按鈕樣式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   查詢結果區域
   ======================================== */
.results-section {
    margin-top: 24px;
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
}

/* 區域統計 */
.area-stats {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #f0fdf4 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}

.area-stats.show {
    display: grid;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.area-stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid #ccc;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

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

.area-stat-item.active {
    box-shadow: 0 0 0 2px var(--primary-color), var(--shadow-md);
}

.area-stat-item.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.7rem;
    color: var(--primary-color);
}

.area-stat-item.elementary {
    border-left-color: #ec4899;
}

.area-stat-item.elementary.active {
    box-shadow: 0 0 0 2px #ec4899, var(--shadow-md);
}

.area-stat-item.elementary.active::after {
    color: #ec4899;
}

.area-stat-item.junior {
    border-left-color: #6366f1;
}

.area-stat-item.junior.active {
    box-shadow: 0 0 0 2px #6366f1, var(--shadow-md);
}

.area-stat-item.junior.active::after {
    color: #6366f1;
}

.area-stat-item.senior {
    border-left-color: #3b82f6;
}

.area-stat-item.senior.active {
    box-shadow: 0 0 0 2px #3b82f6, var(--shadow-md);
}

.area-stat-item.senior.active::after {
    color: #3b82f6;
}

.area-stat-item.university {
    border-left-color: #10b981;
}

.area-stat-item.university.active {
    box-shadow: 0 0 0 2px #10b981, var(--shadow-md);
}

.area-stat-item.university.active::after {
    color: #10b981;
}

.area-stat-item i {
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.area-stat-item.elementary i {
    background: #fce7f3;
    color: #db2777;
}

.area-stat-item.junior i {
    background: #e0e7ff;
    color: #4f46e5;
}

.area-stat-item.senior i {
    background: #dbeafe;
    color: #2563eb;
}

.area-stat-item.university i {
    background: #d1fae5;
    color: #059669;
}

.area-stat-item .count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.area-stat-item .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .area-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-header h2 i {
    color: var(--primary-color);
}

.results-stats {
    display: flex;
    align-items: center;
    gap: 16px;
}

#results-count {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

#results-count strong {
    color: var(--primary-color);
    font-weight: 600;
}

.results-container {
    min-height: 200px;
}

/* 空狀態 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1.1rem;
}

/* 學校卡片列表 */
.school-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.school-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 0;
    border: none;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 公立學校樣式 */
.school-card.nature-public::after {
    content: '公';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}

/* 私立學校特殊樣式 */
.school-card.nature-private {
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
    border: 1px solid #fde68a;
}

.school-card.nature-private::after {
    content: '私';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.3);
}

/* 學校卡片頂部顏色條 */
.school-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
}

.school-card.type-elementary::before {
    background: linear-gradient(90deg, #ec4899, #f472b6);
}

.school-card.type-junior::before {
    background: linear-gradient(90deg, #6366f1, #818cf8);
}

.school-card.type-senior::before {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.school-card.type-university::before,
.school-card.type-tech::before {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.school-card.type-medical::before {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.school-card.type-normal::before {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.school-card.type-art::before {
    background: linear-gradient(90deg, #a855f7, #c084fc);
}

.school-card.type-sport::before {
    background: linear-gradient(90deg, #f97316, #fb923c);
}

.school-card.type-religious::before {
    background: linear-gradient(90deg, #78716c, #a8a29e);
}

.school-card.type-open::before {
    background: linear-gradient(90deg, #06b6d4, #22d3ee);
}

.school-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

.school-card.nature-private:hover {
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
}

.school-card-inner {
    padding: 20px;
}

.school-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
}

.school-card-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.school-type-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.school-card.type-elementary .school-type-icon {
    background: #fce7f3;
    color: #db2777;
}

.school-card.type-junior .school-type-icon {
    background: #e0e7ff;
    color: #4f46e5;
}

.school-card.type-senior .school-type-icon {
    background: #dbeafe;
    color: #2563eb;
}

.school-card.type-university .school-type-icon,
.school-card.type-tech .school-type-icon {
    background: #d1fae5;
    color: #059669;
}

.school-card.type-medical .school-type-icon {
    background: #fee2e2;
    color: #dc2626;
}

.school-card.type-normal .school-type-icon {
    background: #fef3c7;
    color: #d97706;
}

.school-card.type-art .school-type-icon {
    background: #fae8ff;
    color: #a855f7;
}

.school-card.type-sport .school-type-icon {
    background: #ffedd5;
    color: #ea580c;
}

.school-card.type-religious .school-type-icon {
    background: #f5f5f4;
    color: #78716c;
}

.school-card.type-open .school-type-icon {
    background: #cffafe;
    color: #0891b2;
}

.school-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 4px;
}

.school-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.badge {
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-type {
    background: #dbeafe;
    color: #1e40af;
}

/* 學校類型顏色區分 */
.badge-type.elementary {
    background: #fce7f3;
    color: #be185d;
}

.badge-type.junior {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-type.senior {
    background: #dbeafe;
    color: #1e40af;
}

.badge-type.university,
.badge-type.tech {
    background: #d1fae5;
    color: #065f46;
}

.badge-type.medical {
    background: #fee2e2;
    color: #991b1b;
}

.badge-type.normal {
    background: #fef3c7;
    color: #92400e;
}

.badge-type.art {
    background: #fae8ff;
    color: #86198f;
}

.badge-type.sport {
    background: #ffedd5;
    color: #c2410c;
}

.badge-type.religious {
    background: #f5f5f4;
    color: #57534e;
}

.badge-type.military {
    background: #e5e7eb;
    color: #374151;
}

.badge-type.open {
    background: #ecfeff;
    color: #0e7490;
}

.badge-nature {
    background: #dcfce7;
    color: #166534;
}

.badge-nature.private {
    background: #fef3c7;
    color: #92400e;
}

.school-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.school-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.school-info-item i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.school-info-item span {
    flex: 1;
    line-height: 1.4;
}

/* 分頁 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination button {
    min-width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Modal 彈窗
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px;
    border-bottom: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

/* Modal 標題區不同學校類型的顏色 */
.modal-header.type-elementary {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.modal-header.type-junior {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.modal-header.type-senior {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.modal-header.type-university,
.modal-header.type-tech {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.modal-header-content {
    position: relative;
    z-index: 1;
    flex: 1;
}

.modal-header h3 {
    font-size: 1.4rem;
    color: white;
    margin-bottom: 12px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-badge {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(4px);
}

.modal-badge.badge-nature {
    background: rgba(255, 255, 255, 0.25);
}

.modal-badge.badge-nature.private {
    background: rgba(251, 191, 36, 0.3);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 0;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
}

.modal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.modal-info-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.modal-info-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.modal-info-item:hover {
    background: #f8fafc;
}

.modal-info-item:last-child {
    border-bottom: none;
}

.modal-info-item i {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    flex-shrink: 0;
}

/* 不同類型資訊的圖示顏色 */
.modal-info-item.info-type i {
    background: #dbeafe;
    color: #2563eb;
}

.modal-info-item.info-nature i {
    background: #dcfce7;
    color: #16a34a;
}

.modal-info-item.info-city i {
    background: #fef3c7;
    color: #d97706;
}

.modal-info-item.info-address i {
    background: #e0e7ff;
    color: #4f46e5;
}

.modal-info-item.info-phone i {
    background: #d1fae5;
    color: #059669;
}

.modal-info-item.info-website i {
    background: #fce7f3;
    color: #db2777;
}

.modal-info-item .info-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-info-item .info-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-info-item .info-value {
    font-size: 1.05rem;
    color: var(--text-primary);
    font-weight: 600;
}

.modal-info-item .info-value a {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.modal-info-item .info-value a:hover {
    text-decoration: underline;
}

.modal-info-item .info-value a::after {
    content: '\f35d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Modal 底部動作按鈕 */
.modal-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    background: var(--background-color);
    border-top: 1px solid var(--border-color);
}

.modal-actions .btn {
    flex: 1;
}

.modal-actions .btn i {
    margin-right: 8px;
}

@media (max-width: 480px) {
    .modal-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   申請本校功能
   ======================================== */

/* 申請按鈕區域 */
.modal-apply-section {
    padding: 20px 24px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-top: 1px solid #bae6fd;
}

.modal-apply-section.modal-apply-top {
    border-top: none;
    border-bottom: 1px solid #bae6fd;
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    border-radius: 0;
}

.btn-apply {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.btn-apply:hover {
    background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4);
}

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

.btn-apply i {
    font-size: 1.2rem;
}

/* 申請表單容器 */
.apply-form-container {
    padding: 0;
}

.apply-form-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-bottom: 1px solid #bae6fd;
    font-weight: 600;
    color: var(--primary-color);
}

.apply-form-header i {
    font-size: 1.25rem;
}

.apply-form {
    padding: 24px;
}

.apply-form-group {
    margin-bottom: 20px;
}

.apply-form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

.apply-form-group label i {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.apply-form-group .required {
    color: #ef4444;
}

.apply-form-group input,
.apply-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.apply-form-group input:focus,
.apply-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.apply-form-group input::placeholder,
.apply-form-group textarea::placeholder {
    color: #9ca3af;
}

.apply-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.apply-form-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
}

.apply-form-divider::before,
.apply-form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #cbd5e1, transparent);
}

.apply-form-divider span {
    padding: 0 16px;
    color: #10b981;
}

/* 產品選項列表 */
.apply-products-group > label {
    margin-bottom: 12px;
}

.apply-products-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.product-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.product-checkbox:nth-child(1) { border-left-color: #3b82f6; }
.product-checkbox:nth-child(2) { border-left-color: #6366f1; }
.product-checkbox:nth-child(3) { border-left-color: #8b5cf6; }
.product-checkbox:nth-child(4) { border-left-color: #ec4899; }
.product-checkbox:nth-child(5) { border-left-color: #f43f5e; }
.product-checkbox:nth-child(6) { border-left-color: #f97316; }
.product-checkbox:nth-child(7) { border-left-color: #10b981; }
.product-checkbox:nth-child(8) { border-left-color: #64748b; }

.product-checkbox:hover {
    background: #f8fafc;
    transform: translateX(4px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.product-checkbox:has(input:checked) {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}

.product-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #3b82f6;
    cursor: pointer;
    flex-shrink: 0;
}

.product-checkbox span {
    color: #334155;
    font-size: 0.95rem;
    font-weight: 500;
}

.product-checkbox.product-other {
    flex-wrap: wrap;
}

.product-checkbox.product-other input[type="text"] {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-left: auto;
}

.product-checkbox.product-other input[type="text"]:disabled {
    background: #f1f5f9;
    color: #94a3b8;
}

.product-checkbox.product-other input[type="text"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.apply-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.apply-form-actions .btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.apply-form-actions .btn-secondary {
    background: #f1f5f9;
    color: #64748b;
    border: 2px solid #e2e8f0;
}

.apply-form-actions .btn-secondary:hover {
    background: #e2e8f0;
    color: #475569;
}

.apply-form-actions .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.apply-form-actions .btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.apply-form-actions .btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

/* 申請結果頁面 */
.apply-result {
    padding: 48px 24px;
    text-align: center;
}

.apply-result .result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.apply-success .result-icon {
    color: #10b981;
}

.apply-result h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-color);
}

.apply-result p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.apply-result .result-note {
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 16px;
    margin-bottom: 24px;
}

.apply-result .btn {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
}

/* 錯誤訊息 */
.apply-error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #dc2626;
    font-size: 0.95rem;
    margin: 16px 24px 0;
}

.apply-error-message i {
    font-size: 1.1rem;
}

/* 響應式調整 */
@media (max-width: 480px) {
    .apply-form {
        padding: 16px;
    }

    .apply-form-actions {
        flex-direction: column;
    }

    .apply-form-actions .btn {
        width: 100%;
    }

    .btn-apply {
        padding: 14px 20px;
        font-size: 1rem;
    }

    .apply-result {
        padding: 32px 16px;
    }

    .apply-result .result-icon {
        font-size: 3rem;
    }
}

/* ========================================
   Footer 頁尾
   ======================================== */
.footer {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 48px 24px 24px;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 32px;
}

.footer-brand-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.6rem;
    font-weight: 700;
}

.footer-brand i {
    font-size: 2.2rem;
    color: #60a5fa;
}

.footer-desc {
    font-size: 1rem;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

.footer-divider {
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #60a5fa, transparent);
    border-radius: 1px;
}

.footer-contact {
    width: 100%;
}

.contact-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 32px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: var(--transition);
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.contact-item i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(96, 165, 250, 0.15);
    border-radius: 6px;
    color: #60a5fa;
    font-size: 0.8rem;
}

.contact-item a {
    color: #93c5fd;
    text-decoration: none;
    transition: var(--transition);
}

.contact-item a:hover {
    color: white;
}

.footer-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding-top: 28px;
    margin-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-bottom p {
    font-size: 0.85rem;
    opacity: 0.6;
    margin: 0;
}

.footer-separator {
    opacity: 0.3;
    font-size: 0.85rem;
}

.footer-note {
    font-size: 0.85rem;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .contact-grid {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .contact-item {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 8px;
    }

    .footer-separator {
        display: none;
    }
}

/* ========================================
   響應式設計
   ======================================== */

/* 大螢幕 (1400px+) */
@media (min-width: 1400px) {
    .school-list {
        grid-template-columns: repeat(3, 1fr);
    }

    .stats-overview {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 平板橫向 (1024px - 1399px) */
@media (max-width: 1399px) {
    .school-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板直向 (768px - 1023px) */
@media (max-width: 1023px) {
    .header-content {
        padding: 12px 20px;
    }

    .map-wrapper {
        min-height: 450px;
        padding: 20px;
    }

    .taiwan-map {
        max-width: 450px;
    }

    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .area-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手機大螢幕 (576px - 767px) */
@media (max-width: 767px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .logo {
        font-size: 1.25rem;
    }

    .logo i {
        font-size: 1.5rem;
    }

    .title {
        font-size: 1rem;
    }

    .dealer-info {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .main-container {
        padding: 16px;
    }

    .mode-switcher {
        width: 100%;
        justify-content: center;
    }

    .mode-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .mode-btn i {
        font-size: 1rem;
    }

    .map-container,
    .search-container,
    .results-section {
        padding: 20px;
        border-radius: var(--radius-md);
    }

    .map-header h2 {
        font-size: 1.25rem;
    }

    .map-wrapper {
        min-height: 380px;
        padding: 15px;
        border-radius: var(--radius-md);
    }

    .taiwan-map {
        max-width: 100%;
    }

    .stats-overview {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 16px;
    }

    .stat-item {
        padding: 10px 12px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .region-buttons {
        justify-content: center;
    }

    .region-btn {
        flex: 1 1 calc(50% - 6px);
        text-align: center;
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .search-header h2 {
        font-size: 1.25rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .form-group select,
    .form-group input {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .results-header h2 {
        font-size: 1.1rem;
    }

    .results-stats {
        width: 100%;
        justify-content: space-between;
    }

    .area-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 12px;
    }

    .area-stat-item {
        padding: 10px 12px;
    }

    .area-stat-item .count {
        font-size: 1.25rem;
    }

    .area-stat-item .label {
        font-size: 0.75rem;
    }

    .school-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .school-card-inner {
        padding: 16px;
    }

    .school-type-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .school-name {
        font-size: 1rem;
    }

    .school-badges {
        margin-top: 4px;
    }

    .badge {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    .school-info {
        padding-top: 12px;
        gap: 8px;
    }

    .school-info-item {
        font-size: 0.85rem;
    }

    .school-info-item i {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .pagination {
        gap: 6px;
    }

    .pagination button {
        min-width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    /* Modal 響應式 */
    .modal-content {
        margin: 16px;
        max-height: 85vh;
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 20px;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }

    .modal-badges {
        gap: 6px;
    }

    .modal-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    .modal-info-item {
        padding: 16px 20px;
    }

    .modal-info-item i {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .modal-info-item .info-value {
        font-size: 0.95rem;
    }

    /* Footer 響應式 */
    .footer {
        padding: 32px 16px 20px;
    }

    .footer-brand {
        font-size: 1.25rem;
    }

    .footer-brand i {
        font-size: 1.5rem;
    }

    .footer-bottom {
        padding-top: 20px;
        margin-top: 20px;
    }
}

/* 手機小螢幕 (< 576px) */
@media (max-width: 575px) {
    .main-container {
        padding: 12px;
    }

    .map-container,
    .search-container,
    .results-section {
        padding: 16px;
    }

    .stats-overview {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 12px;
    }

    .stat-item {
        flex-direction: column;
        text-align: center;
        padding: 12px 8px;
        gap: 8px;
    }

    .stat-item i {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    .region-btn {
        flex: 1 1 100%;
        padding: 12px;
    }

    .area-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .area-stat-item {
        flex-direction: column;
        text-align: center;
        padding: 12px 8px;
        gap: 6px;
    }

    .school-card.nature-public::after,
    .school-card.nature-private::after {
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
        top: 10px;
        right: 10px;
    }

    .modal-content {
        margin: 8px;
        max-height: 92vh;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-info-item {
        padding: 14px 16px;
        gap: 12px;
    }

    .footer {
        padding: 24px 12px 16px;
    }

    .footer-main {
        gap: 24px;
    }

    .footer-brand {
        font-size: 1.1rem;
    }

    .footer-brand i {
        font-size: 1.4rem;
    }

    .footer-desc {
        font-size: 0.9rem;
    }

    .contact-item {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .contact-item i {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
}

/* 超小螢幕 (< 400px) */
@media (max-width: 399px) {
    .logo {
        font-size: 1.1rem;
    }

    .logo i {
        font-size: 1.25rem;
    }

    .mode-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .mode-btn i {
        display: none;
    }

    .stats-overview {
        grid-template-columns: 1fr;
    }

    .stat-item {
        flex-direction: row;
    }

    .area-stats {
        grid-template-columns: 1fr;
    }

    .area-stat-item {
        flex-direction: row;
    }

    .school-card-title {
        flex-direction: column;
        align-items: flex-start;
    }

    .school-type-icon {
        width: 32px;
        height: 32px;
    }
}

/* ========================================
   自訂下拉選單響應式
   ======================================== */
@media (max-width: 767px) {
    .custom-select-dropdown {
        max-height: 350px;
    }

    .custom-select-option {
        padding: 10px 14px;
    }

    .custom-select-group-label {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
}

@media (max-width: 575px) {
    .custom-select-trigger {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .custom-select-dropdown {
        max-height: 320px;
    }

    .custom-select-search {
        padding: 10px 12px;
    }

    .custom-select-search input {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .custom-select-option {
        padding: 10px 12px;
        gap: 10px;
        font-size: 0.9rem;
    }

    .custom-select-option .type-icon {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .custom-select-option .nature-badge {
        width: 20px;
        height: 20px;
        font-size: 0.6rem;
    }

    .custom-select-option .option-count {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}

/* ========================================
   載入動畫
   ======================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 選取高亮 */
::selection {
    background: var(--primary-light);
    color: white;
}
