/* Variables CSS para colores personalizados */
:root {
    --primary-color: #81a532;
    --primary-dark: #427148;
    --secondary-color: #249847;
    --light-bg: #f7faf5;
    --text-dark: #333;
}

/* Estilos base */
body {
    font-family: "Work Sans", sans-serif;
    line-height: 1.7;
    color: var(--text-dark);
}

/* Override de colores primarios de Bootstrap */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.text-primary {
    color: var(--primary-dark) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

/* Header personalizado */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.logo-container {
    max-width: 160px;
    margin: 0 auto;
}

.titulo {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Navegación */
.navbar-nav .nav-link {
    color: var(--light-bg) !important;
    font-weight: 600;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
}



/* Subrayado animado para enlaces del menú */
.navbar-nav .nav-link {
    position: relative;
}

.navbar-nav .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    background: var(--primary-dark);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 220ms cubic-bezier(.2,.9,.2,1);
    border-radius: 2px;
    opacity: 0.95;
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link:focus::after,
.navbar-nav .nav-link.active::after {
    transform: scaleX(1);
}

/* Ajuste para pantallas pequeñas: bajar la línea un poco menos */
@media (max-width: 576px) {
    .navbar-nav .nav-link::after {
        bottom: -4px;
    }
}

/* Tamaño y color de los iconos en el menú */
.navbar-nav .nav-link .bi {
    color: var(--primary-dark);
    font-size: 1.05rem; /* tamaño base */
    line-height: 1;
    vertical-align: -.125rem;
    transition: color 160ms ease, transform 160ms ease;
}

.navbar-nav .nav-link:hover .bi,
.navbar-nav .nav-link:focus .bi {
    color: var(--light-bg);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .navbar-nav .nav-link .bi {
        font-size: 1.12rem;
    }
}

@media (max-width: 576px) {
    /* en móviles hacemos los iconos un poco más grandes para mejor toque */
    .navbar-nav .nav-link .bi {
        font-size: 1.18rem;
    }
    /* más espacio táctil en los enlaces */
    .navbar-nav .nav-link {
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
    }
}

/* Cards de sitios */
.site-card {
    transition: all 0.3s ease;
    min-height: 120px;
}

.site-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
}

.site-card .card-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

/* Mejora del estilo para la sección de bienvenida */
.bg-light .card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
    border-radius: 12px;
}

.bg-light .card-body {
    padding: 2.25rem;
}

.bg-light .lead {
    font-size: 1.125rem; /* un poco más grande */
    color: #2e2e2e; /* mayor contraste */
    line-height: 1.9;
    text-align: justify;
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* Drop cap (letra capital) en pantallas grandes */
.bg-light .lead::first-letter {
    float: left;
    font-size: 2.15rem;
    line-height: 1;
    padding-right: 0.5rem;
    padding-left: 0.05rem;
    font-weight: 700;
    color: var(--primary-dark);
    font-family: "Georgia", serif;
}

@media (max-width: 768px) {
    .bg-light .lead::first-letter {
        font-size: 2rem;
        padding-right: 0.35rem;
    }
    .bg-light .card-body {
        padding: 1.25rem;
    }
}

.site-card a {
    color: var(--primary-dark);
    font-size: 0.95rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.site-card:hover a {
    color: var(--secondary-color);
}

/* Estilos para enlaces con logo de sitio */
.site-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
}

.site-logo {
    max-width: 150px;
    max-height: 130px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.site-link:focus .site-logo,
.site-link:hover .site-logo {
    transform: translateY(-6px) scale(1.03);
    filter: drop-shadow(0 6px 18px rgba(0,0,0,0.12));
}

.site-link:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(129,165,50,0.25);
}

/* Texto accesible oculto pero disponible para lectores */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Secciones principales */
.section-card {
    background: var(--light-bg);
    border: none !important;
    transition: all 0.3s ease;
}

.section-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important;
}

/* Servicios cards */
#servicios .card {
    transition: all 0.3s ease;
}

#servicios .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
}

/* Botones flotantes */
.floating-buttons {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.social-bubble button {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* ========================================
   BOTÓN VOLVER ARRIBA
   ======================================== */

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary-color, #0d6efd);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top:hover {
  background: var(--primary-dark, #0a58ca);
  transform: translateY(18px) scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:focus {
  outline: 2px solid var(--secondary-color, #ffc107);
  outline-offset: 2px;
}

/* Responsive adjustments para el botón */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
}

@media (max-width: 576px) {
  .back-to-top {
    bottom: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Footer */
footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

/* ========================================
   BURBUJA FLOTANTE REDES SOCIALES
   ======================================== */

.social-bubble {
  position: fixed;
  bottom: 100px;
  right: 30px;
  z-index: 999;
}

.social-toggle {
  width: 60px;
  height: 60px;
  background: linear-gradient(45deg, #50ab37 0%, #333d39 100%);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.social-toggle.active {
  transform: rotate(45deg);
  background: linear-gradient(45deg, #18ac2e 0%, #9bea66 100%);
}

.social-menu {
  position: absolute;
  bottom: 70px;
  right: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.social-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.social-link {
  display: block;
  width: 50px;
  height: 50px;
  margin-bottom: 10px;
  border-radius: 50%;
  text-decoration: none;
  color: white;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease forwards;
  opacity: 0;
  transform: translateX(50px);
}

.social-menu.show .social-link {
  opacity: 1;
  transform: translateX(0);
}

.social-menu.show .social-link:nth-child(1) { animation-delay: 0.1s; }
.social-menu.show .social-link:nth-child(2) { animation-delay: 0.15s; }
.social-menu.show .social-link:nth-child(3) { animation-delay: 0.2s; }
.social-menu.show .social-link:nth-child(4) { animation-delay: 0.25s; }
.social-menu.show .social-link:nth-child(5) { animation-delay: 0.3s; }

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Colores específicos para cada red social */
.social-link.facebook {
  background: #1877f2;
}

.social-link.facebook:hover {
  background: #166fe5;
  transform: scale(1.1);
}

.social-link.instagram {
  background: linear-gradient(45deg, #405de6, #5851db, #833ab4, #c13584, #e1306c, #fd1d1d);
}

.social-link.instagram:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(225, 48, 108, 0.4);
}

.social-link.tiktok {
  background: #000000;
}

.social-link.tiktok:hover {
  background: #333333;
  transform: scale(1.1);
}

.social-link.whatsapp {
  background: #25d366;
}

.social-link.whatsapp:hover {
  background: #20ba5a;
  transform: scale(1.1);
}

.social-link.youtube {
  background: #ff0000;
}

.social-link.youtube:hover {
  background: #cc0000;
  transform: scale(1.1);
}

/* Responsive adjustments para redes sociales */
@media (max-width: 768px) {
  .social-bubble {
    bottom: 80px;
    right: 20px;
  }
  
  .social-toggle {
    width: 55px;
    height: 55px;
    font-size: 1.3rem;
  }
  
  .social-link {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }
}

@media (max-width: 576px) {
  .social-bubble {
    bottom: 70px;
    right: 15px;
  }
  
  .social-toggle {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
  
  .social-link {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    margin-bottom: 8px;
  }
}

/* Animaciones adicionales */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-card {
    animation: fadeInUp 0.6s ease-out;
}

/* Mejoras de accesibilidad */
.btn:focus,
.nav-link:focus {
    box-shadow: 0 0 0 0.2rem rgba(129,165,50,0.25);
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Texto fallback si la imagen no carga */
.fallback-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary-dark);
    min-height: 60px;
    min-width: 100px;
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.fallback-text:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.site-logo[alt=""] + .fallback-text,
.site-logo[hidden] + .fallback-text {
    display: inline-flex;
}

.site-logo {
    /* si por algún motivo la imagen no carga, mantenemos el texto visible */
    min-width: 64px;
}

/* Mejoras para picture element */
picture {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Loading state para imágenes */
.site-logo {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: loading 1.4s ease-in-out infinite;
}

.site-logo[src] {
    background: none;
    animation: none;
}

@keyframes loading {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}