/* ULL HSI Navigator - Premium Cockpit Styling */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  --bg-color: #060709;
  --panel-bg: rgba(15, 18, 25, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  
  /* Barvy letectví */
  --neon-green: #00ff66;
  --neon-green-glow: rgba(0, 255, 102, 0.4);
  --cyan: #06b6d4;
  --magenta: #ff00ff;
  --magenta-glow: rgba(255, 0, 255, 0.4);
  --amber: #ff9900;
  --red: #ef4444;
  
  --font-ui: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh; /* dynamická výška - nezasahuje pod systémovou lištu Androidu */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Hlavička aplikace */
header {
  background: var(--panel-bg);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

h1 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

h1::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--neon-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--neon-green);
}

.status-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.05);
}

.status-badge.active {
  background: rgba(0, 255, 102, 0.1);
  color: var(--neon-green);
  border-color: rgba(0, 255, 102, 0.25);
}

.status-badge.inactive {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
}

.status-badge.unsupported {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.2);
}

.status-badge.gps-active {
  background: rgba(6, 182, 212, 0.1);
  color: var(--cyan);
  border-color: rgba(6, 182, 212, 0.25);
}

/* Hlavní obsah - rozdělení obrazovky */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  height: calc(100vh - 42px);
  height: calc(100dvh - 42px);
  min-height: 0;
}

/* Container pro HSI Canvas */
.radar-container {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  padding: 10px;
}

canvas#hsi-canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* Ovládací prvky přímo na radaru (Zvětšení/Zmenšení rozsahu) */
/* Tlačítka jsou v dolních rozích, aby nezasahovala do kruhu HSI */
.radar-btn-left {
  position: absolute;
  left: 16px;
  bottom: 16px;
}

.radar-btn-right {
  position: absolute;
  right: 16px;
  bottom: 16px;
}

.circle-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  transition: background 0.2s, transform 0.1s;
}

.circle-btn:active {
  background: rgba(255,255,255,0.1);
  transform: scale(0.95);
}

/* Telemetrický Panel (Kokpitové ukazatele) */
.telemetry-panel {
  background: var(--panel-bg);
  border-top: 1px solid var(--panel-border);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 10px 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  z-index: 10;
  box-shadow: 0 -10px 20px rgba(0,0,0,0.4);
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-right: 1px solid rgba(255,255,255,0.05);
  padding: 4px 0;
}

.telemetry-item:last-child {
  border-right: none;
}

.tel-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.tel-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Specifické barvy pro důležité hodnoty */
.telemetry-item.target-dist .tel-value {
  color: var(--magenta);
  text-shadow: 0 0 10px var(--magenta-glow);
}

.telemetry-item.speed .tel-value {
  color: var(--neon-green);
  text-shadow: 0 0 10px var(--neon-green-glow);
}

.telemetry-item.bearing .tel-value {
  color: var(--cyan);
}

/* Dolní navigační panel s akcemi */
.navigation-bar {
  background: rgba(10, 11, 15, 0.95);
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom)); /* nad systémovou lištou */
  display: flex;
  gap: 10px;
  z-index: 10;
  border-top: 1px solid rgba(255,255,255,0.03);
}

.btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-primary {
  background: rgba(255, 0, 255, 0.12);
  border-color: rgba(255, 0, 255, 0.3);
  color: var(--magenta);
}

.btn-primary:active {
  background: rgba(255, 0, 255, 0.25);
  box-shadow: 0 0 15px var(--magenta-glow);
}

.btn-green {
  background: rgba(0, 255, 102, 0.1);
  border-color: rgba(0, 255, 102, 0.25);
  color: var(--neon-green);
}

.btn-green.active {
  background: var(--neon-green);
  color: #000000;
  box-shadow: 0 0 15px var(--neon-green-glow);
}

/* Modální okna (Popups) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #11141d;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

/* Formuláře a nastavení */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.search-input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-ui);
  outline: none;
}

.search-input:focus {
  border-color: var(--cyan);
}

/* Seznam výsledků vyhledávání letišť */
.search-results {
  margin-top: 10px;
  max-height: 250px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.03);
}

.result-item {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}

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

.result-item:hover, .result-item:active {
  background: rgba(255, 255, 255, 0.05);
}

.result-name {
  font-weight: 600;
  font-size: 13px;
}

.result-code {
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(255,255,255,0.05);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
  margin-left: 6px;
}

.result-details {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.result-distance {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
}

/* Správa nahrávání souborů */
.file-upload-box {
  border: 2px dashed rgba(255,255,255,0.1);
  padding: 24px;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 12px;
}

.file-upload-box:hover {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.02);
}

.file-upload-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.file-upload-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.file-input {
  display: none;
}

.db-status-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.db-status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.02);
  font-size: 12px;
}

.db-status-label {
  font-weight: 600;
}

.db-status-value {
  font-family: var(--font-mono);
  font-weight: 700;
}

.db-status-value.loaded {
  color: var(--neon-green);
}

.db-status-value.empty {
  color: var(--text-secondary);
}

/* Detail letiště / prostoru po klepnutí (modal) - vše větší a stacked,
   aby se dlouhé hodnoty (frekvence, dráha) na telefonu nerozpadaly na 2 řádky. */
#wp-info-card .db-status-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
}

#wp-info-card .db-status-label {
  font-size: 13px;
  color: var(--text-secondary);
}

#wp-info-card .db-status-value {
  font-size: 20px;
  line-height: 1.2;
  word-break: break-word;
}

/* Nastavení (Settings) */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-size: 13px;
  font-weight: 600;
}

.settings-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.select-control {
  padding: 6px 12px;
  background: #1e293b;
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: 6px;
  font-family: var(--font-ui);
  outline: none;
  cursor: pointer;
}

/* Simulátor GPS (Pomocný testovací panel) */
.simulator-panel {
  position: absolute;
  top: 60px;
  left: 16px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  width: 200px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 5;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.sim-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
}

.sim-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 11px;
}

.sim-btn-small {
  padding: 2px 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary);
  font-size: 10px;
  border-radius: 3px;
  cursor: pointer;
}

.sim-btn-small:active {
  background: rgba(255,255,255,0.15);
}

/* Responzivní design pro malé displeje */
@media (max-width: 480px) {
  .telemetry-panel {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .telemetry-item {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    padding: 6px 0;
  }
  
  .telemetry-item:nth-child(even) {
    border-left: 1px solid rgba(255,255,255,0.03);
  }
  
  .telemetry-item:nth-last-child(-n+2) {
    border-bottom: none;
  }
  
  .telemetry-item .tel-value {
    font-size: 26px;
  }
  
  .navigation-bar {
    padding: 8px;
  }
  
  .btn {
    padding: 10px;
    font-size: 10px;
  }
  
  .simulator-panel {
    width: calc(100% - 32px);
    top: auto;
    bottom: 230px;
  }
}

/* Výstražný banner pro vzdušné prostory */
.airspace-warning-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239, 68, 68, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4), 0 0 10px rgba(0,0,0,0.5);
  border-radius: 8px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 15;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: warning-pulse 1.2s infinite alternate;
}

@keyframes warning-pulse {
  from {
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.95);
    transform: translateX(-50%) scale(1);
  }
  to {
    box-shadow: 0 4px 25px rgba(239, 68, 68, 0.8);
    background: rgba(220, 38, 38, 0.98);
    transform: translateX(-50%) scale(1.02);
  }
}

/* Tlačítka pro zadávání PIN kódu */
.pin-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  height: 55px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.1s, transform 0.05s;
}
.pin-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.92);
}

/* Badges pro typy bodů ve výsledcích vyhledávání */
.wp-type-badge {
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
}
.wp-type-badge.airport {
  background: rgba(0, 255, 102, 0.15);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 102, 0.3);
}
.wp-type-badge.ull {
  background: rgba(163, 230, 53, 0.15);
  color: #a3e635;
  border: 1px solid rgba(163, 230, 53, 0.3);
}
.wp-type-badge.outlanding {
  background: rgba(251, 191, 36, 0.15);
  color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.3);
}
.wp-type-badge.peak {
  background: rgba(217, 160, 102, 0.15);
  color: #d9a066;
  border: 1px solid rgba(217, 160, 102, 0.3);
}
.wp-type-badge.pass {
  background: rgba(203, 185, 148, 0.15);
  color: #cbb994;
  border: 1px solid rgba(203, 185, 148, 0.3);
}
.wp-type-badge.obstacle {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.wp-type-badge.waypoint {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Samba XXL Operating Card Styles */
.samba-tabs {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px 8px 0 0;
  padding: 4px;
}

.samba-tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 12px 6px;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: center;
  border-radius: 6px;
  transition: all 0.2s;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.samba-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.samba-tab-btn.active {
  color: var(--magenta);
  background: rgba(255, 0, 255, 0.08);
  box-shadow: inset 0 -2px 0 var(--magenta);
}

.samba-tab-btn.active.emergencies-tab {
  color: var(--red);
  background: rgba(239, 68, 68, 0.08);
  box-shadow: inset 0 -2px 0 var(--red);
}

.samba-tab-content {
  display: none;
  animation: sambaFadeIn 0.2s ease-in-out;
  height: 100%;
}

.samba-tab-content.active {
  display: block;
}

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

/* Tabulky a seznamy v kartě */
.samba-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 15px;
}

.samba-table th, .samba-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.samba-table th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.02);
}

.samba-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.samba-speed-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--neon-green);
  text-align: right;
}

.samba-h-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--cyan);
  text-align: right;
}

.samba-section-title {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 22px 0 10px 0;
  border-bottom: 1px solid rgba(6, 182, 212, 0.15);
  padding-bottom: 6px;
}

.samba-section-title:first-child {
  margin-top: 0;
}

.samba-rule-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 15px;
}

.samba-rule-list {
  list-style: none;
}

.samba-rule-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.samba-rule-list li::before {
  content: '•';
  position: absolute;
  left: 6px;
  color: var(--cyan);
  font-weight: bold;
}

.samba-checklist-group {
  margin-bottom: 18px;
}

.samba-checklist-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 8px;
  border-left: 4px solid var(--magenta);
}

.samba-checklist-items {
  list-style: none;
  font-size: 15px;
  padding-left: 4px;
}

.samba-checklist-items li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  line-height: 1.5;
  color: #cbd5e1;
}

.samba-checklist-items li strong {
  color: var(--text-primary);
}

/* Nouzové postupy */
.samba-emergency-card {
  border-left: 4px solid var(--red);
  background: rgba(239, 68, 68, 0.03);
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.samba-emergency-title {
  font-size: 16px;
  font-weight: 700;
  color: #ff9999;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.samba-emergency-desc {
  font-size: 15px;
  color: #fca5a5;
  line-height: 1.5;
}

/* SVG graf */
.samba-chart-container {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  margin-top: 18px;
  text-align: center;
}

.samba-chart-title {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.samba-svg-chart {
  max-width: 100%;
  height: auto;
  display: block;
}

