/**
 * Ship Selection and Squadron Components
 * Ship selection interface, blueprint viewer, and squadron management
 * Using design system tokens
 */

/* ============================================
   HANGAR CONTAINER
   ============================================ */

.hangar-container {
  width: 100vw;
  height: 100vh;
  padding: 30px;
  box-sizing: border-box;
  background: #020502;
  display: flex;
  flex-direction: column;
  /* Grid background pattern - consistent with mission board and cockpit */
  background-image:
    linear-gradient(rgba(57, 255, 20, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 20, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
}

.hangar-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #39ff14;
  padding-bottom: 10px;
  margin-bottom: 20px;
  font-family: "Roboto Mono", monospace;
  font-weight: bold;
  color: #39ff14;
  letter-spacing: 2px;
}

.header-left,
.header-right {
  font-size: 1rem;
}

/* ============================================
   SHIP SELECTION GRID
   ============================================ */

.ship-display-grid {
  display: grid;
  grid-template-columns: 250px 1fr 280px;
  gap: var(--spacing-md, 20px);
  flex-grow: 1;
  overflow: hidden;
  /* Grid background inherited from hangar-container */
}

.ship-list {
  background: rgba(0, 20, 0, 0.3);
  border: 1px solid var(--text-tertiary, #335533);
  padding: var(--spacing-md, 15px);
  overflow-y: auto;
}

.blueprint-viewer {
  background: rgba(0, 20, 0, 0.3);
  border: 1px solid var(--text-tertiary, #335533);
  padding: var(--spacing-md, 15px);
  overflow-y: auto;
}

/* ============================================
   WIREFRAME BOX & GRID OVERLAY
   ============================================ */

.wireframe-box {
  flex-grow: 1;
  border: 1px dashed #2e8b57;
  margin-bottom: 20px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(
    circle,
    rgba(57, 255, 20, 0.1) 0%,
    transparent 70%
  );
  min-height: 300px;
}

.scan-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* Grid background pattern - consistent with mission board */
  background-image:
    linear-gradient(rgba(57, 255, 20, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 20, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.tech-readout-tl {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.6rem;
  color: #2e8b57;
  font-family: "Roboto Mono", monospace;
  z-index: 2;
}

.tech-readout-br {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 0.6rem;
  color: #2e8b57;
  font-family: "Roboto Mono", monospace;
  z-index: 2;
}

/* ============================================
   SHIP OPTIONS - MATCHES DESIGN SYSTEM
   ============================================ */

.ship-option {
  position: relative; /* Needed for corner brackets */
  border: 2px solid #39ff14; /* Match mission-card: always green, thicker border */
  background: rgba(0, 20, 0, 0.9); /* Match mission-card: darker, more opaque */
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease; /* Match mission-card transition */
  margin-bottom: 10px;
  font-family: "Roboto Mono", monospace;
  overflow: hidden; /* Contains effects */
  clip-path: polygon(
    10px 0,
    100% 0,
    100% 100%,
    0 100%,
    0 10px
  ); /* Match mission-card: cut corner */

  /* LAYOUT FIX FOR TEXT COLLISION */
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ship-option:hover {
  transform: translateY(-5px); /* Match mission-card hover */
  border-color: #fff; /* Match mission-card hover: white border */
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.6); /* Match mission-card hover glow */
}

/* --- THE ACTIVE STATE (TARGETING RETICLE + MISSION THEME) --- */
.ship-option.active {
  /* Match mission-card style but with corner brackets */
  border-color: #39ff14; /* Keep green border */
  background: rgba(0, 20, 0, 0.9); /* Keep same background */
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.6); /* Match mission-card hover glow */
  transform: translateY(-5px); /* Match hover lift */
}

/* CORNER BRACKETS - Top Left (Targeting Reticle) */
.ship-option.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  border: 2px solid #39ff14; /* Exact match: terminal green */
  border-right: none;
  border-bottom: none;
  transition: all 0.3s;
  box-shadow: 0 0 5px rgba(57, 255, 20, 0.5);
}

/* CORNER BRACKETS - Bottom Right (Targeting Reticle) */
.ship-option.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border: 2px solid #39ff14; /* Exact match: terminal green */
  border-left: none;
  border-top: none;
  transition: all 0.3s;
  box-shadow: 0 0 5px rgba(57, 255, 20, 0.5);
}

/* --- TEXT STYLING (MATCH MISSION CARD THEME) --- */
.ship-id {
  font-size: 0.7rem;
  color: #88cc88; /* Match mission-card description color */
  margin-bottom: 2px;
  font-family: "Roboto Mono", monospace;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 1px;
}

.ship-name {
  font-size: 1.2rem; /* Match mission-title size */
  font-weight: bold;
  margin-bottom: 8px;
  word-wrap: break-word;
  color: #39ff14; /* Match mission-title color */
  text-transform: uppercase; /* Match mission-title */
  font-family: "Roboto Mono", monospace;
}

/* Active state keeps green text */
.ship-option.active .ship-name {
  color: #39ff14; /* Keep green when active */
}

.ship-option.active .ship-id {
  color: #39ff14; /* Turn green when active */
}

/* --- STAT TAGS (MATCH MISSION THEME) --- */
.ship-tags {
  display: flex; /* Use flex instead of grid for tags */
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.ship-tags span {
  font-size: 0.6rem;
  border: 1px solid #335533; /* Match mission-card divider color */
  color: #88cc88; /* Match mission-card description color */
  padding: 2px 6px;
  background: transparent;
  font-family: "Roboto Mono", monospace;
  text-align: center;
  text-transform: uppercase;
  transition: all 0.2s;
}

.ship-option:hover .ship-tags span {
  border-color: #fff; /* Match hover: white border like mission-card */
  color: #39ff14;
}

.ship-option.active .ship-tags span {
  border-color: #39ff14;
  color: #39ff14;
}

/* ============================================
   SHIP STATS
   ============================================ */

.stat-header {
  font-size: var(--font-size-sm, 0.8rem);
  color: var(--terminal-green, var(--signal-emerald));
  margin-bottom: var(--spacing-sm, 10px);
  border-bottom: 1px solid var(--text-tertiary, #335533);
  padding-bottom: 5px;
  font-family: var(--font-mono, "Roboto Mono", monospace);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: var(--font-size-sm, 0.85rem);
}

.stat-label {
  color: var(--text-secondary, #88cc88);
}

.stat-value {
  color: var(--terminal-green, var(--signal-emerald));
  font-weight: bold;
}

.stat-bar-container {
  width: 100%;
  height: 10px;
  background: var(--surface-0, #000);
  border: 1px solid var(--text-tertiary, #335533);
  padding: 1px;
  margin-top: 5px;
}

.stat-bar-fill {
  height: 100%;
  background: var(--terminal-green, var(--signal-emerald));
  transition: width var(--transition-base, 0.3s) ease;
}

/* ============================================
   SHIP DESCRIPTION
   ============================================ */

.ship-desc-box {
  border-top: 1px solid var(--text-tertiary, #335533);
  padding-top: var(--spacing-sm, 10px);
}

.desc-label {
  font-size: var(--font-size-xs, 0.7rem);
  color: var(--terminal-green, var(--signal-emerald));
  margin-bottom: 8px;
  font-family: var(--font-mono, "Roboto Mono", monospace);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.desc-text {
  color: var(--text-secondary, #88cc88);
  font-size: var(--font-size-sm, 0.9rem);
  line-height: 1.4;
}

/* ============================================
   SQUADRON PANEL
   ============================================ */

.squadron-panel {
  border-left: 1px solid var(--text-tertiary, #335533);
  padding-left: var(--spacing-md, 20px);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md, 15px);
}

.panel-header {
  font-size: var(--font-size-sm, 0.8rem);
  color: var(--terminal-green, var(--signal-emerald));
  border-bottom: 1px solid var(--text-tertiary, #335533);
  padding-bottom: var(--spacing-sm, 10px);
  margin-bottom: var(--spacing-sm, 10px);
  font-family: var(--font-mono, "Roboto Mono", monospace);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   SQUADRON SLOTS
   ============================================ */

.squad-slot {
  border: 1px solid var(--text-tertiary, #335533);
  background: rgba(0, 20, 0, 0.4);
  padding: var(--spacing-sm, 10px);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm, 10px);
  transition: all var(--transition-base, 0.2s);
  margin-bottom: var(--spacing-sm, 10px);
}

.squad-slot.filled {
  border-color: var(--terminal-green, var(--signal-emerald));
  background: rgba(57, 255, 20, 0.1);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.2);
}

.slot-status-light {
  width: 8px;
  height: 8px;
  background: var(--terminal-green, var(--signal-emerald));
  border-radius: 50%;
  box-shadow: 0 0 5px var(--terminal-green, var(--signal-emerald));
  flex-shrink: 0;
}

.squad-slot.empty {
  border-style: dashed;
  cursor: pointer;
  opacity: 0.7;
}

.squad-slot.empty:hover {
  border-color: var(--terminal-green, var(--signal-emerald));
  opacity: 1;
  background: rgba(57, 255, 20, 0.1);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.2);
}

.slot-icon {
  font-size: var(--font-size-xl, 1.5rem);
  color: var(--text-secondary, #88cc88);
  width: 30px;
  text-align: center;
  flex-shrink: 0;
  transition: all var(--transition-base, 0.2s);
}

.squad-slot.empty:hover .slot-icon {
  color: var(--terminal-green, var(--signal-emerald));
}

.pilot-name {
  font-size: var(--font-size-sm, 0.8rem);
  color: var(--terminal-green, var(--signal-emerald));
  font-weight: bold;
  text-shadow: 0 0 3px rgba(57, 255, 20, 0.3);
}

.pilot-ship {
  font-size: var(--font-size-xs, 0.6rem);
  color: var(--text-secondary, #88cc88);
  margin-top: 2px;
}

.squad-slot.filled .pilot-ship {
  color: var(--text-secondary, #88cc88);
}

.signal-bars {
  margin-left: auto;
  color: var(--terminal-green, var(--signal-emerald));
  font-size: var(--font-size-xs, 0.6rem);
  letter-spacing: 1px;
}

.slot-activity {
  margin-top: auto;
  height: 150px;
  border-top: 1px solid var(--text-tertiary, #335533);
  padding-top: var(--spacing-sm, 10px);
  font-size: var(--font-size-xs, 0.7rem);
  color: var(--text-secondary, #88cc88);
  opacity: 0.8;
  overflow-y: auto;
  font-family: var(--font-mono, "Roboto Mono", monospace);
}

.squad-slot.ready {
  border-color: var(--signal-amber, #ffaa00);
  background: rgba(255, 165, 0, 0.15);
  box-shadow: 0 0 10px rgba(255, 165, 0, 0.3);
}

.squad-slot.ready .slot-status-light {
  background: var(--signal-amber, #ffaa00);
  box-shadow: 0 0 8px var(--signal-amber, #ffaa00);
}
