/**
 * ESTILOS PARA RAFAEL SOLUCIONES ELECTRÓNICAS (RSE)
 * ----------------------------------------------
 * Hoja de estilos principal para el sitio web de RSE.
 * Contiene estilos personalizados para todas las secciones principales.
 * Organizado por componentes y con adaptación responsive.
 * 
 * @version: 1.0.0
 * @lastUpdate: 2023-08
 */

/* =============================================================================
   1. ESTILOS BÁSICOS Y TIPOGRAFÍA
   ============================================================================= */

/* Tipografía principal para elementos de UI */
body, .navbar, .footer-label, .card-title, .card-text, .accordion-button, 
.accordion-body, .form-label, .btn, .lead, h1, h2, h3, h4, h5, h6, 
p, ul, li, .modal-title {
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif !important;
}

/* Tipografía secundaria para textos estilizados */
.fst-italic, .lead, .card-text.fst-italic, .text-muted, 
.modal-body p, .faq .accordion-body {
    font-family: 'Lora', 'Georgia', serif !important;
}

/* Estructura básica y ajustes generales */
body {
    padding-top: 56px; /* Ajuste para el navbar fijo */
    overflow-x: hidden; /* Previene el desplazamiento horizontal */
}

/* Evitar el desbordamiento horizontal */
body {
    overflow-x: hidden;
}


/* Solución para elementos que causan desbordamiento */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Asegurar que las filas no excedan el ancho */
.row {
    margin-left: 0;
    margin-right: 0;
}


/* Prevenir scroll horizontal en toda la página */
body {
    overflow-x: hidden;
}

/* Evitar que se desborden elementos en tarjetas SOLO en móviles */
@media (max-width: 768px) {
    .card {
        max-width: 100%;
        overflow: hidden;
    }
}


/* Alineación de texto justificada */
.text-justify {
    text-align: justify;
}

/* =============================================================================
   2. COLORES Y FONDO
   ============================================================================= */

/* Colores principales */
.bg-primary {
    background-color: #566270 !important;
}

.bg-dark {
    background-color: #343a40 !important;
}

/* =============================================================================
   3. NAVEGACIÓN (NAVBAR)
   ============================================================================= */



/* =============================================================================
   4. ENCABEZADO (HEADER)
   ============================================================================= */

/* Estructura principal del encabezado */
#inicio {
    position: relative;
    background-size: cover;
    background-position: center;
    color: white;
    text-align: center;
    padding: 5rem 0;
    scroll-margin-top: 70px;
}

/* Estilos para el texto del encabezado */
#inicio h5 {
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: bold;
}

#inicio p {
    font-style: italic;
    max-width: 700px;
    margin: 0 auto;
    color: #f8f9fa;
}

/* Capa de superposición para mejorar legibilidad del texto */
#inicio::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Posicionamiento del contenido sobre la capa */
#inicio .container {
    position: relative;
    z-index: 2;
}

/* =============================================================================
   5. SECCIÓN DE SERVICIOS
   ============================================================================= */

/* Estructura base de la sección */
#servicios {
    background-color: #343a40;
    padding: 2rem 0;
}

/* Título de la sección */
#servicios h2 {
    color: #f8f9fa;
    margin-bottom: 3rem;
    text-align: center;
}

/* Configuración del carrusel */
#servicios-carousel {
    color: #000;
    display: flex;
    gap: 2rem; /* Espaciado entre tarjetas */
    overflow-x: auto; /* Permite el desplazamiento horizontal */
    scroll-behavior: smooth; /* Desplazamiento suave */
    padding-left: 1rem;
    padding-right: 1rem;
    scroll-padding-left: 1rem;
    scroll-padding-right: 0.5rem;
    overflow-x: auto;
}

/* Ocultar barra de desplazamiento */
#servicios-carousel::-webkit-scrollbar {
    display: none;
}

/* Estilos para tarjetas de servicios */
#servicios-carousel .card {
    margin: 0 0.3rem;
    flex-shrink: 0;
    width: 400px;
    width: 300px;
    flex-shrink: 0;
    transform: scale(1.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#servicios-carousel .card img {
    max-height: 200px;
    object-fit: cover;
}

/* Efecto hover en tarjetas */
#servicios-carousel .card:hover {
    transform: scale(1.0);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Estado al arrastrar el carrusel */
#servicios-carousel.dragging {
    cursor: grabbing;
    user-select: none;
}

/* Navegación del carrusel */
#btn-left, #btn-right {
    width: 50px;
    height: 50px;
    border-radius: 30%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: #eff1f4;
    border: none;
    color: #2a2f33;
    font-size: 1.5rem;
    cursor: pointer;
}

#btn-left:hover, #btn-right:hover {
    background-color: #485e74;
}

/* Ajustar el contenedor del título y los botones */
#servicios .d-flex {
    gap: 1rem;
}

/* Configuración específica del carrusel */
#servicios-carousel > .col-md-4 {
    margin-left: 0;
    margin-right: 0;
}

/* Estilo para imágenes en modales */
.img-modal {
    width: 100%;
    height: auto;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

/* Efectos específicos para tarjetas */
.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2) !important;
}

/* Estilos para los filtros de servicios */
.service-filter.active {
    background-color: #0dcaf0;
    color: #fff;
    border-color: #0dcaf0;
}

/* Estilos para la paginación */
.pagination-dot {
    display: inline-block;
    margin: 0 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.pagination-dot:hover {
    transform: scale(1.2);
}

/* Estilos para las etiquetas de servicios */
.service-badge {
    position: relative;
    z-index: 1;
    margin-top: -30px;
}

/* =============================================================================
   6. GALERÍA DE TRABAJOS
   ============================================================================= */

/* Tarjetas para la galería */
.card-pequena {
    width: 26rem;
    min-height: 26rem;
    margin-left: auto;
    margin-right: auto;
}

/* Transición para tarjetas normales (no flip) */
.card:not(.flip-card-front):not(.flip-card-back) {
    transition: transform 0.3s;
}

/* Efecto hover solo para tarjetas normales */
.card:not(.flip-card-front):not(.flip-card-back):hover {
    transform: scale(1.05);
}

/* Garantizar que las tarjetas flip NO tengan transformación en hover */
.flip-card .card {
    transform: none;
}

.flip-card .card:hover {
    transform: none !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* =============================================================================
   7. SECCIÓN DE CONTACTO
   ============================================================================= */

/* Estructura básica */
#contacto {
    padding: 60px 0;
}

/* Estilos del título */
#contacto h2 {
    color: #007bff;
    margin-bottom: 30px;
}

/* Campos del formulario */
#contacto .form-control {
    border-radius: 5px;
    border: 1px solid #ddd;
    padding: 10px;
}

/* Botón de envío */
#contacto .btn-primary {
    background-color: #007bff;
    border: none;
    padding: 10px 20px;
    font-size: 1.1rem;
}

#contacto .btn-primary:hover {
    background-color: #0056b3;
}

/* Enlaces de redes sociales */
#contacto .social-media a {
    text-decoration: none;
    transition: color 0.3s ease;
}

#contacto .social-media a:hover {
    color: #007bff !important;
}

/* Texto descriptivo */
#contacto .lead {
    font-size: 1.25rem;
    color: #333;
}

/* Espaciado adicional entre íconos de redes sociales */
.social-media a {
    margin-bottom: 10px;
    display: inline-block;
}

/* =============================================================================
   8. FOOTER
   ============================================================================= */

/* Estilo principal */
footer {
    background-color: #343a40;
    color: white;
}

/* Etiquetas del footer */
.footer-label {
    display: none;
    margin-left: 6px;
    vertical-align: middle;
    transition: opacity 0.2s;
}

.footer-icon:hover .footer-label,
.footer-icon:focus .footer-label {
    display: inline;
    opacity: 1;
}

.footer-icon i {
    font-size: 1.3rem;
    vertical-align: middle;
}

/* =============================================================================
   9. COMPONENTES Y UTILIDADES
   ============================================================================= */

/* Cursor para elementos con popover */
[data-bs-toggle="popover"] {
    cursor: help;
}

/* Estilo para el toast de notificación */
.toast {
    background-color: #46d467;
    color: white;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.toast-header {
    background-color: #218838;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-body {
    padding: 1rem;
}

/* Estilo para el popover */
.popover {
    background-color: #f8f9fa; /* Fondo claro */
    border: 1px solid #dee2e6; /* Borde sutil */
    border-radius: 0.5rem; /* Bordes redondeados */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Sombra */
    max-width: 300px; /* Ancho máximo */
}

.popover-header  {
    background-color: #0d6efd; /* Fondo azul */
    color: #fff; /* Texto blanco */
    font-weight: bold;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.5rem 0.5rem 0 0;
    font-size: 1rem;
    text-align: center;
}

.popover-body {
    color: #212529; /* Texto oscuro */
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 1rem; /* Espaciado interno */
}

/* =============================================================================
   10. MEDIA QUERIES - DISEÑO RESPONSIVE
   ============================================================================= */

/* PANTALLAS EXTRA PEQUEÑAS (móviles) */
@media (max-width: 500px) {
    /* Ajustes específicos del header */
    #inicio {
        padding-top: 54px;
    }
    
    #inicio h3 {
        font-size: 1.1rem;
    }
    
    #inicio p {
        font-size: 1rem;
    }
    
    #inicio .btn {
        font-size: 0.9rem;
        padding: 0.3rem 1rem;
    }
}

/* PANTALLAS PEQUEÑAS (hasta 576px) */
@media (max-width: 576px) {
    /* Ajustar el tamaño del logo */
    .navbar-brand img {
        width: 100px;
        height: auto;
    }
    
    /* Centrar el contenido del footer */
    footer .text-md-start, 
    footer .text-md-end {
        text-align: center !important;
    }
    
    /* Carrusel: una tarjeta por vista */
    #servicios-carousel > .col-12,
    #servicios-carousel > .col-sm-6,
    #servicios-carousel > .col-md-6,
    #servicios-carousel > .col-lg-3 {
        min-width: 100vw !important;
        max-width: 100vw !important;
        flex: 0 0 100vw !important;
    }
    
    #servicios-carousel {
        scroll-snap-type: x mandatory;
    }
    
    #servicios-carousel > div {
        scroll-snap-align: start;
    }
}

/* PANTALLAS MEDIANAS (hasta 775.98px) */
@media (max-width: 775.98px) {
    .card-pequena {
        width: 100%;
    }
}

/* PANTALLAS GRANDES (hasta 1000px) */
@media (max-width: 1000px) {
    #servicios-carousel {
        width: 100%;
        gap: 1rem;
    }
    
    #servicios-carousel .card {
        width: 90vw;
        max-width: 300px;
    }
}

/* CONFIGURACIÓN RESPONSIVA DEL CARRUSEL DE SERVICIOS */
#servicios-carousel .col-12 {
    min-width: 100%;
}

@media (min-width: 576px) {
    #servicios-carousel .col-sm-6 {
        min-width: 50%;
    }
}

@media (min-width: 992px) {
    #servicios-carousel .col-lg-4 {
        min-width: 33.3333%;
    }
}

/* ===== Fix overflow horizontal en móviles ===== */

/* Quitar ancho fijo en tarjetas del carrusel */
#servicios-carousel .card {
    width: 100%;
    max-width: 300px;
}

/* Evitar que paddings + gaps sumen scroll extra */
#servicios-carousel {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    gap: 1rem; /* mantener espacio entre tarjetas */
}

/* Seguridad extra */
html, body {
    overflow-x: hidden !important;
}


/* En móviles: 1 tarjeta por fila */
@media (max-width: 767px) {
  #servicios-carousel > .col-12,
  #servicios-carousel > .col-sm-6,
  #servicios-carousel > .col-md-6,
  #servicios-carousel > .col-lg-3 {
      min-width: 100% !important;
      max-width: 100% !important;
      flex: 0 0 100% !important;
  }
}

/* En tablets: 2 tarjetas por fila */
@media (min-width: 768px) and (max-width: 991px) {
  #servicios-carousel > div[class*="col-"] {
      min-width: 50% !important;
      max-width: 50% !important;
      flex: 0 0 50% !important;
  }
}

/* En escritorio: 3 o 4 tarjetas por fila */
@media (min-width: 992px) {
  #servicios-carousel > div[class*="col-"] {
      min-width: 25% !important;
      max-width: 25% !important;
      flex: 0 0 25% !important;
  }
}

/*  TODAS LAS REGLAS DEL HAMBURGER  */
@media (max-width: 991.98px) {
    .custom-toggler {
        display: flex;
        width: 48px;
        height: 48px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: transparent;
        position: relative;
        z-index: 1100;
    }

    .toggler-bar {
        display: block;
        width: 28px;
        height: 4px;
        margin: 4px 0;
        background: #fff;
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(.4,2,.6,1);
        position: relative;
    }

    /* Estado abierto (cuando el menú está expandido) */
    .custom-toggler[aria-expanded="true"] .toggler-bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .custom-toggler[aria-expanded="true"] .toggler-bar:nth-child(2) {
        opacity: 0;
    }
    .custom-toggler[aria-expanded="true"] .toggler-bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}


/* Visibilidad del menú en escritorio */
@media (min-width: 992px) {
    /* Esto hace que los ítems del menú sean SIEMPRE visibles en escritorio */
    .menu-fade, 
    .navbar-collapse .menu-fade {
        opacity: 1 !important;
        transform: translateY(0) !important;
        transition: none !important; /* Elimina la transición en escritorio */
    }
    
    /* Forzar la visualización del menú en escritorio */
    .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
    
    /* Asegurar que los elementos del navbar se muestren correctamente */
    .navbar-nav {
        display: flex !important;
        flex-direction: row;
    }
}

/* Efecto de cascada en los ítems del menú - SOLO EN MÓVIL */
@media (max-width: 991.98px) {
    .menu-fade {
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.5s cubic-bezier(.4,2,.6,1), transform 0.5s cubic-bezier(.4,2,.6,1);
    }

    .show .menu-fade {
        opacity: 1;
        transform: translateY(0);
    }

    /* Cascada: cada ítem con un pequeño delay */
    .menu-fade:nth-child(1) { transition-delay: 0.1s; }
    .menu-fade:nth-child(2) { transition-delay: 0.2s; }
    .menu-fade:nth-child(3) { transition-delay: 0.3s; }
    .menu-fade:nth-child(4) { transition-delay: 0.4s; }
    .menu-fade:nth-child(5) { transition-delay: 0.5s; }
    .menu-fade:nth-child(6) { transition-delay: 0.6s; }
}

/* Ajustar scroll para que las secciones no queden debajo del navbar */
section[id],
div[id="inicio"],
div[id="servicios"],
div[id="nosotros"],
div[id="proyectos"],
div[id="blog"],
div[id="contacto"] {
    scroll-margin-top: 80px; /* Ajusta esto según la altura de tu navbar */
}







