/* General page styling */
body {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', Arial, Helvetica, sans-serif;
  /* Subtle gradient background for a modern feel */
  background: linear-gradient(135deg, #eef2ff, #fafaff);
  color: #2d3748;
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}


h1 {
  margin-top: 0;
  margin-bottom: 0.25rem;
  font-size: 2.5rem;
  font-weight: 600;
  text-align: center;
  color: #1f2937;
}


.subtitle {
  text-align: center;
  margin-bottom: 2rem;
  color: #6b7280;
  font-size: 1rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}


.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}


.controls label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #374151;
}


.controls input {
  width: 180px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: #374151;
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Make the talkgroup input shorter (approx 7 characters) */
#talkgroup {
  width: 7ch;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.controls input:focus {
  outline: none;
  border-color: #7f9cf5;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}


.controls button {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 6px;
  background-color: #4f46e5;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
}


.controls button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}


.controls button:not([disabled]):hover {
  background-color: #4338ca;
  transform: translateY(-1px);
}


#current,
#history {
  background: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Layout for current call with large flag to the right */
.current-body {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.current-body #currentCallInfo {
  flex: 1 1 auto;
}
.current-flag {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px; /* large flag width */
  height: 140px; /* large flag height */
}
.current-flag .large-flag {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.06);
}

/* Small flag used in the recent calls table */
.history-flag {
  width: 36px;
  height: 24px;
  display: inline-block;
}
.history-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.06);
}


#current h2,
#history h2 {
  margin-top: 0;
  font-size: 1.35rem;
  font-weight: 600;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 0.5rem;
  color: #1f2937;
}

#currentCallInfo {
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* Current call prominent styling: larger callsign and name, callsign blue */
.current-callsign {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e40af; /* same blue as global links */
  text-decoration: none;
}
.current-callsign:visited { color: #1e40af; }
.current-callsign:focus { outline: 2px solid rgba(79,70,229,0.6); outline-offset: 2px; }
.current-name {
  display: block;
  margin-top: 6px;
  font-size: 1.15rem;
  font-weight: 600;
  color: #111827;
}


#map {
  height: 400px;
  border: none;
  border-radius: 10px;
  margin-top: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Table styling for recent calls */

#history {
  max-height: 800px;
  overflow-y: auto;
}


#historyTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

#historyTable th,
#historyTable td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}

#historyTable th {
  background-color: #f9fafb;
  font-weight: 600;
  text-align: left;
  color: #4b5563;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

#historyTable tr:nth-child(odd) td {
  background-color: #fafbfc;
}

#historyTable tr:last-child td {
  border-bottom: none;
}

/* Tooltip for map preview on hover over location cells */
.map-tooltip {
  position: absolute;
  display: none;
  z-index: 1000;
  border: 1px solid #d1d5da;
  background-color: #fff;
  padding: 4px;
  box-shadow: 0 2px 4px rgba(27, 31, 35, 0.15);
  border-radius: 4px;
}

.map-tooltip img {
  display: block;
  max-width: 250px;
  max-height: 150px;
}

/* Collapsible map row inside the history table */
.history-map-row td {
  padding: 0; /* remove default padding so map touches edges */
  border-bottom: none;
}
.history-map {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease;
}
.history-map.open {
  max-height: 320px; /* expanded height */
}
.history-map .map-inner {
  height: 300px;
  width: 100%;
}

/* Styling for the "On Air" indicator shown in the current call pane */
.on-air {
  color: #d73a49; /* red color similar to GitHub danger color */
  font-weight: bold;
}
.off-air {
  color: #6b7280; /* muted gray */
  font-weight: 600;
}

/* Footer styling */
.footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
}

.footer strong {
  color: #4f46e5;
}

/* Keep help mailto link visually identical to surrounding footer text */
.footer .help-note a {
  color: inherit;
  text-decoration: none;
}
.footer .help-note a:hover {
  color: inherit;
  text-decoration: none;
}

/* Callsign links in the history table: no underline, keep color on visited, but retain focus outline for keyboard users */
#historyTable a {
  text-decoration: none;
  color: inherit;
}
#historyTable a:visited {
  color: inherit;
}
#historyTable a:focus {
  outline: 2px solid rgba(79,70,229,0.6);
  outline-offset: 2px;
}

/* Global link styling inside the app: blue and no underline, including visited state */
#app a {
  color: #1e40af; /* blue */
  text-decoration: none;
}
#app a:visited {
  color: #1e40af;
}
#app a:hover {
  color: #1e40af;
  text-decoration: none;
}
#app a:focus {
  outline: 2px solid rgba(79,70,229,0.6);
  outline-offset: 2px;
}

/* Current call card links should behave the same as history callsigns */
#currentCallInfo a {
  text-decoration: none;
  color: inherit;
}
#currentCallInfo a:visited {
  color: inherit;
}
#currentCallInfo a:focus {
  outline: 2px solid rgba(79,70,229,0.6);
  outline-offset: 2px;
}

/* Log viewer toggle heart */
.heart {
  cursor: pointer;
  display: inline-block;
  transition: transform 0.2s ease;
}
.heart:hover { transform: scale(1.15); }

/* Floating log viewer panel */
.log-viewer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 340px;
  max-height: 60vh;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border-radius: 10px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1200;
  font-size: 12px;
}
.log-viewer {
  resize: both;
  min-width: 280px;
  min-height: 160px;
  max-width: 90vw;
  max-height: 90vh;
}
.log-viewer.open { display: flex; }
.log-header {
  background: #f3f4f6;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #1f2937;
  border-bottom: 1px solid #e5e7eb;
}
.log-grip {
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg,#e5e7eb,#cbd5e1);
  border-radius: 3px;
  margin-right: 8px;
  opacity: 0.95;
  cursor: nwse-resize;
}
.log-tabs { display: flex; gap: 4px; }
.log-tab {
  background: #e5e7eb;
  border: none;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  color: #374151;
}
.log-tab.active { background: #4f46e5; color: #fff; }
.log-tab:hover { background: #d1d5db; }
.hidden { display: none !important; }
.log-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  padding: 0 4px;
}
.log-close:hover { color: #111827; }
.log-content {
  padding: 0.5rem;
  flex: 1 1 auto;
  overflow-y: auto;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  line-height: 1.25;
}
.log-entry {
  padding: 6px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid #f3f4f6;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 6px;
}
.log-entry:last-child { border-bottom: none; margin-bottom: 0; }

.log-entry pre {
  margin: 6px 0 0 0;
  background: #f8fafc;
  padding: 8px;
  border-radius: 6px;
  overflow: auto;
  font-size: 12px;
}
.log-entry.debug { opacity: 0.65; }
.log-entry.warn { background: #fffbe6; }
.log-entry.error { background: #fde2e2; }
.log-footer {
  padding: 0.4rem 0.5rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.log-footer-left { display: flex; gap: 6px; }
.log-clear {
  background: #ef4444;
  border: none;
  color: #fff;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
}
.log-clear.alt { background: #6366f1; }
.log-clear.alt:hover { background: #4f46e5; }
.log-clear:hover { background: #dc2626; }
.log-auto-refresh {
  font-size: 11px;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 4px;
}
