/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0e17;
  --bg2: #111827;
  --bg3: #1a2236;
  --border: #1e293b;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --accent: #00f0ff;
  --accent2: #7c3aed;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --pink: #ec4899;
  --radius: 8px;
  --font: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.5;
}

/* ===== NOTIFICATION TOAST ===== */
.my-notification {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  z-index: 9999;
  transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 8px 32px rgba(0, 240, 255, 0.3);
  white-space: nowrap;
}

.my-notification.show {
  top: 20px;
}

/* ===== HEADER ===== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.header-left { display: flex; align-items: center; gap: 12px; }

.logo {
  font-size: 32px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

h1 { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.accent { color: var(--accent); }
.subtitle { font-size: 11px; color: var(--text2); letter-spacing: 0.5px; }

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

.status-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; background: var(--bg3); border-radius: 20px;
  font-size: 12px; border: 1px solid var(--border);
}

.status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--orange); animation: blink 1.5s ease-in-out infinite;
}

.status-pill.connected .dot { background: var(--green); animation: none; box-shadow: 0 0 8px var(--green); }
.status-pill.disconnected .dot { background: var(--red); animation: none; }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.stat-box {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 12px; background: var(--bg3); border-radius: var(--radius);
  border: 1px solid var(--border);
}

.stat-label { font-size: 9px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 16px; font-weight: 700; color: var(--accent); }

/* ===== TABS ===== */
.tabs {
  display: flex; gap: 2px; padding: 0 24px;
  background: var(--bg2); border-bottom: 1px solid var(--border); overflow-x: auto;
}

.tab {
  padding: 12px 20px; background: none; border: none; color: var(--text2);
  font-family: var(--font); font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.2s; white-space: nowrap;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== TAB CONTENT ===== */
.tab-content { display: none; padding: 16px 24px; animation: fadeIn 0.2s; }
.tab-content.active { display: block; }

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

/* ===== MY RADIO TAB ===== */
.my-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}

.radio-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.radio-card h3 { font-size: 14px; margin-bottom: 12px; }

.hero-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  border: 1px solid var(--accent);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.05);
  flex-wrap: wrap;
}

.radio-icon { font-size: 64px; }

.radio-info { flex: 1; min-width: 200px; }
.radio-callsign { font-size: 36px; font-weight: 800; color: var(--accent); letter-spacing: 2px; }
.radio-detail { font-size: 13px; color: var(--text2); margin-top: 2px; }

.radio-status-box {
  text-align: center; padding: 16px 24px;
  background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border); min-width: 180px;
}

.radio-status-label { font-size: 9px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.radio-status-count { font-size: 48px; font-weight: 800; color: var(--accent); line-height: 1; margin: 4px 0; }
.radio-status-sub { font-size: 11px; color: var(--text2); }

/* Nearby Repeaters */
.nearby-list { display: flex; flex-direction: column; gap: 8px; }

.nearby-item {
  padding: 10px 12px; background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border); transition: all 0.2s;
}

.nearby-item.online { border-left: 3px solid var(--green); }
.nearby-item:hover { border-color: var(--accent); }
.nearby-header { display: flex; justify-content: space-between; align-items: center; }
.nearby-call { font-weight: 700; font-size: 14px; }
.nearby-dist { color: var(--accent); font-weight: 700; font-size: 13px; }
.nearby-freq { font-size: 11px; color: var(--accent); margin-top: 4px; font-family: var(--font); }
.nearby-loc { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* My TX List */
.my-tx-list { display: flex; flex-direction: column; gap: 4px; min-height: 100px; }

.my-tx-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border); font-size: 12px;
}

.my-tx-row.tx-out { border-left: 3px solid var(--accent); }
.my-tx-row.tx-in { border-left: 3px solid var(--green); }
.my-tx-dir { font-weight: 700; white-space: nowrap; }
.my-tx-time { color: var(--text2); white-space: nowrap; }
.my-tx-target { flex: 1; color: var(--text); }
.my-tx-dur { color: var(--accent); font-weight: 600; }

.empty-state { text-align: center; padding: 30px; color: var(--text2); }
.empty-icon { font-size: 40px; margin-bottom: 8px; }
.empty-hint { font-size: 11px; margin-top: 8px; max-width: 300px; margin-inline: auto; }

/* Checklist */
.checklist { display: flex; flex-direction: column; gap: 10px; }

.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border); font-size: 12px; cursor: pointer;
}

.check-item input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* My Row Highlight */
tr.my-row {
  background: rgba(0, 240, 255, 0.06) !important;
  border-left: 3px solid var(--accent);
}

tr.my-row td:first-child { padding-left: 8px; }

.highlight-label {
  background: rgba(0, 240, 255, 0.1);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0, 240, 255, 0.2);
}

/* ===== CONTROLS ===== */
.controls { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.filter-input, .lookup-input {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius); font-family: var(--font);
  font-size: 13px; outline: none; transition: border-color 0.2s;
}

.filter-input { flex: 1; min-width: 200px; }
.lookup-input { width: 300px; }
.filter-input:focus, .lookup-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.1); }

.checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text2); cursor: pointer; white-space: nowrap;
}

.checkbox-label input[type="checkbox"] { accent-color: var(--accent); }

.btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; color: #000; font-family: var(--font);
  font-size: 12px; font-weight: 700; border-radius: var(--radius);
  cursor: pointer; transition: all 0.2s;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 240, 255, 0.3); }
.btn-sm { padding: 6px 12px; font-size: 11px; }

/* ===== LIVE TABLE ===== */
.table-wrap {
  overflow-x: auto; max-height: calc(100vh - 240px); overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2);
}

table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead { position: sticky; top: 0; z-index: 10; }

th {
  background: var(--bg3); color: var(--accent); padding: 10px 8px; text-align: left;
  font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}

td { padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
tr { transition: background 0.15s; }
tr:hover { background: rgba(0, 240, 255, 0.03); }
tr.new-row { animation: rowFlash 1s ease-out; }

@keyframes rowFlash {
  from { background: rgba(0, 240, 255, 0.15); }
  to { background: transparent; }
}

.call-link { color: var(--accent); cursor: pointer; text-decoration: none; }
.call-link:hover { text-decoration: underline; }

.tag { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.tag-voice { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.tag-data { background: rgba(124, 58, 237, 0.15); color: var(--accent2); }
.tag-group { background: rgba(0, 240, 255, 0.1); color: var(--accent); }
.tag-private { background: rgba(236, 72, 153, 0.1); color: var(--pink); }
.rssi-good { color: var(--green); }
.rssi-mid { color: var(--orange); }
.rssi-bad { color: var(--red); }
.rssi-na { color: var(--text2); }

/* ===== MAP ===== */
#map {
  height: calc(100vh - 260px); min-height: 400px;
  border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden;
}

.map-status { font-size: 12px; color: var(--text2); }

.leaflet-popup-content-wrapper {
  background: var(--bg2) !important; color: var(--text) !important;
  border-radius: var(--radius) !important; border: 1px solid var(--border) !important;
  font-family: var(--font) !important; font-size: 12px !important;
}

.leaflet-popup-tip { background: var(--bg2) !important; }
.leaflet-popup-content { margin: 12px !important; }
.popup-title { color: var(--accent); font-weight: 700; font-size: 14px; margin-bottom: 4px; }

/* ===== LOOKUP ===== */
.lookup-box { max-width: 700px; }
.lookup-box h2 { font-size: 18px; margin-bottom: 16px; }
.lookup-row { display: flex; gap: 8px; margin-bottom: 16px; }

.lookup-result {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; min-height: 100px;
}

.result-card { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.result-field { display: flex; flex-direction: column; }
.result-field .label { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.result-field .value { font-size: 16px; font-weight: 600; color: var(--accent); }

/* ===== TALKGROUPS ===== */
.tg-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}

.tg-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; transition: all 0.2s; cursor: pointer;
}

.tg-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tg-id { font-size: 20px; font-weight: 700; color: var(--accent); }
.tg-name { font-size: 12px; color: var(--text); margin-top: 4px; }
.tg-desc { font-size: 10px; color: var(--text2); margin-top: 2px; }

/* ===== STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}

.stat-card.wide { grid-column: 1 / -1; }
.stat-card h3 { font-size: 14px; margin-bottom: 12px; }

.stat-list .stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}

.stat-row .stat-name { color: var(--text); }
.stat-row .stat-count { color: var(--accent); font-weight: 700; }

.stat-bar { height: 4px; background: var(--bg3); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.stat-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 2px; transition: width 0.3s; }

#activityChart {
  width: 100% !important; height: 200px !important;
  background: var(--bg3); border-radius: var(--radius);
}

/* ===== SETUP GUIDE ===== */
.guide { max-width: 800px; }
.guide h2 { font-size: 22px; margin-bottom: 8px; }
.guide-subtitle { color: var(--text2); margin-bottom: 24px; font-size: 13px; }

.guide-step {
  display: flex; gap: 16px; margin-bottom: 24px;
  padding: 20px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px;
}

.step-number {
  width: 40px; height: 40px; min-width: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #000;
}

.step-content { flex: 1; }
.step-content h3 { font-size: 16px; margin-bottom: 8px; }
.step-content p { color: var(--text2); margin-bottom: 8px; font-size: 13px; }

.guide-link { color: var(--accent); text-decoration: underline; }
.guide-link:hover { color: #fff; }

.code-block {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; font-size: 12px; margin: 10px 0; line-height: 1.8;
  overflow-x: auto;
}

.setup-table { width: 100%; border-collapse: collapse; }
.setup-table th { text-align: left; color: var(--accent); padding: 4px 12px 4px 0; font-size: 11px; }
.setup-table td { padding: 4px 12px 4px 0; font-size: 12px; }

.repeater-setup { margin: 16px 0; }
.repeater-setup h4 { font-size: 14px; margin-bottom: 8px; color: var(--green); }

.guide-list {
  padding-left: 20px; color: var(--text2); font-size: 13px;
  display: flex; flex-direction: column; gap: 6px;
}

.guide-list li { line-height: 1.6; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  header { padding: 12px 16px; }
  .tab-content { padding: 12px 16px; }
  h1 { font-size: 16px; }
  .header-right { gap: 8px; }
  .stat-box { padding: 4px 8px; }
  .stat-value { font-size: 14px; }
  .tabs { padding: 0 16px; }
  .tab { padding: 10px 12px; font-size: 11px; }
  .result-card { grid-template-columns: 1fr; }
  .my-radio-grid { grid-template-columns: 1fr; }
  .hero-card { flex-direction: column; text-align: center; }
  .radio-callsign { font-size: 28px; }
  .radio-icon { font-size: 48px; }
  .guide-step { flex-direction: column; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }
