/* ======================================================
   HF LIVE MONITOR V5.7 MASTER STYLE
   - Layout Fix: Controls aligned with separator |
   - Component: Global DX Monitor (No-Proxy)
   - Visuals: GSM Signal Bars, Highlight 3s
   ====================================================== */

/* --- 1. CORE & LAYOUT --- */
* { box-sizing: border-box; }
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: #0f0f0f; 
    color: #e0e0e0; 
    margin: 0; padding: 0; 
}
.main-container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* --- 2. HEADER & CLOCKS --- */
header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #4caf50; padding-bottom: 15px; margin-bottom: 20px; }
.header-left h2 { margin: 0; font-size: 1.5rem; color: #fff; }
.header-left h2 span { background:#4caf50; color:#000; padding:3px 6px; border-radius:4px; font-size:0.6em; margin-left:10px; font-weight:bold; vertical-align: middle; }
.credit-line { font-size: 0.85em; color: #888; margin-top: 5px; }
.clock-container { display: flex; gap: 15px; background: #1a1a1a; padding: 10px 15px; border-radius: 8px; border: 1px solid #333; }
#local-clock, #utc-clock { font-family: 'Courier New', monospace; font-size: 1.2rem; font-weight: bold; }
#utc-clock { color: #ff9800; }

/* --- 3. TOP TOOLS (PROPAGATION & DX MONITOR) --- */
.v21-tools-container { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }
.tool-card { background: #1a1a1a; border: 1px solid #333; border-radius: 8px; height: 210px; overflow: hidden; display: flex; flex-direction: column; }
.tool-header { background: #222; padding: 10px 15px; color: #ff9800; font-weight: bold; font-size: 0.85rem; border-bottom: 1px solid #333; }
.tool-content { flex: 1; display: flex; justify-content: center; align-items: center; background: #000; overflow: hidden; padding: 5px; }
.img-solar-fixed { max-width: 100%; max-height: 100%; object-fit: contain; }

.search-padding { padding: 15px; display: flex; flex-direction: column; flex: 1; }
.mini-table-wrapper { flex: 1; overflow-y: auto; background: #000; border: 1px solid #333; border-radius: 4px; }
.mini-table { width: 100%; font-size: 0.75rem; border-collapse: collapse; }
.mini-table td, .mini-table th { padding: 5px 10px; border-bottom: 1px solid #222; text-align: left; }
.mini-table th { background: #111; position: sticky; top: 0; color: #888; font-size: 0.65rem; }

/* --- 4. TABS & CONTROLS BAR --- */
.tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 15px; }
.tab-btn { background: #222; color: #aaa; border: 1px solid #333; padding: 8px 16px; cursor: pointer; border-radius: 4px; font-size: 0.9em; transition: 0.2s; }
.tab-btn.active { background: #4caf50; color: #000; font-weight: bold; }

.controls-bar { 
    display: flex; 
    gap: 10px; 
    background: #1a1a1a; 
    padding: 12px; 
    border-radius: 8px; 
    border: 1px solid #333; 
    align-items: center; 
    flex-wrap: wrap; 
}

#search-input, #mode-filter { 
    background: #000; 
    border: 1px solid #444; 
    color: #fff; 
    padding: 8px; 
    border-radius: 4px; 
}

/* ✅ Separator | */
.control-sep { 
    color: #444; 
    font-size: 1.5rem; 
    font-weight: 300; 
    margin: 0 5px; 
    user-select: none; 
}

/* ✅ Watch List & Alert Grouping */
.wl-toggle-btn { 
    background: #ff9800; 
    color: #000; 
    border: none; 
    padding: 8px 15px; 
    border-radius: 4px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: 0.2s; 
}
.wl-toggle-btn:hover { background: #e68a00; }

.alert-controls { 
    display: flex; 
    gap: 12px; 
    background: #000; 
    padding: 6px 15px; 
    border-radius: 4px; 
    border: 1px solid #444; 
    align-items: center; 
    margin-left: 5px; /* ชิดต่อจากเส้นกั้น */
}

.test-btn { background: none; border: none; color: #ff9800; font-size: 10px; cursor: pointer; font-family: monospace; }

/* --- 5. MAIN DATA TABLE --- */
.table-responsive { width: 100%; overflow-x: auto; background: #1a1a1a; border-radius: 8px; border: 1px solid #333; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th { background: #252525; color: #bbb; padding: 12px 15px; text-align: left; font-size: 0.8em; border-bottom: 1px solid #333; }
td { padding: 10px 15px; border-bottom: 1px solid #2a2a2a; vertical-align: middle; }

td a.call-link { color: #ffffff !important; font-weight: 800 !important; text-decoration: none !important; font-size: 1.05rem; }
td a.call-link:hover { color: #ff9800 !important; border-bottom: 2px solid #ff9800; }

/* ✅ GSM Signal Bars */
.signal-meter { display: inline-flex; align-items: flex-end; gap: 3px; height: 14px; }
.bar { width: 4px; background: #444; border-radius: 1px; }
.b1 { height: 4px; } .b2 { height: 7px; } .b3 { height: 10px; } .b4 { height: 14px; }
.sig-low .bar.active { background: #ff5252; box-shadow: 0 0 4px rgba(255,82,82,0.8); }
.sig-med .bar.active { background: #ffca28; box-shadow: 0 0 4px rgba(255,202,40,0.8); }
.sig-high .bar.active { background: #4caf50; box-shadow: 0 0 4px rgba(76,175,80,0.8); }

/* Badges */
.mode-badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8em; font-weight: bold; color: #000; display: inline-block; min-width: 45px; text-align: center; }
.band-80m, .band-40m { color: #ff5252; font-weight: bold; }
.band-20m, .band-15m { color: #ffeb3b; font-weight: bold; }
.band-10m { color: #4fc3f7; font-weight: bold; }

/* --- 6. ANIMATIONS --- */
@keyframes flashNew { 0% { background-color: rgba(76, 175, 80, 0.4); } 100% { background-color: transparent; } }
.new-row-highlight { animation: flashNew 3s ease-out; }

@keyframes flashWatch { 0% { background-color: rgba(255, 152, 0, 0.2); } 100% { background-color: rgba(255, 152, 0, 0.2); } }
.wl-flash-row { border-left: 4px solid #ff9800; animation: flashWatch 2.0s infinite; }
.wl-match-row-static { border-left: 4px solid #ff9800; background-color: rgba(255, 152, 0, 0.1); }

/* --- 7. TOASTS & MODALS --- */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 12000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { background: #1a1a1a; padding: 12px 15px; border-radius: 6px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); min-width: 280px; border-left: 5px solid #ff9800; animation: slideUp 0.4s ease-out forwards; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); }
.modal-content { background: #1a1a1a; margin: 10% auto; padding: 20px; border: 1px solid #ff9800; border-radius: 8px; width: 350px; }
.hidden { display: none !important; }

/* RESPONSIVE */
@media (max-width: 850px) { 
    .v21-tools-container { grid-template-columns: 1fr; } 
    header { flex-direction: column; text-align: center; } 
    .controls-bar { flex-direction: column; align-items: stretch; }
    .control-sep { display: none; }
}