/**
 * Organizador de custodia compartida y mochila de cambio de casa - Estilos oficiales
 * Fijate Tools
 */

: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-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --accent-amber: #d97706;
  --accent-amber-bg: #fffbeb;
  --accent-amber-border: #fde68a;

  --accent-green: #16a34a;
  --accent-green-bg: #f0fdf4;
  --accent-green-border: #bbf7d0;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07);
}

[data-theme="dark"],
body.dark-theme {
  --bg-page: #0b0f17;
  --bg-card: #131b2a;
  --bg-subtle: #1a2436;
  --border-color: #27354a;
  --border-focus: #60a5fa;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e293b;

  --accent-amber: #f59e0b;
  --accent-amber-bg: #291e0a;
  --accent-amber-border: #5a3c08;

  --accent-green: #22c55e;
  --accent-green-bg: #0d2818;
  --accent-green-border: #14532d;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

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

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.hero-title,
.panel-title {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

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

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

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

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Tarjeta hero principal */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.hero-title-group h2 {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 0.35rem 0;
  color: var(--text-main);
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

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

/* Botones de acción */
.btn-action-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
}

.btn-action-outline:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--text-light);
}

.btn-action-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
}

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

.btn-action-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  background: #16a34a;
  border: 1px solid #16a34a;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.2s ease;
  min-height: 40px;
}

.btn-action-whatsapp:hover {
  background: #15803d;
}

/* Banner de estado de ruta entre casas */
.house-route-banner {
  background: var(--primary-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.house-route-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
}

.btn-switch-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  cursor: pointer;
}

/* KPIs de resumen */
.kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

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

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.kpi-val {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* Barra de progreso global */
.global-progress-track {
  width: 100%;
  height: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.global-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  width: 0%;
  transition: width 0.3s ease;
}

/* Pestañas */
.nav-tabs-wrapper {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-height: 40px;
}

.nav-tab-btn:hover {
  color: var(--text-main);
}

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

.tab-panel {
  display: none;
}

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

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

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

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

.panel-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Pocket Check (Los 5 esenciales de bolsillo) */
.pocket-check-box {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(16, 185, 129, 0.05));
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.pocket-check-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.pocket-check-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--primary);
}

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

.pocket-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}

.pocket-item.is-done {
  background: var(--accent-green-bg);
  border-color: var(--accent-green-border);
}

.pocket-item.is-done .checklist-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Tarjetas de categorías */
.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.category-header {
  padding: 0.85rem 1.25rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.category-title-area {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.category-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.category-counter {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.category-progress-track {
  width: 100px;
  height: 6px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

.category-progress-bar {
  height: 100%;
  width: 0%;
  transition: width 0.25s ease;
}

.category-items-list {
  padding: 0.5rem 1rem;
}

/* Ítems */
.checklist-item {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-item.is-done .checklist-text {
  text-decoration: line-through;
  color: var(--text-light);
}

.checklist-item.is-critical {
  background-color: var(--accent-amber-bg);
  border-left: 3px solid var(--accent-amber);
  padding-left: 0.75rem;
  border-radius: var(--radius-sm);
  margin: 0.25rem 0;
}

.checklist-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.checklist-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s ease;
}

.custom-checkbox svg {
  display: none;
  stroke: #ffffff;
}

.checklist-label input[type="checkbox"]:checked ~ .custom-checkbox {
  background: var(--primary);
  border-color: var(--primary);
}

.checklist-label input[type="checkbox"]:checked ~ .custom-checkbox svg {
  display: block;
}

.checklist-label input[type="checkbox"]:focus-visible ~ .custom-checkbox {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.checklist-text {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.4;
  flex: 1;
}

.badge-critical {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--accent-amber);
  color: #ffffff;
  margin-left: 0.5rem;
}

.item-tip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--accent-amber);
  padding-left: 2rem;
}

/* Consejos de duplicados */
.duplicate-advice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.duplicate-item-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
}

.duplicate-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

.duplicate-item-reason {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

/* Formulario de ajustes */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.setting-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.setting-input,
.setting-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  box-sizing: border-box;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

/* Modales accesibles */
.fijate-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 1rem;
}

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

.fijate-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  color: var(--text-main);
}

.fijate-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.75rem 0;
}

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

.fijate-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Sección SEO y FAQ */
.seo-content-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-sm);
}

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

.seo-content-section p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.faq-accordion {
  margin-top: 1.5rem;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  background: var(--bg-subtle);
  overflow: hidden;
}

.faq-summary {
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  color: var(--text-main);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-summary::-webkit-details-marker {
  display: none;
}

.faq-summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--text-light);
}

.faq-item[open] .faq-summary::after {
  content: '−';
}

.faq-body {
  padding: 0 1.25rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

@media (max-width: 768px) {
  .hero-header {
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
  }

  .btn-action-outline,
  .btn-action-primary,
  .btn-action-whatsapp {
    width: 100%;
  }

  .kpis-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .kpis-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .app-header,
  .fijate-footer,
  .tool-ad-sidebar,
  .tools-ad-banner-section,
  .nav-tabs-wrapper,
  .hero-actions,
  .no-print,
  .fijate-modal-overlay,
  .related-tools-section,
  .affiliate-showcase-section,
  .seo-content-section {
    display: none !important;
  }

  .main-wrapper.tool-layout {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tab-panel {
    display: block !important;
  }
}
