/* style.css - Pro Edition Final */

:root {
    --bg-main: #181818;
    --bg-panel: #252525;
    --bg-table-header: #333333;
    --bg-row-even: #2a2a2a;
    --bg-row-odd: #323232;
    --bg-hover: #444444;
    
    --text-main: #ffffff;
    --text-dim: #bbbbbb;
    --accent: #3cb863;
    
    /* Band Colors */
    --band-160m: #b860b8; --band-80m: #b860b8; --band-60m: #d29a3c; 
    --band-40m: #3ca2d2; --band-30m: #3cd29a; --band-20m: #d23c3c; 
    --band-17m: #d26d3c; --band-15m: #22d256; --band-12m: #a3a3a3; 
    --band-10m: #3c63d2; --band-6m: #a476ff; --band-2m: #ff7676; 
    --band-70cm: #76d6ff;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0; padding: 20px;
    font-size: 15px;
}

/* Layout */
.container { max-width: 1200px; margin: 0 auto; }

/* Header */
.header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #444; padding-bottom: 20px; margin-bottom: 20px;
}
.header h1 { margin: 0; font-size: 1.8em; letter-spacing: 1px; }
.status-badge { 
    background: var(--accent); color: #000; padding: 2px 8px; 
    border-radius: 4px; font-size: 0.5em; vertical-align: middle; font-weight: bold;
}
.time-box { 
    text-align: right; background: var(--bg-panel); 
    padding: 10px 20px; border-radius: 8px; border: 1px solid #444;
}
.time-label { font-size: 0.7em; color: var(--text-dim); margin-bottom: 4px; }
.time-main { font-size: 1.3em; font-weight: bold; font-family: monospace; }
.time-local-display::before { content: " / "; color: #666; font-weight: normal; }

/* Controls */
.controls { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 20px; flex-wrap: wrap; gap: 15px;
}
.nav-group { display: flex; gap: 10px; }
.right-controls { display: flex; align-items: center; gap: 15px; }
.filter-group { display: flex; align-items: center; gap: 10px; }

.control-btn {
    background: var(--bg-panel); border: 1px solid #555; color: #ddd;
    padding: 8px 16px; cursor: pointer; border-radius: 6px; font-size: 0.95em;
    transition: all 0.2s;
}
.control-btn:hover { background: #444; border-color: #777; }
.active-tab { 
    background: var(--accent); color: #000; font-weight: bold; border-color: var(--accent); 
}

.control-select {
    background: var(--bg-panel); border: 1px solid #555; color: #ddd;
    padding: 8px 12px; border-radius: 6px; font-size: 0.95em; cursor: pointer; outline: none;
}
.control-select:focus { border-color: var(--accent); }

.control-input { 
    background: var(--bg-panel); border: 1px solid #555; color: #fff; 
    padding: 8px 12px; border-radius: 6px; width: 80px; text-align: center; 
    text-transform: uppercase; font-size: 0.95em; outline: none; 
}

.refresh-btn { background: #336699; border-color: #336699; color: white; }
.refresh-btn:hover { background: #2a5580; }
.refresh-info { color: var(--text-dim); font-size: 0.9em; }

/* Band Tabs */
.band-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 10px; }
.band-tab { 
    background: var(--bg-panel); padding: 6px 14px; border-radius: 20px; 
    font-size: 0.9em; cursor: pointer; border: 1px solid #444; white-space: nowrap; color: #ccc;
}
.band-tab:hover { background: #444; color: #fff; }
.band-tab.active { background: #eee; color: #000; font-weight: bold; border-color: #fff; }

/* Table */
.spot-list-container { width: 100%; overflow-x: auto; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.3); }
.spot-table { width: 100%; border-collapse: collapse; min-width: 800px; background: var(--bg-panel); }

.spot-table th {
    background-color: var(--bg-table-header);
    color: #bbb; font-weight: 600; text-transform: uppercase; font-size: 0.8em;
    padding: 12px 15px; text-align: left; border-bottom: 2px solid #555; letter-spacing: 0.5px;
}
.spot-table td { padding: 10px 15px; border-bottom: 1px solid #333; vertical-align: middle; }

/* Alignment Helpers */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Zebra Striping */
.spot-table tbody tr:nth-child(odd) { background-color: var(--bg-row-odd); }
.spot-table tbody tr:nth-child(even) { background-color: var(--bg-row-even); }
.spot-table tbody tr:hover { background-color: var(--bg-hover); }

/* Column Styles */
.col-call { font-weight: bold; font-size: 1.1em; }
.col-call a { color: #fff; text-decoration: none; }
.col-call a:hover { color: var(--accent); text-decoration: underline; }

.col-type a { color: #ccc; text-decoration: none; }
.col-type a:hover { text-decoration: underline; color: #fff; }

.col-country { color: #eee; }
.col-band { font-weight: bold; }
.col-freq { font-family: 'Consolas', monospace; color: #64d2ff; font-weight: 500; }

/* Last Seen Alignment Fix */
.col-time { 
    color: #aaa; 
    font-size: 0.9em; 
    font-family: 'Consolas', monospace; /* สำคัญ: เพื่อให้ตัวเลขตรงกัน */
    font-variant-numeric: tabular-nums; 
}

/* Badges */
.badge-mode {
    padding: 3px 8px; border-radius: 4px; font-size: 0.8em; font-weight: bold; 
    display: inline-block; min-width: 45px; text-align: center; box-shadow: 0 2px 2px rgba(0,0,0,0.2);
}
.mode-cw { background: #ff9800; color: #000; }
.mode-ft8 { background: #ba68c8; color: #fff; }
.mode-ssb { background: #42a5f5; color: #fff; }
.mode-other { background: #78909c; color: #fff; }

/* --- 🚨 Alert Animation (Red Strobe) --- */
@keyframes flashAlert {
    0% { background-color: #b71c1c; color: #fff; }
    50% { background-color: #ffeb3b; color: #000; }
    100% { background-color: #b71c1c; color: #fff; }
}

/* สถานะปกติของ Watch List (สีม่วง) */
.watched-row {
    background-color: #2e003e !important; 
    border-left: 4px solid #ea80fc;
}

/* สถานะตื่นตัว (0-90 วินาทีแรก) */
.alert-row {
    animation: flashAlert 1s infinite; /* กระพริบตลอดเวลา */
    font-weight: bold;
    border-left: 5px solid #ff0000 !important;
}

/* General New Spot Highlight */
@keyframes flashNew {
    0% { background-color: #fff176; color: #000; }
    20% { background-color: #fdd835; color: #000; }
    100% { background-color: transparent; }
}
.new-row-highlight {
    animation: flashNew 3s ease-out;
}

/* Modal */
.hidden { display: none !important; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 1000; display: flex; justify-content: center; align-items: center; }
.modal-content { background: #333; padding: 20px; border-radius: 8px; width: 300px; border: 1px solid #555; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.modal-content h3 { margin-top: 0; color: #ea80fc; }
.input-group { display: flex; gap: 5px; margin-bottom: 5px; }
.input-group input { flex: 1; padding: 8px; border-radius: 4px; border: 1px solid #555; background: #222; color: white; text-transform: uppercase; }
.input-group button { background: #ea80fc; color: #000; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-weight: bold; }
.watch-list-items { list-style: none; padding: 0; margin: 10px 0 0; max-height: 200px; overflow-y: auto; }
.watch-list-items li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #444; }
.remove-watch-btn { color: #ff5252; cursor: pointer; font-weight: bold; }
.modal-footer { margin-top: 15px; text-align: right; }
.modal-footer button { background: #555; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; }