/**
 * Fijate Tools - Calculadora de Ancho de Banda, Descarga y Streaming
 * Estilos canónicos, barras comparativas de red y diseño responsive
 */

:root {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #283548;
  --border-color: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-amber: #f59e0b;
  --accent-orange: #f97316;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
  --transition-fast: 0.2s ease;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --border-color: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.06);
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.tool-with-sidebar {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Tarjetas */
.card-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.card-header {
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  line-height: 1.5;
}

/* Pestañas */
.tab-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-nav-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-nav-btn:hover {
  color: var(--accent-amber);
}

.tab-nav-btn.active {
  color: var(--accent-amber);
  border-bottom-color: var(--accent-amber);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Rejilla de formulario */
.form-grid-inputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.input-with-select {
  display: flex;
  gap: 0.5rem;
}

.form-input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition-fast);
  min-height: 44px;
}

.form-input:focus {
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.form-select-unit {
  width: 110px;
  max-width: 110px;
  min-width: 0;
  padding: 0.75rem 1.5rem 0.75rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  cursor: pointer;
}

.form-select-full {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  cursor: pointer;
  min-height: 44px;
}

/* Presets */
.presets-block {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.presets-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-preset {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-preset:hover {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

/* Panel de resultados principales */
.results-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.result-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hero-featured {
  border-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
}

.res-hero-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.res-hero-val {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
}

.res-hero-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Comparador multiconexión en paralelo */
.comparison-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
}

.comparison-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}

.comparison-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.comp-row-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
}

.comp-name {
  color: var(--text-primary);
  font-weight: 600;
}

.comp-time {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-amber);
}

.comp-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 9999px;
  overflow: hidden;
}

.comp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-orange));
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* Streaming planificador */
.stream-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}

.stream-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stream-advice-box {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 1rem;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title { font-size: 1.2rem; }

.modal-btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.modal-btn-close:hover { color: var(--text-primary); background: var(--bg-card); }

.modal-body {
  padding: 1.5rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--accent-amber);
  color: #0b0f19;
  font-weight: 700;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Responsive */
@media (max-width: 800px) {
  .results-hero-grid {
    grid-template-columns: 1fr;
  }
  .form-grid-inputs {
    grid-template-columns: 1fr;
  }
  .stream-results-grid {
    grid-template-columns: 1fr;
  }
}
