/* ==========================================================================
   Evaluador de viabilidad de producto para redes - Estilos
   Cumplimiento con los estándares canónicos de fijate.com
   ========================================================================== */

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

  /* Tema claro */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-alt: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #059669;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --primary-border: #a7f3d0;
  
  --accent-purple: #7c3aed;
  --accent-purple-light: #f5f3ff;
  --accent-purple-border: #ddd6fe;

  --accent-gold: #d97706;
  --accent-gold-bg: #fef3c7;
  --accent-gold-border: #fde68a;

  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-border: #fecaca;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius: 12px;
}

[data-theme="dark"] {
  --bg-body: #090d16;
  --bg-card: #131b2e;
  --bg-card-alt: #1a253c;
  --bg-input: #0e1526;
  --border-color: #243452;
  --border-focus: #10b981;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --primary: #10b981;
  --primary-hover: #34d399;
  --primary-light: #064e3b;
  --primary-border: #047857;

  --accent-purple: #a78bfa;
  --accent-purple-light: #2e1065;
  --accent-purple-border: #5b21b6;

  --accent-gold: #f59e0b;
  --accent-gold-bg: #451a03;
  --accent-gold-border: #78350f;

  --danger: #ef4444;
  --danger-bg: #450a0a;
  --danger-border: #7f1d1d;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.mono {
  font-family: var(--font-mono);
}

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

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

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

/* Pestañas */
.nav-tabs-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.35rem;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  scrollbar-width: none;
}

.nav-tabs-wrapper::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: 130px;
  min-height: 44px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-alt);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.tab-content {
  display: none;
}

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

/* Tarjetas y secciones */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

.badge-pill {
  font-size: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-green {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge-purple {
  background: var(--accent-purple-light);
  color: var(--accent-purple);
  border: 1px solid var(--accent-purple-border);
}

/* Hero Score circular y diagnóstico */
.score-hero-container {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
}

.score-circle-wrapper {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}

.score-circle-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-circle-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 10;
}

.score-circle-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 339.29; /* 2 * PI * 54 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.6s ease, stroke 0.4s ease;
}

.score-text-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.score-label {
  font-size: 0.72rem;
  color: var(--text-light);
  text-transform: uppercase;
  font-weight: 600;
}

.score-details {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font-heading);
  width: fit-content;
}

.verdict-badge.green {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.verdict-badge.yellow {
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold-border);
}

.verdict-badge.red {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.verdict-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.verdict-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Cuadrículas de formulario */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
}

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

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-hint {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 400;
}

/* Inputs y selects */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-suffix {
  position: absolute;
  right: 12px;
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.9rem;
  pointer-events: none;
}

.form-input {
  width: 100%;
  height: 44px;
  min-height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0 2.5rem 0 0.85rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0 40px 0 0.85rem;
  font-family: var(--font-main);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' 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 14px center;
  background-size: 16px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.form-select option,
.form-select optgroup {
  background-color: var(--bg-card);
  color: var(--text-main);
  padding: 8px 12px;
}

/* Checkbox cards para dimensiones booleanas */
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.check-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.check-card:hover {
  border-color: var(--primary);
}

.check-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  margin-top: 2px;
  flex-shrink: 0;
}

.check-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.check-card-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
}

.check-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Desglose de fortalezas y debilidades */
.feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.feedback-col {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feedback-col-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.feedback-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.feedback-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

/* Calculadora de cubaje y peso volumétrico */
.volumetric-calc-box {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.volumetric-comparison {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

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

.volumetric-num {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Botones de acción */
.btn-primary {
  width: 100%;
  min-height: 44px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:active {
  transform: scale(0.99);
}

/* Modal canónico */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  max-width: 580px;
  width: 100%;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

/* Responsividad */
@media (max-width: 900px) {
  .tool-with-sidebar {
    flex-direction: column;
  }
  .score-hero-container {
    flex-direction: column;
    text-align: center;
  }
  .score-details {
    align-items: center;
  }
  .checklist-grid, .feedback-grid, .volumetric-comparison, .form-grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .tool-layout {
    padding: 0 0.75rem;
    margin: 1rem auto 2.5rem;
  }
  .card-main {
    padding: 1.25rem;
  }
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}
