/* Estilos para el simulador de tiro parabólico y balística */

:root {
  --bg-primary: #0a0f1d;
  --bg-card: rgba(15, 23, 42, 0.78);
  --bg-card-border: rgba(56, 189, 248, 0.18);
  --bg-canvas: #060b18;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-border: rgba(2, 132, 199, 0.22);
  --bg-canvas: #090e1a;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
}

[data-theme="light"] .btn-action {
  background: rgba(241, 245, 249, 0.85);
  border-color: rgba(2, 132, 199, 0.3);
  color: #0f172a;
}

[data-theme="light"] .btn-action:hover {
  background: rgba(2, 132, 199, 0.12);
}

[data-theme="light"] .btn-action.active {
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
  border-color: #0284c7;
}

[data-theme="light"] .control-select {
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(2, 132, 199, 0.3);
  color: #0f172a;
}

[data-theme="light"] .control-select option {
  background: #ffffff;
  color: #0f172a;
}

[data-theme="light"] .control-group-card {
  background: rgba(241, 245, 249, 0.6);
  border-color: rgba(2, 132, 199, 0.18);
}

[data-theme="light"] .telemetry-hud-strip {
  background: rgba(241, 245, 249, 0.92);
  border-bottom-color: rgba(2, 132, 199, 0.2);
}

[data-theme="light"] .target-feedback-box {
  background: rgba(241, 245, 249, 0.92);
  border-color: rgba(2, 132, 199, 0.35);
}

[data-theme="light"] .formula-box {
  background: rgba(241, 245, 249, 0.85);
  border-color: rgba(2, 132, 199, 0.25);
  color: #0284c7;
}

[data-theme="light"] .range-slider {
  background: #cbd5e1;
}

[data-theme="light"] .ballistics-modal-card {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.3);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
}

.ballistics-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.45);
}

.ballistics-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.ballistics-intro h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: var(--text-main);
}

.ballistics-intro p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.ballistics-quick-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.btn-fire {
  background: linear-gradient(135deg, #e11d48, #be123c);
  border-color: #f43f5e;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.35);
}

.btn-fire:hover {
  background: linear-gradient(135deg, #be123c, #9f1239);
  box-shadow: 0 6px 20px rgba(225, 29, 72, 0.55);
}

.btn-action.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Área visual y HUD */
.ballistics-view-container {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
  background: var(--bg-canvas);
}

.ballistics-canvas-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#ballistics-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.telemetry-hud-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  padding: 0.75rem 1rem;
}

.telemetry-item {
  display: flex;
  flex-direction: column;
}

.telemetry-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: none;
  color: var(--text-muted);
}

.telemetry-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Feedback de diana */
.target-feedback-box {
  display: none;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  margin: 0.75rem 0 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

/* Panel de controles */
.ballistics-controls-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.control-group-card {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.control-group-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.85rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.control-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  min-height: 40px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font-sans);
}

.control-select option {
  background: #0f172a;
  color: #f8fafc;
}

.slider-container {
  margin-bottom: 0.85rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.slider-val-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
}

.range-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #334155;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.range-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
}

.range-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #334155;
  border: none;
}

[data-theme="light"] .range-slider::-moz-range-track {
  background: #cbd5e1;
}

/* Sección de teoría y fórmulas */
.ballistics-explanation-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.ballistics-explanation-section h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--text-main);
  margin: 0 0 0.75rem 0;
}

.ballistics-explanation-section p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.formula-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1rem 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--accent-cyan);
  overflow-x: auto;
}

/* Modal canónico de fórmulas */
.ballistics-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
}

.ballistics-modal-overlay.active {
  display: flex;
}

.ballistics-modal-card {
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin: 0;
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-modal:hover {
  color: #ffffff;
}

.modal-body {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.modal-body h4 {
  color: var(--text-main);
  font-family: var(--font-heading);
  margin: 1.25rem 0 0.5rem 0;
}

@media (max-width: 768px) {
  .ballistics-card {
    padding: 1rem;
  }

  .ballistics-top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .ballistics-quick-actions {
    width: 100%;
  }

  .ballistics-quick-actions .btn-action {
    flex: 1 1 0%;
    width: 100%;
  }

  .telemetry-hud-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .ballistics-controls-panel {
    grid-template-columns: 1fr;
  }
}
