/**
 * Estilos base para el sitio web del Dr. Felipe Hernández Serna
 * Neonatólogo y Pediatra - Saltillo, Coahuila
 */

/* ============================================
   VARIABLES CSS - Paleta de colores
   ============================================ */
:root {
  /* Colores principales - tonos cálidos, no clínico-corporativo */
  --color-primary: #2d6a4f;      /* Verde cálido */
  --color-primary-dark: #1b4332;
  --color-primary-light: #40916c;
  --color-secondary: #d4a373;    /* Beige/Tierra cálido */
  --color-accent: #e76f51;       /* Terracota suave para CTAs */

  /* Colores neutros */
  --color-bg: #faf9f6;           /* Blanco roto cálido */
  --color-bg-alt: #f3f0e9;
  --color-text: #2d3436;
  --color-text-light: #636e72;
  --color-border: #dfe6e9;

  /* Tipografía */
  --font-heading: 'Georgia', serif;
  --font-body: system-ui, -apple-system, sans-serif;

  /* Espaciado */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;

  /* Bordes */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.1);
}

/* ============================================
   RESET Y BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Para que el header no tape las anclas */
}

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

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

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

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

a:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================
   TIPOGRAFÍA
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-primary-dark);
}

h1 {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-md);
}

h2 {
  font-size: 2rem;
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-sm);
}

h4 {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-xs);
}

p {
  margin-bottom: var(--spacing-sm);
}

/* ============================================
   CONTENEDORES
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  max-width: 100%;
  box-sizing: border-box;
}

.section {
  padding: var(--spacing-xl) 0;
}

/* ============================================
   HEADER Y NAVEGACIÓN
   ============================================ */
.header {
  background-color: white;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
}

.header__logo {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary-dark);
}

.header__logo-text {
  display: block;
  font-size: 0.875rem;
  color: var(--color-text-light);
  font-weight: 400;
}

.nav {
  display: flex;
  gap: var(--spacing-md);
}

.nav__link {
  color: var(--color-text);
  font-size: 0.95rem;
  padding: var(--spacing-xs) 0;
  position: relative;
  transition: color 0.2s ease;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width 0.3s ease;
}

.nav__link:hover::after,
.nav__link.active::after {
  width: 100%;
}

.nav__link:hover,
.nav__link.active {
  color: var(--color-primary);
}

.nav__toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-primary);
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
}

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

.nav__toggle:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  color: white;
  padding: var(--spacing-2xl) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="rgba(255,255,255,0.03)"/></svg>');
  background-size: 100px 100px;
  opacity: 0.5;
}

.hero__content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero h1 {
  color: white;
  margin-bottom: var(--spacing-sm);
  animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__subtitle {
  font-size: 1.25rem;
  opacity: 0.95;
  margin-bottom: var(--spacing-lg);
  animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.hero__quote {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.5rem;
  margin-bottom: var(--spacing-lg);
  opacity: 0.9;
  animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

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

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

.btn--outline {
  background-color: transparent;
  border: 2px solid white;
  color: white;
}

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

.btn--whatsapp {
  background-color: #25D366;
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

/* ============================================
   TARJETAS Y CONTENIDO
   ============================================ */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card__title {
  color: var(--color-primary);
  margin-bottom: var(--spacing-sm);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

/* ============================================
   SECCIONES EDUCATIVAS
   ============================================ */
.educational-section {
  background-color: var(--color-bg-alt);
  border-left: 4px solid var(--color-primary);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.educational-section:hover {
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.educational-section h3 {
  color: var(--color-primary);
}

/* ============================================
   LISTAS
   ============================================ */
.list {
  list-style: none;
  padding-left: 0;
}

.list__item {
  padding-left: 1.5rem;
  position: relative;
  margin-bottom: var(--spacing-sm);
}

.list__item::before {
  content: "•";
  color: var(--color-primary);
  font-size: 1.5rem;
  position: absolute;
  left: 0;
  top: -0.25rem;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background-color: var(--color-primary-dark);
  color: white;
  padding: var(--spacing-xl) 0 var(--spacing-lg);
  margin-top: var(--spacing-2xl);
  position: relative;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-accent) 100%);
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-xl);
}

.footer__title {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-sm);
  color: var(--color-secondary);
}

.footer__text {
  opacity: 0.9;
  margin-bottom: var(--spacing-sm);
}

.footer__link {
  color: white;
  opacity: 0.8;
  display: block;
  margin-bottom: 0.5rem;
}

.footer__link:hover {
  opacity: 1;
  color: var(--color-secondary);
}

.footer__bottom {
  text-align: center;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.875rem;
  opacity: 0.7;
}

/* ============================================
   WHATSAPP FLOTANTE
   ============================================ */
.whatsapp-float {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  background-color: #25D366;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: transform 0.2s ease;
}

.whatsapp-float:hover {
  transform: scale(1.1);
}

.whatsapp-float svg {
  width: 30px;
  height: 30px;
  fill: white;
}

/* ============================================
   MEDIA QUERIES - MOBILE FIRST
   ============================================ */

/* Teléfonos muy pequeños (320px - 375px) */
@media (max-width: 375px) {
  :root {
    --spacing-xs: 0.4rem;
    --spacing-sm: 0.8rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 2.5rem;
  }

  .container {
    padding: 0 var(--spacing-sm);
  }

  h1 {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  h3 {
    font-size: 1.1rem;
  }

  .header__logo {
    font-size: 1rem;
  }

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

  .hero {
    padding: var(--spacing-lg) 0;
  }

  .hero__subtitle {
    font-size: 1rem;
  }

  .hero__quote {
    font-size: 1rem;
  }

  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  .card {
    padding: var(--spacing-md);
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .section {
    padding: var(--spacing-lg) 0;
  }

  .whatsapp-float {
    bottom: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 48px;
    height: 48px;
  }

  .whatsapp-float svg {
    width: 24px;
    height: 24px;
  }
}

/* Teléfonos pequeños a medianos (376px - 430px) */
@media (min-width: 376px) and (max-width: 430px) {
  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  .hero {
    padding: var(--spacing-lg) 0;
  }

  .hero__subtitle {
    font-size: 1.1rem;
  }

  .hero__quote {
    font-size: 1.15rem;
  }
}

/* Tablets (768px) */
@media (max-width: 768px) {
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    display: none;
    max-width: 100vw;
  }

  .nav.open {
    display: flex;
  }

  .nav__toggle {
    display: block;
    padding: var(--spacing-sm);
    min-width: 44px;
    min-height: 44px;
  }

  .nav__link {
    padding: var(--spacing-sm) 0;
    font-size: 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .whatsapp-float {
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    width: 50px;
    height: 50px;
  }

  .whatsapp-float svg {
    width: 25px;
    height: 25px;
  }
}

/* Tablets grandes y laptops pequeños (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding: 0 var(--spacing-lg);
  }

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

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

/* Laptops (1025px - 1366px) */
@media (min-width: 1025px) and (max-width: 1366px) {
  .container {
    padding: 0 var(--spacing-lg);
  }
}

/* Monitores grandes (1367px+) */
@media (min-width: 1367px) {
  .container {
    max-width: 1200px;
  }

  .card-grid {
    gap: var(--spacing-xl);
  }
}

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

/* Animación de entrada para secciones */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section {
  animation: fadeInUp 0.5s ease-out;
}

.text-light {
  color: var(--color-text-light);
}

.mt-lg {
  margin-top: var(--spacing-lg);
}

.mb-lg {
  margin-bottom: var(--spacing-lg);
}

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

/* ============================================
   CORRECCIONES RESPONSIVAS ADICIONALES
   ============================================ */

/* Prevenir desplazamiento horizontal */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

* {
  max-width: 100%;
}

/* Asegurar que elementos inline-block no desborden */
img, svg, iframe, video {
  max-width: 100%;
  height: auto;
}

/* Header responsivo para móviles */
@media (max-width: 480px) {
  .header__inner {
    flex-wrap: wrap;
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .header__logo {
    font-size: 1rem;
    line-height: 1.2;
    max-width: 200px;
  }

  .header__logo-text {
    font-size: 0.7rem;
  }
}

/* Tamaño mínimo táctil para botones y enlaces */
.btn, .nav__link, .footer__link, a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.btn--primary, .btn--outline, .btn--whatsapp {
  min-height: 48px;
}

/* Ajustes para emojis grandes en móviles */
@media (max-width: 480px) {
  [style*="font-size: 3rem"] {
    font-size: 2rem !important;
  }

  [style*="font-size: 2.5rem"] {
    font-size: 1.8rem !important;
  }

  [style*="font-size: 2rem"] {
    font-size: 1.5rem !important;
  }
}

/* Corrección para nav-sections en móviles */
@media (max-width: 480px) {
  .nav-sections {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-sections a {
    text-align: center;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Ajustes para el mapa en contacto */
@media (max-width: 768px) {
  .map-container iframe {
    height: 250px !important;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
}

/* Corrección para listas largas en móviles */
@media (max-width: 480px) {
  .list__item {
    padding-left: 1rem;
    font-size: 0.95rem;
  }

  .list__item::before {
    font-size: 1.2rem;
    left: -0.2rem;
    top: 0;
  }
}

/* Ajustes para educational-section en móviles */
@media (max-width: 480px) {
  .educational-section {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
  }

  .educational-section h3 {
    font-size: 1.1rem;
  }

  .educational-section p {
    font-size: 0.95rem;
  }
}

/* Ajustes para el footer en móviles */
@media (max-width: 480px) {
  .footer {
    padding: var(--spacing-lg) 0 var(--spacing-md);
  }

  .footer__title {
    font-size: 1.1rem;
  }

  .footer__text {
    font-size: 0.9rem;
  }
}

/* Ajustes para el FAQ en móviles */
@media (max-width: 480px) {
  .faq-question {
    padding: var(--spacing-sm);
    font-size: 0.95rem;
  }

  .faq-question h3 {
    font-size: 1rem;
    margin: 0;
    padding-right: var(--spacing-md);
  }

  .faq-answer {
    font-size: 0.95rem;
  }
}
