/* ════════════════════════════════════════════════════════════════
   SHARED.CSS — Diseño base pisorentable.org
   Variables, reset, nav, footer, componentes globales
   ════════════════════════════════════════════════════════════════ */

/* ════ CSS VARIABLES ════ */
:root {
  /* Primario — Azul profesional inmobiliario */
  --primary: #1a5fa8;
  --primary-dark: #154d8a;
  --primary-light: #dbeafe;

  /* Éxito / Positivo */
  --success: #059669;
  --success-light: #d1fae5;

  /* Alerta */
  --warning: #f59e0b;
  --warning-light: #fef3c7;

  /* Error / Negativo */
  --danger: #ef4444;
  --danger-light: #fee2e2;

  /* Textos */
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;

  /* Fondos */
  --bg: #f9fafb;
  --bg-card: #ffffff;
  --bg-section: #f3f4f6;

  /* Bordes */
  --border: #e5e7eb;
  --border-light: #f3f4f6;

  /* Semántico rentabilidad */
  --rentabilidad-positiva: #059669;
  --rentabilidad-negativa: #ef4444;
  --rentabilidad-neutral: #f59e0b;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

  /* Layout */
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --nav-height: 64px;
  --content-max: 1200px;
  --content-narrow: 800px;
}

/* ════ DARK MODE ════ */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #1e3a5f;
  --text: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-light: #9ca3af;
  --bg: #111827;
  --bg-card: #1f2937;
  --bg-section: #1a202c;
  --border: #374151;
  --border-light: #2d3748;
}

/* ════ RESET / NORMALIZE ════ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.6;
  font-size: 1rem;
  transition: color 200ms, background-color 200ms;
}

main {
  display: block;
}

/* ════ LAYOUT ════ */
.container {
  max-width: var(--content-max);
  padding: 0 1.5rem;
  margin: 0 auto;
  width: 100%;
}

.container-narrow {
  max-width: var(--content-narrow);
  padding: 0 1.5rem;
  margin: 0 auto;
  width: 100%;
}

/* ════ NAV ════ */
header {
  position: sticky;
  top: 0;
  height: var(--nav-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0 1.5rem;
  max-width: var(--content-max);
  margin: 0 auto;
}

.nav-logo {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
}

.nav-logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

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

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background-color: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 200ms, color 200ms;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

/* ════ MEGA MENU (Desktop) ════ */
.mega-menu {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

.mega-item {
  position: relative;
}

.mega-trigger {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: none;
  background-color: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  transition: color 200ms, background-color 200ms;
  min-height: 44px;
}

.mega-trigger:hover,
.mega-trigger.active {
  background-color: var(--primary-light);
  color: var(--primary);
}

.mega-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 480px;
  max-width: calc(100vw - 2rem);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 200ms, visibility 200ms, transform 200ms;
  z-index: 200;
  padding: 0;
}

.mega-item:hover .mega-panel,
.mega-panel--visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-featured {
  margin: 0.75rem 1.25rem 1.25rem;
}

.mega-panel-inner {
  padding: 1.25rem;
  display: flex;
  gap: 1.5rem;
}

.mega-group {
  min-width: 200px;
}

.mega-group-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.mega-link {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: background-color 150ms;
  margin-bottom: 0.25rem;
}

.mega-link:hover {
  background-color: var(--bg-section);
}

.mega-link-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.mega-link-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
}

.mega-link-label {
  font-size: 0.875rem;
  font-weight: 500;
}

.mega-link-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.mega-featured {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background-color: var(--primary-light);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.875rem;
  display: block;
  text-align: center;
  transition: background-color 150ms;
}

.mega-featured:hover {
  background-color: var(--primary);
  color: white;
}

/* ════ MOBILE MENU ════ */
.mobile-menu-btn {
  display: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-nav {
  display: none;
}

/* Animación entrada menú móvil — compatible iOS */
@keyframes mobileNavIn {
  from { opacity: 0; -webkit-transform: translateY(-6px); transform: translateY(-6px); }
  to   { opacity: 1; -webkit-transform: translateY(0);    transform: translateY(0); }
}

@media (max-width: 768px) {
  .mega-menu {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Menú móvil: position:fixed con approach display:none/block
     Evita bugs de iOS con transform en elementos fixed */
  .mobile-nav {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;               /* ocupa toda la pantalla por debajo del nav */
    background-color: var(--bg-card);
    border-top: 1px solid var(--border);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* scroll suave en iOS */
    overscroll-behavior: contain;      /* evita scroll del body al llegar al límite */
    z-index: 999;
    padding-bottom: env(safe-area-inset-bottom, 16px); /* notch iPhone */
  }

  .mobile-nav.open {
    display: block;
    -webkit-animation: mobileNavIn 220ms ease both;
    animation: mobileNavIn 220ms ease both;
  }

  .mobile-section {
    border-bottom: 1px solid var(--border);
  }

  .mobile-section-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;           /* elimina triángulo nativo de <summary> */
    width: 100%;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    color: var(--text);
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 150ms;
  }

  /* Elimina triángulo nativo de summary en todos los navegadores */
  .mobile-section-trigger::-webkit-details-marker,
  .mobile-section-trigger::marker {
    display: none;
  }

  .mobile-section-trigger:hover,
  .mobile-section-trigger:focus-visible {
    background-color: var(--bg-section);
    outline: none;
  }

  .mobile-section-trigger::after {
    content: '›';
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: transform 220ms;
    line-height: 1;
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
  }

  .mobile-section[open] .mobile-section-trigger::after {
    -webkit-transform: rotate(270deg);
    transform: rotate(270deg);
  }

  .mobile-section-links {
    padding: 0.25rem 1.5rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background-color: var(--bg-section);
  }

  .mobile-section-links a {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.625rem 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-radius: var(--radius);
    transition: color 150ms, background-color 150ms;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .mobile-section-links a:hover,
  .mobile-section-links a.active {
    color: var(--primary);
    background-color: var(--primary-light);
  }

  .mobile-direct-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
    transition: background-color 150ms, color 150ms;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .mobile-direct-link:hover,
  .mobile-direct-link.active {
    background-color: var(--bg-section);
    color: var(--primary);
  }
}

/* ════ FOOTER ════ */
footer {
  background-color: var(--text);
  color: white;
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}

.footer-grid {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
}

.footer-brand h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.footer-brand p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}

.footer-col-title {
  font-weight: 600;
  margin-bottom: 1rem;
  color: white;
  font-size: 0.9rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 200ms;
}

.footer-links a:hover {
  color: white;
}

.footer-bottom {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

/* Footer contact form placeholder color */
footer input::placeholder,
footer textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* ════ BREADCRUMBS ════ */
.breadcrumbs,
.breadcrumb-nav {
  display: flex;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.75rem 0;
  flex-wrap: wrap;
  align-items: center;
}

.breadcrumbs a,
.breadcrumb-nav a,
.bc-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 200ms;
}

.breadcrumbs a:hover,
.breadcrumb-nav a:hover,
.bc-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Separador "/" */
.breadcrumbs .bc-sep,
.breadcrumb-nav .bc-sep,
.bc-sep {
  color: var(--text-light);
  font-weight: 400;
  user-select: none;
}

/* Página actual (último elemento) */
.breadcrumbs span:not(.bc-sep),
.breadcrumb-nav span:not(.bc-sep),
.bc-current {
  color: var(--text);
  font-weight: 500;
}

.breadcrumbs li:not(:last-child)::after {
  content: '/';
  margin-left: 0.5rem;
  color: var(--border);
}

/* ════ BUTTONS ════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 200ms;
  text-align: center;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

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

.btn-success {
  background-color: var(--success);
  color: white;
}

.btn-success:hover {
  background-color: #047857;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-lg {
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ════ CARDS ════ */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: all 200ms;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-2px);
}

/* ════ INPUTS ════ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.input-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background-color: var(--bg-card);
  transition: border-color 200ms, box-shadow 200ms;
  min-height: 44px;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.input-suffix {
  position: absolute;
  right: 0.875rem;
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 0.9rem;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ════ BADGES ════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background-color: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background-color: var(--warning-light);
  color: #d97706;
}

.badge-danger {
  background-color: var(--danger-light);
  color: var(--danger);
}

/* ════ SEMÁFORO ════ */
.semaforo {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.semaforo-verde {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--rentabilidad-positiva);
  animation: pulse-success 2s infinite;
}

.semaforo-ambar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--rentabilidad-neutral);
  animation: pulse-warning 2s infinite;
}

.semaforo-rojo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--rentabilidad-negativa);
  animation: pulse-danger 2s infinite;
}

@keyframes pulse-success {
  0%, 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7); }
  50% { box-shadow: 0 0 0 10px rgba(5, 150, 105, 0); }
}

@keyframes pulse-warning {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  50% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* ════ KPI CARDS ════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: all 200ms;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.kpi-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-value {
    font-size: 1.5rem;
  }

  .kpi-label {
    font-size: 0.7rem;
  }
}

/* ════ CALCULADORA HERO ════ */
.calc-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: white;
  padding: 3rem 0 2rem;
  position: relative;
  overflow: hidden;
}

.calc-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle at 20% 50%, rgba(255,255,255,.05) 2px, transparent 2px);
  background-size: 40px 40px;
  opacity: 0.5;
  pointer-events: none;
}

.calc-hero-inner {
  position: relative;
  z-index: 1;
}

.calc-hero h1 {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.calc-hero-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1.5rem;
  max-width: 600px;
  line-height: 1.6;
}

.calc-hero-badge {
  display: inline-flex;
  gap: 0.375rem;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.15);
  padding: 0.35rem 0.875rem;
  border-radius: 999px;
  font-size: 0.8rem;
  margin-bottom: 0.875rem;
  backdrop-filter: blur(4px);
}

/* ════ TABLA ════ */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-card);
  min-width: 600px;
}

th {
  background-color: var(--bg-section);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
  color: var(--text);
}

tbody tr:hover td {
  background-color: var(--bg-section);
}

/* ════ FAQ ════ */
.faq-section {
  max-width: var(--content-narrow);
  margin: 0 auto;
}

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.625rem;
  overflow: hidden;
  transition: border-color 200ms;
}

details[open] {
  border-color: var(--primary);
}

summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background-color 200ms;
  background-color: var(--bg);
}

summary:hover {
  background-color: var(--bg-section);
}

summary::after {
  content: '＋';
  color: var(--text-secondary);
  font-weight: 600;
  transition: transform 200ms;
}

details[open] summary::after {
  content: '−';
  transform: scale(1.2);
}

details > div {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.925rem;
}

details p + p {
  margin-top: 0.75rem;
}

/* ════ CALCULADORA LAYOUT ════ */
.calc-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.calc-form-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.calc-results-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: calc(var(--nav-height) + 2rem);
}

@media (max-width: 1024px) {
  .calc-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .calc-results-section {
    position: static;
  }
}

/* ════ SECTION ════ */
.section {
  padding: 3rem 0;
}

.section-title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.section-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1rem;
}

.section-alt {
  background-color: var(--bg-section);
}

/* ════ COOKIE CONSENT ════ */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--text);
  color: white;
  padding: 1rem 1.5rem;
  display: none;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  z-index: 9999;
  flex-wrap: wrap;
}

.cookie-banner.visible {
  display: flex;
}

.cookie-banner-text {
  font-size: 0.875rem;
  flex: 1;
  min-width: 250px;
}

.cookie-banner-buttons {
  display: flex;
  gap: 0.75rem;
}

.cookie-banner button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 200ms;
}

.cookie-banner-accept {
  background-color: var(--primary);
  color: white;
}

.cookie-banner-accept:hover {
  background-color: var(--primary-dark);
}

.cookie-banner-reject {
  background-color: transparent;
  color: white;
  border: 1px solid white;
}

.cookie-banner-reject:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* ════ ALERTS ════ */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.alert-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  margin-top: 0.15rem;
}

.alert-info {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

.alert-success {
  border-color: var(--success);
  background-color: var(--success-light);
  color: #065f46;
}

.alert-warning {
  border-color: var(--warning);
  background-color: var(--warning-light);
  color: #92400e;
}

.alert-danger {
  border-color: var(--danger);
  background-color: var(--danger-light);
  color: #7f1d1d;
}

/* ════ UTILIDADES ════ */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

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

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }

.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

/* ════ RESPONSIVE ════ */
@media (max-width: 1024px) {
  .container,
  .container-narrow {
    padding: 0 1rem;
  }

  .nav-inner {
    padding: 0 1rem;
  }
}

@media (max-width: 640px) {
  .container,
  .container-narrow {
    padding: 0 1rem;
  }

  .section {
    padding: 2rem 0;
  }

  .calc-form-section {
    padding: 1.5rem;
  }

  .calc-results-section {
    padding: 1.5rem;
  }

  .faq-section details {
    margin-bottom: 0.5rem;
  }

  summary {
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    min-height: 44px;
  }

  details > div {
    padding: 0 1rem 1rem;
    font-size: 0.875rem;
  }

  /* Mobile fix — KPI grid on small screens */
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-value {
    font-size: 1.5rem;
  }

  /* Mobile fix — Better button sizing */
  .btn {
    width: 100%;
  }

  .btn-sm {
    min-height: auto;
    padding: 0.5rem 0.75rem;
  }

  /* Mobile fix — Table responsiveness */
  table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.5rem 0.5rem;
  }
}

/* Mobile fix — Extra small devices (320px-375px) */
@media (max-width: 375px) {
  .container,
  .container-narrow {
    padding: 0 0.75rem;
  }

  h1 {
    font-size: clamp(1.4rem, 5vw, 2rem);
  }

  h2 {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
  }

  h3 {
    font-size: clamp(1rem, 3vw, 1.2rem);
  }

  .section {
    padding: 1.5rem 0;
  }

  .calc-panel {
    padding: 1.25rem;
    margin-bottom: 1rem;
  }

  .calc-grid {
    gap: 0.75rem;
  }

  .input-group {
    margin-bottom: 0.75rem;
  }

  .input-group label {
    font-size: 0.8rem;
  }

  .btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }

  .kpi-grid {
    gap: 0.5rem;
  }

  .kpi-card {
    padding: 0.75rem;
  }

  .kpi-value {
    font-size: 1.25rem;
  }

  .kpi-label {
    font-size: 0.65rem;
  }

  /* Mobile fix — Modal on small screens */
  .modal-box {
    padding: 1.25rem;
  }

  .modal-seccion {
    padding: 0.6rem 0.7rem;
    gap: 0.5rem;
  }

  .modal-actions {
    gap: 0.5rem;
  }

  /* Mobile fix — Footer grid */
  .footer-grid {
    gap: 1.25rem;
  }

  .footer-brand p {
    font-size: 0.8rem;
  }

  .footer-col-title {
    font-size: 0.8rem;
  }

  .footer-links a {
    font-size: 0.8rem;
  }

  /* Mobile fix — Breadcrumbs */
  .breadcrumbs {
    font-size: 0.75rem;
  }

  /* Mobile fix — Alert */
  .alert {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .alert-icon {
    font-size: 0.95rem;
  }
}

/* ════ CONTACT FORM GLOBAL (Formspree) ════ */
.contact-section-global {
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem;
  margin-top: 4rem;
}

.contact-section-global h2 {
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: 1.4rem;
}

.contact-section-global .lead {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.contact-form-global {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-form-global__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .contact-form-global__row {
    grid-template-columns: 1fr;
  }
}

.contact-form-global input,
.contact-form-global textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 150ms;
  box-sizing: border-box;
}

.contact-form-global input:focus,
.contact-form-global textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.contact-form-global textarea {
  resize: vertical;
  min-height: 100px;
}

.contact-form-global button[type="submit"] {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  align-self: flex-start;
  transition: background 200ms, transform 100ms;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.contact-form-global button[type="submit"]:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
