/* ================================
   1. RESET, VARIABLES Y TIPOGRAFÍA
   ================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --azul-corp: #005198;
  --verde-corp: #00aaac;
  --rojo-corp: #ed1163;
  --gris-texto: #2c3e4e;
  --blanco: #fff;
  --gris-claro: #f8fafc;
  --sombra: 0 15px 30px rgba(0, 0, 0, 0.08);
  --radio: 20px;
  --fuente: 'Montserrat', sans-serif;
  --transition: all 0.3s ease;
}

body {
  font-family: var(--fuente);
  font-weight: 400;
  color: var(--gris-texto);
  background: var(--blanco);
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

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

h1, h2, h3, .titulo-hero {
  font-weight: 700;
  color: var(--azul-corp);
  letter-spacing: -0.5px;
}

.titulo-hero {
  color: var(--verde-corp);
}

/* ================================
   2. TOP BAR (FIJA)
   ================================ */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 44px;
  background: var(--verde-corp);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 24px;
  z-index: 1100;
  gap: 16px;
}

.top-bar a {
  color: var(--blanco);
  font-size: 1.2rem;
  transition: opacity 0.2s, transform 0.2s;
}

.top-bar a:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

#mobile-menu-btn {
  display: none;
  position: fixed;
  left: 16px;
  top: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  backdrop-filter: blur(4px);
  padding: 6px;
}

#mobile-menu-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ================================
   3. SIDEBAR (MENÚ LATERAL)
   ================================ */
.sidebar {
  position: fixed;
  top: 44px;
  left: 0;
  width: 260px;
  height: calc(100vh - 44px);
  background: var(--azul-corp);
  z-index: 1000;
  padding: 24px 16px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar.active {
  transform: translateX(0);
}

.sidebar-logo {
  text-align: center;
  margin-bottom: 32px;
}

.sidebar-logo a {
  display: inline-block;
  transition: transform 0.3s;
}

.sidebar-logo a:hover {
  transform: scale(1.03);
}

.sidebar-logo img {
  max-height: 80px;
  margin: 0 auto;
}

.sidebar-nav li {
  color: var(--blanco);
  font-weight: 500;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  position: relative;
  font-size: 0.95rem;
}

.sidebar-nav li:last-child {
  border-bottom: none;
}

.sidebar-nav li .arrow {
  position: absolute;
  right: 4px;
  top: 14px;
  font-size: 0.8rem;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sidebar-nav li .arrow.open {
  transform: rotate(90deg);
}

.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  margin-left: 8px;
  background: var(--blanco);
  border-radius: var(--radio);
  margin-top: 4px;
}

.submenu.open {
  max-height: 500px;
}

.submenu li {
  color: var(--gris-texto);
  padding: 12px 20px;
  border-bottom: 1px solid #eee;
  font-weight: 400;
  transition: background 0.2s, padding-left 0.2s;
}

.submenu li:last-child {
  border-bottom: none;
}

.submenu li:hover {
  background: var(--gris-claro);
  padding-left: 28px;
}

.sidebar-nav li.citas {
  border-bottom: none;
}

.sidebar-nav li.citas a {
  display: block;
  background: var(--verde-corp);
  color: var(--blanco);
  text-align: center;
  padding: 12px 0;
  border-radius: 30px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 15px rgba(0, 170, 172, 0.3);
  position: relative;
  overflow: hidden;
  animation: breathe 2s ease-in-out infinite;
}

.sidebar-nav li.citas a:hover {
  transform: translateY(-3px) scale(1.02);
  background: #009999;
  box-shadow: 0 8px 25px rgba(0, 170, 172, 0.5);
}

.sidebar-nav li.citas a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.5s;
}

.sidebar-nav li.citas a:hover::before {
  left: 100%;
}

@keyframes breathe {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(0, 170, 172, 0.3);
  }
  50% {
    box-shadow: 0 4px 25px rgba(0, 170, 172, 0.6);
  }
}

/* ================================
   4. CONTENIDO PRINCIPAL
   ================================ */
.main-content {
  margin-top: 44px;
  width: 100%;
  min-height: calc(100vh - 44px);
}

/* ================================
   5. SLIDER
   ================================ */
.header-slider {
  position: relative;
  width: 100%;
  height: calc(100vh - 44px);
  overflow: hidden;
}

.header-slider .slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.header-slider .slide.active {
  opacity: 1;
}

.header-slider .slide picture {
  display: block;
  width: 100%;
  height: 100%;
}

.header-slider .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-content {
  position: absolute;
  top: 50%;
  right: 10%;
  transform: translateY(-50%);
  z-index: 400;
  max-width: 500px;
  width: 90%;
  text-align: right;
  pointer-events: none;
}

.slide-content h1 {
  font-size: 2.5rem;
  margin-bottom: 12px;
  color: var(--blanco);
}

.slide-content p {
  font-size: 1.15rem;
  margin-bottom: 24px;
  color: var(--blanco);
}

.slide-content .btn-slider {
  display: inline-block;
  padding: 14px 36px;
  background: var(--verde-corp);
  color: var(--blanco);
  font-weight: 600;
  border-radius: 50px;
  transition: all 0.3s;
  pointer-events: auto;
  box-shadow: 0 4px 15px rgba(0, 170, 172, 0.3);
}

.slide-content .btn-slider:hover {
  transform: translateY(-3px);
  background: #009999;
  box-shadow: 0 8px 25px rgba(0, 170, 172, 0.4);
}

/* ================================
   6. SECCIONES TIPO PANTALLA COMPLETA (HISTORIA / CONTACTO)
   ================================ */
.seccion-historia,
.seccion-dos-columnas {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 44px); /* Alto total de la pantalla */
  background-color: var(--blanco);
  padding: 10vh 5% 5vh 8%; /* Espaciado estructurado */
  display: flex;
  flex-direction: column;
  justify-content: center; /* Centra el texto verticalmente */
  overflow: hidden; /* Evita scrolls horizontales indeseados */
}

/* --- COLUMNA IZQUIERDA (TEXTO) --- */
.historia-titulo,
.columna-titulo {
  font-size: 3.5rem;
  color: var(--azul-corp);
  font-weight: 700;
  margin-bottom: 2rem;
  max-width: 50%; /* Evita que el título choque con la imagen */
  position: relative;
  z-index: 2; /* Mantiene el texto por encima */
  line-height: 1.2;
}

.historia-grid,
.columna-grid {
  display: block; /* Desactivamos el grid/flex aquí para poder superponer la imagen */
  width: 100%;
}

.historia-texto,
.columna-texto {
  width: 45%; /* El texto solo ocupa la mitad izquierda */
  position: relative;
  z-index: 2;
}

.historia-texto p,
.columna-texto p {
  font-size: 1.3rem;
  line-height: 1.8;
  color: #7a7a7a;
  margin-bottom: 1.5rem;
  font-weight: 300;
}

/* --- COLUMNA DERECHA (IMAGEN GIGANTE) --- */
.historia-imagen,
.columna-imagen {
  position: absolute;
  bottom: 0;     /* Pegada exactamente al borde inferior */
  right: 0;      /* Pegada exactamente al borde derecho */
  height: 85vh;  /* Ocupa el 92% de la altura de la pantalla */
  width: 45vw;   /* Le damos mucho espacio a lo ancho */
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  z-index: 1;    /* Queda de fondo por si choca con el texto en pantallas medianas */
  pointer-events: none; /* Evita que la imagen bloquee clics en el texto */
}

.historia-imagen img,
.columna-imagen img {
  height: 100%; /* Obliga a la imagen a tener la altura gigante del contenedor */
  width: auto;  /* Mantiene la proporción original */
  max-width: none !important; /* EL TRUCO VITAL: Rompe la restricción global para que crezca libremente */
  object-fit: contain;
  object-position: bottom right; /* Se ancla rígidamente abajo a la derecha */
  filter: drop-shadow(-15px 15px 25px rgba(0, 0, 0, 0.1));
}

/* --- ESTILOS EXTRA PARA LA PÁGINA DE CONTACTO --- */
.texto-intro { font-size: 1.2rem !important; margin-bottom: 2rem !important; }
.contacto-info-bloques { display: flex; flex-direction: column; gap: 1.5rem; }
.info-item { display: flex; align-items: flex-start; gap: 15px; }
.info-item i { font-size: 1.5rem; color: var(--verde-corp); margin-top: 4px; }
.info-item h3 { font-size: 1.1rem; color: var(--azul-corp); font-weight: 600; margin-bottom: 5px; }
.info-item p { font-size: 0.95rem; color: var(--gris-texto); margin-bottom: 2px;}

/* --- RESPONSIVE --- */
@media (max-width: 1400px) {
  .historia-titulo, .columna-titulo { font-size: 3rem; max-width: 55%; }
  .historia-texto, .columna-texto { width: 50%; }
}

@media (max-width: 992px) {
  .seccion-historia, .seccion-dos-columnas {
    min-height: auto;
    padding: 4rem 5% 0 5%; /* Sin padding abajo para que la imagen toque la siguiente sección */
  }
  .historia-titulo, .columna-titulo {
    max-width: 100%;
    text-align: center;
    font-size: 2.5rem;
  }
  .historia-texto, .columna-texto {
    width: 100%;
    text-align: center;
    padding-bottom: 2rem;
  }
  .historia-imagen, .columna-imagen {
    position: relative; /* En móviles vuelve al flujo normal */
    height: auto;
    width: 100%;
  }
  .historia-imagen img, .columna-imagen img {
    height: auto;
    width: 100%;
    max-width: 100% !important; /* Restauramos el ancho máximo para móviles */
    max-height: 60vh;
    object-position: bottom right;
  }
}

/* Detalles específicos para la página de Contacto */
.texto-intro {
  font-size: 1.15rem !important;
  color: var(--gris-texto) !important;
  font-weight: 500 !important;
  margin-bottom: 2.5rem !important;
}

.contacto-info-bloques {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.info-item i {
  font-size: 1.5rem;
  color: var(--verde-corp);
  margin-top: 4px;
}

.info-item h3 {
  font-size: 1.1rem;
  color: var(--azul-corp);
  margin-bottom: 5px;
}

.info-item p {
  margin-bottom: 2px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--gris-texto);
}

/* Columna de Imagen (Derecha) */
.columna-imagen,
.historia-imagen {
  flex: 1 1 400px;
  display: flex;
  justify-content: flex-end; 
}

.columna-imagen img,
.historia-imagen img {
  width: 100%;
  max-width: 650px;
  height: auto;
  object-fit: contain;
  transition: transform 0.6s ease;
}

/* Responsive para la sección de dos columnas */
@media (max-width: 992px) {
  .seccion-dos-columnas,
  .seccion-historia {
    padding: 3rem 5%;
  }
  .columna-grid,
  .historia-grid {
    flex-direction: column;
    gap: 2rem;
  }
  .columna-imagen,
  .historia-imagen {
    justify-content: center;
    order: 2; 
  }
  .columna-texto,
  .historia-texto {
    order: 1;
    text-align: center;
  }
  .columna-titulo,
  .historia-titulo {
    text-align: center;
    font-size: 2rem;
  }
}

/* ================================
   7. STAFF (EQUIPO MÉDICO)
   ================================ */
.seccion-staff {
  background: var(--gris-claro);
  padding: 4rem 2rem;
}

.staff-titulo {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2.5rem;
  color: var(--azul-corp);
}

.staff-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
}

.staff-card {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 28px 20px 24px;
  flex: 1 1 260px;
  max-width: 300px;
  text-align: center;
  box-shadow: var(--sombra);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.staff-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.12);
}

.staff-img-wrapper {
  width: 240px;
  height: 360px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}

.staff-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.staff-card:hover .staff-img-wrapper img {
  filter: brightness(1.05) sepia(0.15);
  transform: scale(1.05);
}

.staff-card:hover .staff-img-wrapper {
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.staff-social {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px 0 8px;
}

.staff-social a {
  color: #0077b5;
  font-size: 1.6rem;
  transition: transform 0.2s, color 0.2s;
  display: inline-block;
}

.staff-social a:hover {
  transform: scale(1.15);
  color: #005582;
}

.social-hover-bar {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0%;
  height: 3px;
  background: var(--verde-corp);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.22, 0.97, 0.36, 1.1);
}

.staff-card:hover .social-hover-bar {
  width: 55px;
}

.nombre-staff {
  margin-top: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--azul-corp);
}

.staff-card p {
  font-size: 0.85rem;
  color: #5d6f7f;
  font-weight: 500;
}

/* ================================
   8. FOOTER
   ================================ */
footer {
  background: #001f3f;
  color: var(--blanco);
  padding: 3rem 1.5rem;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-col {
  flex: 1 1 200px;
  min-width: 160px;
}

.footer-col.logo-col {
  flex: 1 1 220px;
}

.footer-col.map-col {
  flex: 2 1 260px;
}

.footer-col ul li {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-col ul li i {
  color: var(--verde-corp);
  font-size: 0.7rem;
}

.footer-col ul li a {
  color: var(--blanco);
  transition: color 0.2s, transform 0.2s;
  display: inline-block;
}

.footer-col ul li a:hover {
  color: var(--verde-corp);
  transform: translateX(4px);
}

.footer-col img {
  max-width: 140px;
}

.footer-col .direccion {
  margin-top: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ================================
   9. MEDIA QUERIES (RESPONSIVE GLOBALES)
   ================================ */
@media (min-width: 769px) {
  .sidebar {
    transform: translateX(0) !important;
  }
  .main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
  }
  #mobile-menu-btn {
    display: none !important;
  }
}

@media (max-width: 768px) {
  #mobile-menu-btn {
    display: block;
  }
  .sidebar {
    width: 85%;
    max-width: 320px;
  }
  
  /* ESTILOS DE SLIDER CORREGIDOS PARA MOBILE */
  .slide-content {
    top: auto;
    bottom: 10%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    text-align: center;
    width: 90%;
  }
  
  .slide-content h1 {
    font-size: 2rem;
  }
  .slide-content p {
    font-size: 0.95rem;
  }
  .staff-img-wrapper {
    width: 180px;
    height: 270px;
  }
  .footer-grid {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .footer-col ul li {
    justify-content: center;
  }
}

/* ================================
   ESTILOS DEL FORMULARIO DE CONTACTO
   ================================ */
.formulario-contacto {
  background: var(--gris-claro);
  padding: 25px;
  border-radius: 12px;
  border-left: 4px solid var(--verde-corp);
  margin-bottom: 35px; /* Espacio antes de los datos de contacto */
  box-shadow: 0 5px 15px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.formulario-contacto .form-row input,
.formulario-contacto .form-row textarea,
.formulario-contacto .form-row-doble input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: var(--fuente);
  font-size: 0.95rem;
  color: var(--gris-texto);
  background: var(--blanco);
  transition: all 0.3s ease;
}

.formulario-contacto .form-row-doble {
  display: flex;
  gap: 15px;
}

.formulario-contacto input:focus,
.formulario-contacto textarea:focus {
  border-color: var(--verde-corp);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 170, 172, 0.1);
}

.formulario-contacto textarea {
  resize: vertical;
}

.formulario-contacto .btn-enviar {
  background: var(--verde-corp);
  color: var(--blanco);
  border: none;
  padding: 12px 30px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 170, 172, 0.2);
}

.formulario-contacto .btn-enviar:hover {
  background: var(--azul-corp);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 81, 152, 0.3);
}

/* Responsive para el formulario */
@media (max-width: 768px) {
  .formulario-contacto .form-row-doble {
    flex-direction: column;
  }
  .formulario-contacto .btn-enviar {
    width: 100%;
  }
}