/* notam/assets/css/style.css 
   (Lovart Design System: Dark Glassmorphism) 
*/

:root {
    /* Lovart Colors */
    --bg-dark: #1a2332;
    --primary: #FEEEA5;       /* 日出橘 (重點色) */
    --accent: #f0b90b;        /* 地圖高亮金黃色 */
    --text-white: #FFFFFF;
    --text-gray: rgba(255, 255, 255, 0.7);
    
    /* Glassmorphism */
    --glass-bg: rgba(30, 40, 55, 0.7); /* 深色半透明 */
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.15);
    --blur: blur(12px);
    --radius: 12px;
}

/* --- 全域設定 --- */
body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-dark);
    /* 使用城市夜景背景 */
    background-image: url('../../../assets/img/bg-city.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-white);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; transition: 0.3s; }

/* --- index.html (選擇頁) --- */
.hero-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 20px;
}

.hero-card {
    width: 100%;
    max-width: 1000px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: var(--blur);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.hero-intro {
    text-align: center;
    margin-bottom: 40px;
}

.hero-title {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--text-white);
}

.hero-subtitle { color: var(--text-gray); }

#location-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

.location-button {
    display: block;
    padding: 20px;
    background: var(--glass-bg);
    backdrop-filter: var(--blur);
    border: var(--glass-border);
    color: var(--text-white);
    text-align: center;
    border-radius: var(--radius);
    font-size: 1.1em;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.location-button:hover {
    transform: translateY(-5px);
    background: var(--glass-hover);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 8px 25px rgba(254,238,165, 0.3);
}

/* 更新時間 */
.update-info {
    margin-top: 40px;
    text-align: center;
}

#last-update-time {
    color: var(--primary);
    font-size: 0.9em;
    font-family: monospace;
}

/* 搜尋區塊玻璃化 */
.coord-search-section {
    margin-top: 30px;
    background: var(--glass-bg);
    backdrop-filter: var(--blur);
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.coord-search-title {
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.coord-search-title i { margin-right: 8px; font-size: 1.4em; }

.coord-search-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.coord-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
}

/* 按鈕樣式 */
.search-btn {
    background: linear-gradient(135deg, #FEEEA5 0%, #F6A170 100%);
    color: #1a2332;
    border: none;
    border-radius: 8px;
    padding: 12px 25px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(254,238,165, 0.4);
    transition: 0.3s;
}
.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(254,238,165, 0.6);
}

/* 錯誤訊息 */
.coord-error {
    color: #ff4444;
    margin-top: 10px;
    text-align: center;
    height: 20px;
}

/* --- map.html (地圖頁) --- */
body.map-page {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 52px;
    box-sizing: border-box;
}

/* --- 共用 Header (index + map) --- */
.app-header {
    display: flex;
    align-items: center;
    padding: 15px 30px;
    background: rgba(55, 58, 70, 0.88);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 1001;
    flex-shrink: 0;
}

.header-logo {
    display: flex;
    align-items: center;
    margin-right: 16px;
    flex-shrink: 0;
}
.header-logo img {
    height: 22px;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.header-logo:hover img { opacity: 1; }

.header-title {
    flex: 1;
    font-size: 1.05em;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-btn {
    color: var(--text-gray);
    font-size: 1em;
    margin-right: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: 0.2s;
}
.header-btn:hover { color: var(--primary); }

#map-title {
    margin: 0; font-size: 1.2em; color: var(--text-white); font-weight: 700; letter-spacing: 1px;
}

#map-container {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

/* 側邊欄 (列表) */
#sidebar {
    width: 400px;
    background: rgba(26, 35, 50, 0.9);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    padding: 15px;
}

/* 列表項目卡片 */
.notam-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
}

.notam-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 選中狀態 */
.notam-item.selected {
    background: rgba(254,238,165, 0.15); /* 橘色半透明 */
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(254,238,165, 0.2);
}

.notam-item-header {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 1.1em;
    display: flex; justify-content: space-between;
}

.notam-info-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 15px;
    font-size: 0.9em;
    color: var(--text-gray);
    margin-bottom: 15px;
}
.notam-info-grid span:nth-child(odd) { color: #aaa; } /* Label */
.notam-info-grid span:nth-child(even) { color: #fff; } /* Value */

.notam-message {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    line-height: 1.5;
    background: rgba(0,0,0,0.3);
    border-left: 3px solid var(--accent); /* 保持金黃色邊框 */
    padding: 12px;
    border-radius: 4px;
    color: #ddd;
    word-break: break-all;
    overflow-x: auto;
}

/* Leaflet 地圖覆寫 */
#map { flex-grow: 1; height: 100%; z-index: 1; }

.leaflet-tooltip {
    background-color: rgba(26, 35, 50, 0.9) !important;
    border: 1px solid var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
    border-radius: 6px;
    padding: 5px 10px;
}
.leaflet-tooltip-top:before { border-top-color: var(--primary) !important; }

/* 深色濾鏡 (保持地圖風格一致) */
.dark-mode-filter {
    filter: invert(100%) hue-rotate(180deg) brightness(85%) contrast(90%);
}

/* 篩選狀態：未命中 NOTAM 變暗 */
.notam-item.filter-dim {
    opacity: 0.25;
    pointer-events: none;
}

/* 篩選橫幅 */
.filter-banner {
    background: rgba(240, 185, 11, 0.15);
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-banner i { font-size: 1.2em; flex-shrink: 0; }

/* Leaflet 清除篩選 control */
.leaflet-control-clearfilter a {
    background: rgba(26, 35, 50, 0.92);
    color: var(--accent);
    border: 1px solid var(--accent) !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 14px;
    font-size: 0.95em;
    font-weight: 700;
    font-family: 'Noto Sans TC', sans-serif;
    white-space: nowrap;
    height: 34px;
    line-height: 1;
    text-decoration: none;
    transition: background 0.2s;
}
.leaflet-control-clearfilter a:hover {
    background: rgba(240, 185, 11, 0.2);
    color: #fff;
}

/* 拖拉條 (桌面版隱藏) */
#drag-handle { display: none; }

/* RWD */
@media (max-width: 768px) {
    #map-container { flex-direction: column; }
    #map {
        width: 100%;
        flex: 1 1 0;
        min-height: 120px;
    }
    #drag-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 28px;
        background: rgba(10, 16, 26, 0.88);
        border-top: 1px solid rgba(255,255,255,0.15);
        border-bottom: 1px solid rgba(255,255,255,0.15);
        cursor: ns-resize;
        flex-shrink: 0;
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
    }
    .drag-bar {
        width: 40px;
        height: 4px;
        background: rgba(255,255,255,0.35);
        border-radius: 2px;
    }
    #sidebar {
        width: 100%;
        height: 45vh;
        min-height: 80px;
        border-right: none;
        border-top: none;
        flex-shrink: 0;
        overflow-x: hidden;
    }
    .notam-item {
        overflow: hidden;
    }
    .notam-info-grid {
        font-size: 0.8em;
        word-break: break-word;
    }
    .notam-message {
        font-size: 0.75em;
    }
    .notam-item-header {
        flex-wrap: wrap;
    }
}