/* ==========================================================================
   F1 Pit-Wall Telemetry Terminal Widget (Bottom Left)
   ========================================================================== */

.f1-term-wrapper {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9990;
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
  pointer-events: auto;
}

.f1-term-wrapper.is-active {
  z-index: 99995;
}

.f1-term-wrapper * {
  box-sizing: border-box;
}

/* Floating Terminal Launcher Pill */
.f1-term-trigger {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: block;
  outline: none;
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.f1-term-trigger:hover {
  transform: translateY(-2px);
}

.f1-term-trigger:active {
  transform: translateY(1px) scale(0.98);
}

.f1-term-trigger-bezel {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #181d24 0%, #0d1014 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 8px 16px 8px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.f1-term-trigger-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00E676;
  flex-shrink: 0;
}

.f1-term-trigger-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.f1-term-trigger-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.f1-term-trigger-icon {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: #DC2626;
}

.f1-term-trigger-title {
  font-family: var(--font-hero);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.f1-term-trigger-sub {
  font-size: 9px;
  color: var(--slate);
  letter-spacing: 0.05em;
}

.f1-term-trigger-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #ffffff;
  background: #e10600;
  padding: 3px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
}

/* ==========================================================================
   Expanded Telemetry Terminal Console (Popover from Bottom Left)
   ========================================================================== */

.f1-term-console {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: min(400px, 62vh);
  z-index: 9995;
}

.f1-term-console[hidden] {
  display: none !important;
}

.f1-term-console-shell {
  background: #0d1015;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85);
}

.f1-term-console-inner {
  background: #090c10;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(396px, calc(62vh - 4px));
}

/* Header */
.f1-term-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #12161d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.f1-term-head-channel {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.f1-term-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #DC2626;
  text-transform: uppercase;
}

.f1-term-freq {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.f1-term-status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: 9999px;
}

.f1-term-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #00E676;
}

.f1-term-status-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #00E676;
}

.f1-term-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.f1-term-head-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--slate);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

.f1-term-head-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.f1-term-head-close {
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
}

/* Quick Commands Bar */
.f1-term-quick-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.f1-term-quick-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--slate);
}

.f1-term-quick-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.f1-term-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 3px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: #CBD5E1;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.f1-term-chip:hover {
  border-color: #DC2626;
  background: rgba(220, 38, 38, 0.15);
  color: #ffffff;
}

/* Terminal Screen */
.f1-term-screen {
  display: flex;
  flex-direction: column;
  background: #06080B;
}

.f1-term-bezel-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  background: rgba(14, 18, 24, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: #64748B;
  text-transform: uppercase;
}

.f1-term-live-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #34D399;
}

.f1-term-blink-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #34D399;
}

.f1-popup-term {
  padding: 8px 10px;
  min-height: 120px;
  max-height: 190px;
  height: auto;
  display: flex;
  flex-direction: column;
}

.f1-popup-term .term-out {
  margin: 0;
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: thin;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
  color: #34D399;
  white-space: pre-wrap;
  flex: 1;
}

.f1-popup-term .term-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.f1-popup-term .term-prompt {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: #FFB800;
  white-space: nowrap;
}

.f1-popup-term .term-in {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #F8FAFC;
  caret-color: #DC2626;
}

@media (max-width: 768px) {
  .f1-term-wrapper {
    left: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 60px);
    z-index: 48;
  }
  .f1-term-wrapper.is-active {
    z-index: 99995;
  }
  .f1-term-trigger-bezel {
    padding: 6px 10px;
    gap: 6px;
  }
  .f1-term-trigger-sub {
    display: none;
  }
  .f1-term-trigger-badge {
    display: none;
  }
  .f1-term-trigger-title {
    font-size: 10px;
  }
  .f1-term-console {
    width: calc(100vw - 20px);
    max-width: 100vw;
    max-height: min(360px, 54vh);
    bottom: calc(100% + 8px);
    left: 0;
  }
  .f1-term-console-inner {
    max-height: min(356px, calc(54vh - 4px));
    overflow-y: auto;
  }
  .f1-popup-term {
    min-height: 100px;
    max-height: 170px;
  }
  .f1-popup-term .term-out {
    max-height: 130px;
  }
}
