/**
 * Fijate Tools - Conversor internacional de tallas de ropa y calzado
 * Hojas de estilo y diseño responsivo adaptativo
 */

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

  /* Tema oscuro por defecto */
  --bg-page: #0b0f17;
  --bg-card: #121826;
  --bg-card-subtle: #172033;
  --bg-input: #0f1624;
  --border-color: #1f2a40;
  --border-highlight: #334566;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #38bdf8;
  --accent-primary-hover: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.18);
  --accent-badge-bg: rgba(56, 189, 248, 0.12);
  --accent-badge-border: rgba(56, 189, 248, 0.35);

  --success-color: #22c55e;
  --danger-color: #f43f5e;
  --warning-color: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-highlight: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.15);
  --accent-badge-bg: rgba(37, 99, 235, 0.08);
  --accent-badge-border: rgba(37, 99, 235, 0.25);

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
}

/* Reset y estructura general */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  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);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

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

.font-bold {
  font-weight: 700;
}

.text-accent {
  color: var(--accent-primary);
}

.text-muted {
  color: var(--text-secondary);
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.875rem;
}

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

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

.tool-hero {
  margin-bottom: 2rem;
  text-align: center;
}

.tool-hero-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.tool-hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 800px;
  margin: 0 auto;
}

/* Barra de navegación de categorías (Pills táctiles) */
.category-nav-wrapper {
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.category-nav-pills {
  display: flex;
  gap: 0.5rem;
  padding: 0.375rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  min-width: max-content;
}

.category-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.category-nav-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-card-subtle);
}

.category-nav-btn.active {
  color: #ffffff;
  background-color: var(--accent-primary);
  box-shadow: 0 4px 14px var(--accent-glow);
}

[data-theme="light"] .category-nav-btn.active {
  color: #ffffff;
}

/* Paneles de contenido */
.tool-tab-panel {
  display: none;
}

.tool-tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Estructura en 2 columnas: Controles a la izquierda, Resultados a la derecha */
.tool-workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 992px) {
  .tool-workspace-grid {
    grid-template-columns: 380px 1fr;
  }
}

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

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

.tool-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Grupos de opciones de radio segmentados */
.segmented-radios {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  background-color: var(--bg-input);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.segmented-radios.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented-radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  min-height: 40px;
  text-align: center;
}

.segmented-radio-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-radio-label:has(input:checked) {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Campos de formulario */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.form-select, .form-input, .form-textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-textarea {
  height: auto;
  min-height: 80px;
  padding: 0.75rem 1rem;
  resize: vertical;
}

.form-select {
  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='%2338bdf8' 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;
  padding-right: 40px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

[data-theme="light"] .form-select {
  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='%232563eb' 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");
}

.form-select option, .form-select optgroup {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Slider de entrada */
.slider-group {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.form-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  outline: none;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

/* Botones principales */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  padding: 0 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  background-color: var(--accent-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 1rem;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
}

.btn-icon-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-icon-subtle.text-danger:hover {
  background-color: rgba(244, 63, 94, 0.15);
  color: var(--danger-color);
}

/* Tarjetas de resultados de tallas */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.size-stat-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 0.85rem;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.size-stat-card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.size-stat-flag {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  display: block;
}

.size-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.size-stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.size-stat-card.highlight {
  border-color: var(--accent-badge-border);
  background-color: var(--accent-badge-bg);
}

.size-stat-card.highlight .size-stat-value {
  color: var(--accent-primary);
}

/* Callouts y badges de información */
.info-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background-color: var(--bg-card-subtle);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 1rem;
}

.info-callout strong {
  color: var(--text-primary);
}

.result-highlight-badge {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  background-color: var(--accent-primary);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
}

/* Tablas de equivalencias completas */
.table-responsive-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  margin-top: 1rem;
  scrollbar-width: thin;
}

.sizes-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.sizes-table th {
  background-color: var(--bg-card-subtle);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.sizes-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.sizes-table tbody tr {
  cursor: pointer;
}

.sizes-table tbody tr:hover td {
  background-color: var(--bg-card-subtle);
}

.sizes-table tbody tr.row-active td {
  background-color: var(--accent-badge-bg);
  color: var(--accent-primary);
  font-weight: 700;
}

/* Guía anatómica visual (SVG) */
.guide-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .guide-container {
    grid-template-columns: 320px 1fr;
  }
}

.guide-svg-box {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.guide-hotspot {
  cursor: pointer;
  transition: all 0.2s ease;
}

.guide-hotspot circle {
  fill: var(--accent-primary);
  stroke: #ffffff;
  stroke-width: 2;
  transition: all 0.2s ease;
}

.guide-hotspot:hover circle, .guide-hotspot.active circle {
  fill: #f43f5e;
  r: 9;
  filter: drop-shadow(0 0 6px rgba(244, 63, 94, 0.7));
}

.guide-hotspot text {
  fill: var(--text-primary);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.guide-tip-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.guide-tip-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.guide-tip-icon {
  font-size: 2rem;
}

/* Libreta "Mis tallas" */
.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.profile-summary-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: border-color 0.2s ease;
}

.profile-summary-card:hover {
  border-color: var(--border-highlight);
}

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

.profile-card-title {
  font-size: 1.05rem;
}

.profile-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.profile-card-notes {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

.empty-state-notice {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-secondary);
}

/* Modales y toasts sin window.alert */
.tool-toast-msg {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: var(--text-primary);
  color: var(--bg-page);
  padding: 0.65rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

.tool-toast-msg.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tool-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10000;
}

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

.tool-modal-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.2s ease forwards;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.tool-modal-body {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.tool-modal-footer {
  display: flex;
  justify-content: flex-end;
}
