/*  CSS PRINCIPAL IHS - Sith  */

/*  VARIABLES CSS - ORGANIZADAS  */
:root {
    /* Colores Base */
    --color-primary: #0d6efd;
    --color-secondary: #003366;
    --color-accent: #cc0000;
    --color-dark: #333333;
    --color-light: #f0f0f0;

    /* Grises */
    --gray-light: #f0f0f0;
    --gray-medium: #e5e8e8;
    --gray-lighter: #e0e0e0;
    --gray-dark: #333;

    /* Componentes */
    --icon-color: #FF0000;
    --icon-redes: #FF0000;
    --top-contact-bg: #3C4144;
    --top-contact-text: #ffffff;
    --hover-color: #0d6efd;
    --active-color: #0B5ED7;

    /* Texto */
    --text-title: #333333;
    --text-subtitle: #0066CB;
    --text-body: #333333;

    /* Breakpoints - Bootstrap compatible */
    --bp-xs: 0;
    --bp-sm: 576px;
    --bp-md: 768px;
    --bp-lg: 992px;
    --bp-xl: 1200px;
    --bp-xxl: 1400px;
}

/*  RESET Y BASE - OPTIMIZADO  */
html {
    scroll-behavior: smooth;
    font-size: 16px; /* Base para rem */
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--gray-light);
    color: var(--text-body);
    line-height: 1.6;
    overflow-x: hidden; /* Previene scroll horizontal */
}

/*  UTILIDADES - REORGANIZADAS  */
.bg-gray { background-color: var(--gray-light); }
.bg-medium { background-color: var(--gray-medium); }
.bg-light-gray { background-color: var(--gray-lighter); }
.text-red { color: var(--color-accent); }

/*  TÍTULOS - RESPONSIVE MEJORADO  */
.titulo-contenedor {
    text-align: center;
    margin: clamp(1.5rem, 5vw, 3rem) 0 clamp(2rem, 6vw, 3.125rem);
    position: relative;
}

.subtitulo {
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    font-weight: 700;
    letter-spacing: clamp(2px, 0.3vw, 3px);
    text-transform: uppercase;
    color: var(--text-subtitle);
    margin-bottom: 0.5rem;
    display: block;
    animation: fadeInDown 0.8s ease-out;
}

.titulo-principal {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    color: var(--text-title);
    position: relative;
    padding-bottom: clamp(0.625rem, 2vw, 0.9375rem);
    margin-top: 0.75rem;
    animation: fadeInUp 0.8s ease-out 0.2s;
}

.titulo-principal::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(2.5rem, 8vw, 3.125rem);
    height: 2px;
    background: var(--color-primary);
    opacity: 0.7;
}

/*  ANIMACIONES - SIN CAMBIOS  */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/*  TEXTO Y LISTAS - OPTIMIZADO  */
p {
    font-family: 'Segoe UI', Arial, sans-serif;
    color: var(--text-body);
    margin-bottom: 0.9375rem;
    font-size: 1rem;
    font-weight: 400;
    text-align: justify;
    line-height: 1.6;
    max-width: 100ch; /* Mejor legibilidad */
}

.lista,
.lista-bullets,
.lista-ord {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.lista li,
.lista-bullets li,
.lista-ord li {
    position: relative;
    padding-left: 1.5625rem;
    margin: 0.9375rem 0;
    font-size: 1rem;
    text-align: justify;
    line-height: 1.5;
}

.lista li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.625rem;
    width: 7px;
    height: 7px;
    background-color: var(--color-primary);
    border-radius: 2px;
}

.lista-bullets li::before {
    content: "•";
    color: var(--color-primary);
    font-size: 1.5em;
    font-weight: bold;
    position: absolute;
    left: 0;
    top: -0.5rem;
}

.lista-ord {
    counter-reset: custom-counter;
}

.lista-ord li::before {
    content: counter(custom-counter) ".";
    counter-increment: custom-counter;
    font-weight: 600;
    position: absolute;
    left: 0;
    color: var(--color-primary);
}

/*  ONDAS - OPTIMIZADO PARA MÓVIL  */
.separador-ondas {
    margin: -1px 0;
    transform: rotate(180deg);
    line-height: 0; /* Elimina espacio fantasma */
}

.separador-ondas svg {
    width: 100%;
    height: auto;
    display: block;
}

.separador-ondas path {
    animation: ondaAnimada 8s ease-in-out infinite alternate;
    fill: #C6C6C6;
}

@keyframes ondaAnimada {
    0% { d: path("M0,96L60,85.3C120,75,240,53,360,53.3C480,53,600,75,720,74.7C840,75,960,53,1080,48C1200,43,1320,53,1380,58.7L1440,64L1440,0L1380,0C1320,0,1200,0,1080,0C960,0,840,0,720,0C600,0,480,0,360,0C240,0,120,0,60,0L0,0Z"); }
    100% { d: path("M0,96L60,106.7C120,117,240,139,360,139C480,139,600,117,720,106.7C840,96,960,96,1080,101.3C1200,107,1320,117,1380,122.7L1440,128L1440,0L1380,0C1320,0,1200,0,1080,0C960,0,840,0,720,0C600,0,480,0,360,0C240,0,120,0,60,0L0,0Z"); }
}

/*  MENÚ - RESPONSIVE MEJORADO  */
.navbar {
    background-color: #000 !important;
    padding: 0.75rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.logo-img {
    height: clamp(30px, 8vw, 40px);
    width: auto;
    transition: transform 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.1);
}

.nav-link {
    color: #fff !important;
    font-weight: 500;
    padding: 0.5rem 0.9375rem !important;
    margin: 0 0.3125rem;
    position: relative;
    transition: all 0.3s ease;
    display: inline-block;
}

.nav-link:hover {
    transform: translateY(-3px);
}

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

.nav-link:hover::before,
.nav-link.active::before {
    width: 100%;
}

/*  SLIDER - OPTIMIZADO  */
.carousel-fade .carousel-item {
    opacity: 0;
    transition: opacity 1.2s ease-out;
}

.carousel-fade .carousel-item.active {
    opacity: 1;
}

#slider .carousel-caption {
    background: transparent !important;
    left: 10%;
    right: auto;
    bottom: auto;
    top: 70%;
    transform: translateY(-50%);
    padding: 0;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

#slider .carousel-caption h2,
#slider .carousel-caption p {
    color: #ffffff !important;
}

#slider .carousel-caption h2 {
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
    animation: fadeInLeft 0.8s ease-out;
}

#slider .carousel-caption p {
    font-size: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 2rem;
    animation: fadeInLeft 1s ease-out;
}

#slider .carousel-caption .btn {
    animation: fadeInUp 1.2s ease-out;
    border-width: 2px;
    padding: 0.5rem 1.5rem;
}

/* SOLUCIÓN ESPECÍFICA PARA SLIDER RESPONSIVE */
.slider-img {
    width: 100%;
    height: auto;
    max-height: 800px;
    object-fit: cover;
}

@media (max-width: 992px) {
    .slider-img {
        max-height: 600px;
    }
}

@media (max-width: 768px) {
    .slider-img {
        max-height: 500px;
        object-fit: contain;
    }

    .carousel-caption {
        position: relative !important;
        top: 0 !important;
        transform: none !important;
        padding: 2rem !important;
        background: rgba(0,0,0,0.7) !important;
    }
}

@media (max-width: 576px) {
    .slider-img {
        max-height: 400px;
    }

    .servicio-item {
        height: 300px !important;
    }

    .producto-card {
        margin-bottom: 1.5rem;
    }
}

/* Forzar responsive en todas las imágenes */
img {
    max-width: 100%;
    height: auto;
}

/* Contenedores flexibles */
.servicio-img-container,
.producto-img-container {
    min-height: 200px;
}


/*  SERVICIOS - IMÁGENES RESPONSIVE FIXED  */
.servicio-item {
    position: relative;
    overflow: hidden;
    height: clamp(250px, 50vw, 600px);
    min-height: 250px;
}

.servicio-img-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.servicio-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* 🔥 SOLUCIÓN IMÁGENES RESPONSIVE - CRÍTICO */
.servicio-img,
.producto-img {
    max-width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .servicio-img,
    .producto-img {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
    }
}

.servicio-overlay {
    background: linear-gradient(135deg, rgba(100,100,100,0.7) 0%, rgba(70,70,70,0.5) 100%);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: all 0.5s ease;
    opacity: 0;
}

.servicio-texto {
    position: absolute;
    bottom: 0;
    left: 0;
    padding: clamp(0.9375rem, 3vw, 1.875rem);
    color: white;
    background-color: var(--color-secondary);
    width: 100%;
    transform: translateY(20px);
    transition: all 0.5s ease;
    opacity: 0;
}

.servicio-texto h3 {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    font-size: clamp(1rem, 3vw, 1.5rem);
}

.servicio-texto p {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-weight: 500;
    color: var(--gray-light);
    font-size: clamp(0.8rem, 2vw, 1rem);
}

/* Hover effects */
.servicio-item:hover .servicio-overlay {
    opacity: 1;
}

.servicio-item:hover .servicio-texto {
    transform: translateY(0);
    opacity: 1;
}

.servicio-item:hover .servicio-img {
    transform: scale(1.05);
}

/*  PRODUCTOS - RESPONSIVE FIXED  */
.producto-card {
    position: relative;
    overflow: hidden;
    border-radius: 3px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.producto-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.producto-img-container {
    position: relative;
    overflow: hidden;
    flex-grow: 1;
    min-height: 200px;
}

.producto-img {
    width: 100%;
    height: clamp(180px, 40vw, 350px);
    object-fit: cover;
    transition: transform 0.5s ease;
}

.producto-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(100, 100, 100, 0.3);
    transition: all 0.5s ease;
    opacity: 0;
}

.producto-info {
    padding: clamp(0.75rem, 2vw, 1.25rem);
    background: white;
    flex-shrink: 0;
}

.producto-titulo {
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 700;
    margin-bottom: 0.3125rem;
    color: var(--text-title);
}

.producto-subtitulo {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    color: var(--text-subtitle);
    margin-bottom: 0;
}

/* Hover effects */
.producto-link:hover .producto-overlay {
    opacity: 1;
    background-color: rgba(100, 100, 100, 0.7);
}

.producto-link:hover .producto-img {
    transform: scale(1.05);
}

.producto-link:hover .producto-card {
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    transform: translateY(-5px);
}

/*  CONTACTO - OPTIMIZADO  */
.contacto {
    color: #000;
}

.contacto-info p {
    margin-bottom: 0.9375rem;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
}

/* Iconos de contacto */
.fa-whatsapp { color: #25D366; font-size: 1.4em; }
.fa-phone { color: #007bff; font-size: 1.1em; }
.fa-envelope { color: #D44638; font-size: 1.1em; }
.fa-map-marker-alt { color: var(--color-accent); font-size: 1.4em; }
.fa-clock { color: #ffc107; font-size: 1.1em; }

.fa-whatsapp:hover,
.fa-phone:hover,
.fa-envelope:hover,
.fa-map-marker-alt:hover,
.fa-clock:hover {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

/*  FOOTER - RESPONSIVE MEJORADO  */
.footer {
    background: #333;
    color: white;
    position: relative;
}

.footer-title {
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #fff;
    position: relative;
    padding-bottom: 0.625rem;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 3.125rem;
    height: 2px;
    background: var(--color-primary);
}

.footer-text,
.footer-links {
    color: #e0e0e0;
    text-align: justify;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.625rem;
}

.footer-links a {
    color: #e0e0e0;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--color-primary);
    padding-left: 0.3125rem;
}

/* Iconos sociales */
.social-icons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.social-icon {
    width: clamp(32px, 8vw, 40px);
    height: clamp(32px, 8vw, 40px);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    font-size: clamp(1rem, 3vw, 1.2rem);
    transition: all 0.3s ease;
    text-decoration: none;
}

/* Colores sociales */
.facebook { background-color: #1877F2; }
.instagram { background-color: #E1306C; }
.linkedin { background-color: #0B66C3; }
.twitter { background-color: #1DA1F2; }
.youtube { background-color: #FF0000; }
.threads { background-color: #000000; }

.social-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Miniaturas de productos */
.product-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.625rem;
}

.product-thumb {
    width: 100%;
    height: clamp(60px, 15vw, 80px);
    object-fit: cover;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: block;
}

.product-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.copyright-bar {
    background-color: #1a1a1a;
    color: #aaa;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
}

.copyright-bar p {
    color: #fff;
    margin: 0;
}

.copyright-bar a {
    color: #ddd;
    text-decoration: none;
    transition: color 0.3s ease;
}

.copyright-bar a:hover {
    color: var(--color-primary);
}

/*  BOTONES SCROLL - MEJORADOS  */
.scroll-to-top {
    position:  fixed;
    bottom: clamp(1.25rem, 5vw, 1.875rem);
    right: clamp(1.25rem, 5vw, 1.875rem);
    width: clamp(2.5rem, 8vw, 3.125rem);
    height: clamp(2.5rem, 8vw, 3.125rem);
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background: #34495e;
    transform: translateY(-3px);
}

.back-button-container {
    text-align: right;
    margin: 1.25rem 0;
    transition: opacity 0.5s;
}

.back-button {
    background: #2c3e50;
    color: white;
    border: none;
    padding: clamp(0.5rem, 2vw, 0.625rem) clamp(1rem, 3vw, 1.25rem);
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(0.8rem, 2vw, 0.875rem);
    font-weight: 500;
    transition: background 0.3s, transform 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.back-button:hover {
    background: #34495e;
    transform: translateY(-3px);
}

/*  MEDIA QUERIES - ESTRATÉGICAS  */
@media (max-width: 992px) {
    .navbar-collapse {
        background-color: #111;
        padding: 0.9375rem;
        margin-top: 0.625rem;
        border-radius: 5px;
    }

    .nav-link {
        margin: 0.5rem 0;
        padding: 0.625rem !important;
    }

    .servicio-item {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    /* Asegura que todo el contenido se ajuste */
    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Mejora espaciados */
    section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    /* Ajuste de imágenes críticas */
    .servicio-img,
    .producto-img {
        object-fit: contain !important;
        max-height: 300px !important;
    }

    /* Centrado de contenido */
    .text-md-start,
    .text-md-end {
        text-align: center !important;
    }

    /* Footer en móviles */
    .footer .col-md-4,
    .footer .col-lg-3 {
        margin-bottom: 2rem;
    }

    .product-thumbnails {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 576px) {
    /* Optimización para móviles pequeños */
    body {
        font-size: 14px;
    }

    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        font-size: 1rem;
    }

    .logo-img {
        height: 30px;
    }

    .servicio-item,
    .producto-card {
        margin-bottom: 1.5rem;
    }

    .social-icons {
        justify-content: center;
    }

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

    .scroll-to-top {
        bottom: 1rem;
        right: 1rem;
    }
}

/*  MEJORAS DE PERFORMANCE  */
/* Prevents CLS (Cumulative Layout Shift) */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Smooth transitions */
* {
    transition-duration: 0.3s;
}

/* Reduce motion para accesibilidad */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/*  FIN CSS OPTIMIZADO  */