/**
 * Estilos canónicos - Calculadora de jarabe para apicultura
 * Fijate Tools • Paleta Midnight Slate y Acentos Miel/Propóleo
 */

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

  /* Tema claro */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #f59e0b;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-accent: #b45309;

  /* Acentos temáticos apícolas */
  --amber-primary: #d97706;
  --amber-hover: #b45309;
  --amber-light: #fef3c7;
  --amber-border: #fde68a;
  --honey-gold: #f59e0b;
  --wax-yellow: #fbbf24;
  --emerald-success: #059669;
  --emerald-light: #d1fae5;
  --rose-danger: #e11d48;
  --rose-light: #ffe4e6;
  --sky-blue: #0284c7;
  --sky-light: #e0f2fe;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #131b2a;
  --bg-card-subtle: #1a2436;
  --bg-input: #0f1724;
  --border-color: #243247;
  --border-focus: #fbbf24;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-accent: #f59e0b;

  --amber-primary: #f59e0b;
  --amber-hover: #d97706;
  --amber-light: rgba(245, 158, 11, 0.15);
  --amber-border: rgba(245, 158, 11, 0.3);
  --honey-gold: #fbbf24;
  --emerald-success: #10b981;
  --emerald-light: rgba(16, 185, 129, 0.15);
  --rose-danger: #f43f5e;
  --rose-light: rgba(244, 63, 94, 0.15);
  --sky-blue: #38bdf8;
  --sky-light: rgba(56, 189, 248, 0.15);

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

/* Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.hero-title,
.faq-section-title {
  font-family: var(--font-heading);
}

.mono, code, .stat-value {
  font-family: var(--font-mono);
}

/* Layout */
.main-wrapper.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  flex: 1;
}

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

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

/* Aside AdSense */
.tool-ad-sidebar {
  width: 300px;
  flex-shrink: 0;
}

.ad-sticky-box {
  position: sticky;
  top: 90px;
}

@media (max-width: 1535px) {
  .tool-ad-sidebar {
    display: none !important;
  }
}

/* Cabecera descriptiva Hero */
.tool-hero-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tool-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: var(--amber-light);
  color: var(--amber-primary);
  border: 1px solid var(--amber-border);
}

.hero-main-title {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
  color: var(--text-main);
}

.hero-desc {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Barra de pestañas superiores */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar {
  display: none;
}

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

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

.tab-btn.active {
  background: var(--amber-light);
  color: var(--amber-primary);
  border-color: var(--amber-border);
}

/* Card principal y paneles */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* Sección de presets rápidos */
.presets-section {
  margin-bottom: 1.5rem;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.preset-card-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 90px;
}

.preset-card-btn:hover {
  border-color: var(--amber-primary);
  transform: translateY(-1px);
}

.preset-card-btn.active {
  background: var(--amber-light);
  border-color: var(--amber-primary);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
}

.preset-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.25rem;
}

.preset-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.preset-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-accent);
}

.preset-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Selector secundario de modo de entrada */
.subtabs-wrapper {
  display: flex;
  background: var(--bg-card-subtle);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.subtab-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
  text-align: center;
}

.subtab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

/* Formularios y campos */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

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

@media (max-width: 640px) {
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

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

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

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.input-affix-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
  height: 44px;
}

.input-affix-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.input-affix-wrapper input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0 0.85rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  height: 100%;
}

.input-suffix {
  padding: 0 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border-color);
  user-select: none;
}

/* Desplegables <select> conforme a reglas canónicas */
select.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 44px;
  padding: 0 40px 0 0.85rem;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  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%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

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

/* Sliders con indicador numérico */
.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-slider {
  flex: 1;
  height: 6px;
  border-radius: 9999px;
  background: var(--border-color);
  outline: none;
  -webkit-appearance: none;
  accent-color: var(--amber-primary);
  cursor: pointer;
}

/* Área de resultados y desglose */
.results-dashboard {
  margin-top: 1.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.results-headline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary, .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-card-subtle);
  border-color: var(--text-muted);
}

.btn-primary {
  background: var(--amber-primary);
  border: 1px solid transparent;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

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

/* Grid de métricas clave */
.metrics-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 860px) {
  .metrics-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-card.highlight {
  border-color: var(--amber-primary);
  background: var(--amber-light);
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.metric-unit {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.15rem;
}

.metric-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Sección de visualizador del depósito / bidón */
.tank-visualizer-section {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  align-items: center;
}

@media (max-width: 720px) {
  .tank-visualizer-section {
    grid-template-columns: 1fr;
  }
}

.tank-svg-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.tank-svg {
  width: 180px;
  height: 220px;
}

.tank-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recipe-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--amber-light);
  color: var(--amber-primary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Alertas técnicas / Advertencias de HMF */
.tool-alert-box {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.45;
}

.tool-alert-warning {
  background: var(--amber-light);
  border: 1px solid var(--amber-border);
  color: var(--text-main);
}

.tool-alert-danger {
  background: var(--rose-light);
  border: 1px solid var(--rose-danger);
  color: var(--text-main);
}

.tool-alert-info {
  background: var(--sky-light);
  border: 1px solid var(--sky-blue);
  color: var(--text-main);
}

.tool-alert-success {
  background: var(--emerald-light);
  border: 1px solid var(--emerald-success);
  color: var(--text-main);
}

.tool-alert-icon {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Panel de diagnóstico por peso */
.hive-scale-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 820px) {
  .hive-scale-card {
    grid-template-columns: 1fr;
  }
}

.verdict-gauge-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.status-critical {
  background: var(--rose-light);
  color: var(--rose-danger);
  border: 1px solid var(--rose-danger);
}

.status-warning {
  background: var(--amber-light);
  color: var(--amber-primary);
  border: 1px solid var(--amber-border);
}

.status-optimal {
  background: var(--emerald-light);
  color: var(--emerald-success);
  border: 1px solid var(--emerald-success);
}

.status-excess {
  background: var(--sky-light);
  color: var(--sky-blue);
  border: 1px solid var(--sky-blue);
}

/* Barra de progreso de reservas */
.reserve-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.reserve-bar-track {
  width: 100%;
  height: 14px;
  background: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.reserve-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.reserve-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Ficha imprimible y de copia */
.printable-sheet {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Modales canónicos sin alerts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 23, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-backdrop.active .modal-dialog {
  transform: translateY(0);
}

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

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

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

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

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

/* Guía SEO y FAQs */
.seo-guide-section {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.seo-guide-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.seo-guide-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: var(--text-main);
}

.seo-guide-section p, .seo-guide-section li {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.seo-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin: 1rem 0;
}

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

.seo-table th, .seo-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.seo-table th {
  background: var(--bg-card-subtle);
  font-weight: 700;
  color: var(--text-main);
}

.seo-table tr:last-child td {
  border-bottom: none;
}

.faq-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.faq-question {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.faq-answer {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Toast flotante para copiado */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 0.65rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10000;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Impresión */
@media print {
  .app-header,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .tabs-nav,
  .fijate-footer,
  .results-actions,
  .subtabs-wrapper,
  .presets-section {
    display: none !important;
  }

  body, .main-wrapper.tool-layout, .card-main {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .printable-sheet {
    border: 1px solid #000000 !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }
}
