/* LaunchDetect Teaser Dashboard Styles
 * Dark theme: #000 body, #0a0a1a panels, #2ecc71 green accent
 * Typography: Syne (headings), system font (body), Courier New (data)
 * Architecture: CSS Grid -- map (65%) + sidebar (35%)
 */

/* --- Reset --- */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #000;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Header --- */

.teaser-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #0a0a1a;
  border-bottom: 1px solid #222;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 100;
  gap: 0.75rem;
}

.header-brand {
  font-family: 'Syne', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

.header-role {
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: #2ecc71;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background: rgba(46, 204, 113, 0.1);
  padding: 4px 12px;
  border-radius: 3px;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.header-spacer {
  flex: 1;
}

.cta-header-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  background: #2ecc71;
  border: 1px solid #2ecc71;
  color: #000;
  font-family: 'Syne', sans-serif;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 4px;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.cta-header-btn:hover {
  background: #27ae60;
  border-color: #27ae60;
}

#sign-out-container {
  margin-left: 0.5rem;
}

/* --- Main Layout (CSS Grid) --- */

.teaser-main {
  margin-top: 56px;
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: 1fr;
}

/* --- Map Section --- */

.map-section {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.map-container {
  position: relative;
  flex: 1;
  min-height: 300px;
  background: #050510;
  border: 1px solid #222;
  border-radius: 4px;
  overflow: hidden;
}

#teaserMapSvg {
  width: 100%;
  height: 100%;
  display: block;
}

#teaserMapSvg .land {
  fill: #1a1a2e;
  stroke: #333;
  stroke-width: 0.5;
}

#teaserMapSvg .spaceport-dot {
  fill: #333;
  stroke: none;
}

#teaserMapSvg .detection-marker {
  cursor: pointer;
}

/* Map tooltip */

.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: #0a0a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.8125rem;
  color: #fff;
  opacity: 0;
  z-index: 50;
  white-space: nowrap;
}

.map-tooltip.visible {
  opacity: 1;
}

.tooltip-name {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  margin-bottom: 2px;
}

.tooltip-date {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #999;
}

.tooltip-vehicle {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #2ecc71;
  margin-top: 2px;
}

/* Map legend */

.map-legend {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 0 0;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-family: 'Courier New', monospace;
  color: #888;
}

.legend-item::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-recent::before {
  background: #2ecc71;
}

.legend-week::before {
  background: #f39c12;
}

.legend-older::before {
  background: #666;
}

/* --- Detection Sidebar --- */

.detection-sidebar {
  background: #0a0a1a;
  border-left: 1px solid #222;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

/* Stats row */

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #050510;
  border: 1px solid #222;
  border-radius: 4px;
  padding: 0.75rem;
  text-align: center;
}

.stat-value {
  font-family: 'Courier New', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.stat-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #666;
}

/* Detection list header */

.detection-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.detection-list-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.delay-badge {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f39c12;
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.3);
  padding: 2px 8px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

/* Detection list */

.detection-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  max-height: calc(100vh - 400px);
}

/* Detection cards -- anti-export */

.detection-card {
  background: #050510;
  border: 1px solid #1a1a2e;
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.detection-card:hover {
  border-color: #333;
}

.detection-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.detection-site {
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
}

.detection-verdict {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

.detection-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.detection-date {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #888;
}

.detection-vehicle {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #2ecc71;
}

/* --- Upgrade CTA --- */

.upgrade-cta {
  background: #050510;
  border: 1px solid rgba(46, 204, 113, 0.3);
  border-radius: 4px;
  padding: 1.25rem;
  text-align: center;
  margin-top: auto;
  flex-shrink: 0;
}

.cta-title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.375rem;
}

.cta-description {
  font-size: 0.8125rem;
  color: #888;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.cta-btn {
  display: inline-block;
  padding: 10px 24px;
  background: #2ecc71;
  color: #000;
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 4px;
  text-decoration: none;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.cta-btn:hover {
  background: #27ae60;
}

.cta-link {
  display: block;
  font-size: 0.75rem;
  color: #2ecc71;
  text-decoration: none;
  font-family: 'Courier New', monospace;
}

.cta-link:hover {
  text-decoration: underline;
}

/* --- Loading / Empty / Error States --- */

.loading-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.loading-bar {
  height: 12px;
  background: #111;
  border-radius: 3px;
  margin-bottom: 0.75rem;
  width: 80%;
}

.loading-bar:nth-child(2) { width: 60%; }
.loading-bar:nth-child(3) { width: 70%; }

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: #666;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
}

.error-banner {
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 4px;
  padding: 12px 16px;
  color: #e74c3c;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.error-banner-text {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid #444;
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  border-color: #2ecc71;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

/* --- Responsive: stack vertically at 768px --- */

@media (max-width: 768px) {
  .teaser-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .detection-sidebar {
    border-left: none;
    border-top: 1px solid #222;
  }

  .map-section {
    padding: 1rem;
  }

  .map-container {
    min-height: 220px;
  }

  .detection-list {
    max-height: none;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .teaser-header {
    padding: 0 1rem;
    gap: 0.5rem;
  }

  .cta-header-btn {
    font-size: 0.75rem;
    padding: 5px 10px;
  }

  .detection-sidebar {
    padding: 1rem;
  }
}
