/* ========================================
   CALCULADORA DE HIPOTECA - STYLES
   ======================================== */

/* === VARIABLES CSS === */
:root {
  /* Colores principales */
  --primary: #1e40af;        /* Azul confianza */
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --accent: #10b981;         /* Verde dinero */
  --accent-light: #34d399;
  
  /* Escala de grises */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Semánticos */
  --bg: #ffffff;
  --surface: var(--gray-50);
  --text: var(--gray-900);
  --text-muted: var(--gray-600);
  --border: var(--gray-200);
  
  /* Tipografía */
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;
  --font-display: 'Manrope', var(--font-body);
  
  /* Espaciado */
  --container-width: 1200px;
  --gap: 1.5rem;
  --radius: 12px;
  --radius-sm: 8px;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  
  /* Transiciones */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --gray-100: #1e293b;
    --gray-200: #334155;
  }
}

/* === RESET & BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

a:hover {
  color: var(--primary-light);
}

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

@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
}

/* === HEADER === */
.header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.9);
}

@media (prefers-color-scheme: dark) {
  .header {
    background: rgba(15, 23, 42, 0.9);
  }
}

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

.logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav a {
  font-weight: 500;
  font-size: 0.95rem;
}

/* === HERO === */
.hero {
  padding: 3rem 0 2rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  opacity: 0.95;
  max-width: 700px;
  margin: 0 auto;
}

/* === CALCULATOR SECTION === */
.calculator-section {
  padding: 3rem 0;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.tab {
  background: none;
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s var(--ease);
}

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

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

/* Calculator Card */
.calculator-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.calculator-card h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

/* Examples */
.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.examples-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.example-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-example {
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

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

/* Form */
.calculator-form {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .calculator-form {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

.form-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.form-group input {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s var(--ease);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons */
.btn-calculate {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.btn-calculate:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30, 64, 175, 0.4);
}

.btn-calculate:active {
  transform: translateY(0);
}

.btn-secondary {
  padding: 0.75rem 1.5rem;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

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

/* Results */
.results {
  margin-top: 2rem;
  animation: fadeIn 0.4s var(--ease);
}

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

.result-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .result-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .result-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-card.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-color: var(--primary);
  color: white;
}

.result-card.primary .result-label {
  color: rgba(255, 255, 255, 0.9);
}

.result-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-value {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--text);
}

.result-card.primary .result-value {
  color: white;
}

/* Chart */
.chart-container {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.chart-container h4 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
}

/* Table */
.table-container {
  margin: 2rem 0;
}

.table-container h4 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.table-controls {
  margin-bottom: 1rem;
}

.table-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.amortization-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.amortization-table th {
  background: var(--surface);
  padding: 0.75rem;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
}

.amortization-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.amortization-table tr:hover {
  background: var(--surface);
}

.amortization-table .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Compare Mode */
.compare-grid {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

.results.compact {
  margin-top: 1.5rem;
}

.results.compact .result-grid {
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.results.compact .result-card {
  padding: 1rem;
}

.results.compact .result-value {
  font-size: 1.5rem;
}

.difference-card {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  padding: 2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.difference-card h4 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.difference-card .savings {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--font-display);
  margin-bottom: 0.5rem;
}

.difference-card p {
  opacity: 0.95;
}

/* === PRIVACY BADGE === */
.privacy-badge {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
}

.privacy-badge p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* === AD SLOTS === */
.ad-slot {
  padding: 2rem 0;
}

.ad-placeholder {
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* === HOW IT WORKS === */
.how-it-works {
  padding: 4rem 0;
  background: var(--surface);
}

.how-it-works h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  text-align: center;
  margin-bottom: 3rem;
}

.steps {
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step {
  text-align: center;
}

.step-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 auto 1rem;
}

.step h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

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

/* === SEO CONTENT === */
.content-seo {
  padding: 4rem 0;
}

.content-seo h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 2rem;
}

.content-seo h3 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
}

.content-seo p {
  margin-bottom: 1rem;
  line-height: 1.8;
}

.content-seo ul {
  margin: 1rem 0;
  padding-left: 2rem;
}

.content-seo li {
  margin-bottom: 0.75rem;
  line-height: 1.8;
}

.content-seo code {
  background: var(--surface);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
}

/* === FAQ === */
.faq-section {
  padding: 4rem 0;
  background: var(--surface);
}

.faq-section h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

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

.faq-item summary {
  padding: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.faq-item summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  transition: transform 0.3s var(--ease);
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item summary:hover {
  background: var(--surface);
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* === FOOTER === */
.footer {
  background: var(--gray-900);
  color: var(--gray-300);
  padding: 2rem 0;
}

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

@media (min-width: 768px) {
  .footer-content {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer p {
  margin: 0;
  font-size: 0.9rem;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.footer-nav a {
  color: var(--gray-300);
  font-size: 0.9rem;
}

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

/* === PRINT STYLES === */
@media print {
  .header, .hero, .privacy-badge, .ad-slot,
  .how-it-works, .content-seo, .faq-section, .footer,
  .btn-calculate, .btn-secondary, .tabs, .examples {
    display: none !important;
  }
  
  .calculator-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  .result-card {
    break-inside: avoid;
  }
  
  .chart-container {
    break-inside: avoid;
  }
}

/* ==========================================
   AVISO LEGAL DE LA CALCULADORA
   Obligatorio en toda calculadora (plan, seccion 4.1)
   ========================================== */
.disclaimer {
  padding: 1.25rem 0;
}

.disclaimer .container {
  max-width: 720px;
}

.disclaimer-text,
.disclaimer-meta {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary, #6b7280);
}

.disclaimer-text {
  padding: 0.875rem 1rem;
  border-left: 3px solid var(--border, #e5e7eb);
  background: var(--bg-subtle, rgba(0, 0, 0, 0.02));
  border-radius: 0 6px 6px 0;
}

.disclaimer-meta {
  margin-top: 0.625rem;
  font-size: 0.8125rem;
}
