/* Importar variables del sistema de diseño */
@import url('./variables.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ========================================
   ESTILOS GLOBALES
   ======================================== */
* {
    font-family: var(--font-family-primary);
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    color: var(--color-text-primary);
    line-height: 1.6;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero-section {
    position: relative;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 500px;
    z-index: 0 !important;
}

/* Fondos del hero con barco (index) */
.hero-boat-cover {
    background-image: url('../img/fondohersection.jpg');
    background-size: cover;
    background-position: right 20% center;
    background-repeat: no-repeat;
    filter: blur(0) saturate(1.05) brightness(0.95);
    opacity: 0.24;
    mix-blend-mode: normal;
    z-index: 0 !important;
    pointer-events: none;
}

.hero-boat-tiles {
    background-image: url('../img/fondohersection.jpg');
    background-repeat: repeat;
    background-size: 160px auto;
    background-position: top left;
    opacity: 0.06;
    filter: blur(0.3px);
    mix-blend-mode: overlay;
    z-index: 0 !important;
    pointer-events: none;
}

/* Garantizar que las capas de fondo queden detrás del contenido del hero */
section#inicio > .hero-boat-cover,
section#inicio > .hero-boat-tiles {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 0 !important;
}

/* Overlay oscuro */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1 !important;
    pointer-events: none;
}

/* Contenido por encima del overlay */
.hero-section .container {
    position: relative;
    z-index: 10 !important;
}

.hero-section * {
    position: relative;
    z-index: 10 !important;
}

/* ========================================
   NAVEGACIÓN
   ======================================== */
.nav-link {
    position: relative;
    transition: color var(--transition-base);
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
}

.nav-link:hover {
    color: var(--color-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--color-primary);
    transition: width var(--transition-base);
}

.nav-link:hover::after {
    width: 100%;
}

/* ========================================
   SERVICE CARDS
   ======================================== */
.service-card {
    background: var(--color-background);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* ========================================
   MODERN SERVICE CARDS (Estilo de imagen)
   ======================================== */
.service-card-modern {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    min-width: 320px;
    max-width: 340px;
    margin-right: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.service-card-modern:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.service-image-container {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
}

.service-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card-modern:hover .service-image {
    transform: scale(1.1);
}

.service-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.service-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 16px;
    line-height: 1.3;
}

.service-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    flex: 1;
}

.service-list li {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.service-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #6b7280;
    font-weight: bold;
}

.service-link-modern {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    padding-bottom: 8px;
    border-bottom: 2px solid #3b82f6;
    width: fit-content;
    transition: all 0.3s ease;
    position: relative;
}

.service-link-modern:hover {
    color: #1f2937;
    gap: 16px;
}

.service-link-modern span {
    transition: transform 0.3s ease;
}

.service-card-modern:hover .service-link-modern span {
    transform: translateX(-4px);
}

.arrow-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    transition: all 0.4s ease;
    flex-shrink: 0;
}

.service-card-modern:hover .arrow-circle {
    background: #3b82f6;
    transform: rotate(45deg) scale(1.1);
}

.service-card-modern:hover .arrow-circle i {
    transform: rotate(-45deg);
}

.arrow-circle i {
    transition: transform 0.4s ease;
}

/* Animación de entrada */
@keyframes slideInCard {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.service-card-modern {
    animation: slideInCard 0.6s ease-out;
}

/* Staggered animation delay */
.service-card-modern:nth-child(1) { animation-delay: 0.1s; }
.service-card-modern:nth-child(2) { animation-delay: 0.2s; }
.service-card-modern:nth-child(3) { animation-delay: 0.3s; }
.service-card-modern:nth-child(4) { animation-delay: 0.4s; }

/* ========================================
   BOTONES
   ======================================== */
.btn-primary {
    background-color: var(--color-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    border: none;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ========================================
   NUMBER BADGE
   ======================================== */
.number-badge {
    font-size: 2.5rem;
    font-weight: var(--font-weight-extrabold);
    color: var(--color-primary);
    line-height: 1;
}

/* ========================================
   CAROUSEL
   ======================================== */
.carousel-container {
    overflow: hidden;
    position: relative;
}

.carousel-track {
    display: flex;
    transition: transform var(--transition-slow);
}

/* ========================================
   ICON BOX
   ======================================== */
.icon-box {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-lg);
    background-color: rgb(255, 255, 255);
    color: var(--color-primary);
    font-size: 1.5rem;
    transition: transform var(--transition-base), background-color var(--transition-base);
}

.icon-box:hover {
    transform: scale(1.1);
    background-color: rgb(255, 255, 255);
}

/* ========================================
   HEADER STICKY EFFECT
   ======================================== */
header {
    transition: box-shadow var(--transition-base);
}

header.scrolled {
    box-shadow: var(--shadow-lg);
}

/* ========================================
   FORM INPUTS
   ======================================== */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(27, 79, 140, 0.1);
}

input,
textarea,
select {
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem;
    font-family: var(--font-family-primary);
}

/* ========================================
   CAROUSEL CONTROLS
   ======================================== */
#prevBtn,
#nextBtn {
    background-color: var(--color-background);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-full);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    z-index: var(--z-dropdown);
    color: var(--color-primary);
    font-weight: var(--font-weight-bold);
}

#prevBtn:hover,
#nextBtn:hover {
    background-color: var(--color-primary);
    color: white;
    transform: scale(1.1);
    border-color: var(--color-primary);
}

#prevBtn:active,
#nextBtn:active {
    transform: scale(0.95);
}

#prevBtn:disabled,
#nextBtn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background-color: var(--color-background-gray);
}

#prevBtn:disabled:hover,
#nextBtn:disabled:hover {
    transform: scale(1);
    background-color: var(--color-background-gray);
}

/* ========================================
   ANIMACIONES
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* NO aplicar fade-in-up al hero */
.hero-section.fade-in-up {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* ========================================
   IMÁGENES
   ======================================== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   FOOTER LINKS
   ======================================== */
footer a {
    transition: color var(--transition-base);
}

footer a:hover {
    color: var(--color-primary-light);
}

/* ========================================
   ACCESIBILIDAD
   ======================================== */
button:focus,
a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .hero-section {
        min-height: 400px;
        background-attachment: scroll;
    }
    /* Ajustar tamaño del patrón en móviles para que no quede ni muy grande ni muy pequeño */
    .hero-boat-tiles {
        background-size: 120px auto;
        opacity: 0.08;
    }
    
    .number-badge {
        font-size: 2rem;
    }
    
    #prevBtn,
    #nextBtn {
        width: 40px;
        height: 40px;
        font-size: 0.875rem;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    header,
    footer,
    .carousel-container button,
    #prevBtn,
    #nextBtn {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
}
/* ========================================
   FIX DEFINITIVO PARA OVERLAY Y SLIDER
   Agregar al FINAL de index.css
   ======================================== */

/* Forzar z-index del hero y su contenido */
section#inicio,
section.hero-section {
    isolation: isolate !important;
    z-index: 1 !important;
}

/* El overlay debe estar DETRÁS del contenido */
section#inicio::before,
section.hero-section::before {
    z-index: 1 !important;
}

/* TODO el contenido del hero debe estar ENCIMA */
section#inicio > *,
section.hero-section > *,
section#inicio .container,
section.hero-section .container,
section#inicio .container *,
section.hero-section .container * {
    position: relative !important;
    z-index: 100 !important;
}

/* La sección de servicios debe estar COMPLETAMENTE separada */
section#servicios {
    position: relative !important;
    z-index: 10 !important;
    isolation: isolate !important;
}

/* Forzar que NINGUNA otra sección se superponga al hero */
section#inicio ~ section,
section.hero-section ~ section {
    position: relative !important;
    z-index: 10 !important;
}

/* Si hay algún elemento position:fixed o absolute rogue */
body > *:not(header):not(section#inicio):not(footer) {
    position: relative !important;
}

/* Prevenir cualquier elemento flotante que se superponga */
* {
    isolation: auto;
}

section {
    isolation: isolate;
}

/* CRÍTICO: Asegurar que no haya elementos con z-index muy alto */
.service-card,
.carousel-container,
#servicesCarousel,
#carouselTrack,
.carousel-track {
    z-index: auto !important;
}

/* Los botones del carousel también */
#prevBtn,
#nextBtn {
    z-index: 50 !important;
}

/* Eliminar cualquier transform que esté causando stacking context */
section#inicio {
    transform: none !important;
}

section#inicio .container {
    transform: none !important;
}

/* ========================================
   BOTONES DE CONTACTO CON ANIMACIONES
   ======================================== */
.contact-feature-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.contact-feature-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.contact-feature-btn:hover::before {
    left: 100%;
}

.contact-feature-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.contact-feature-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.contact-feature-icon {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.contact-feature-btn:hover .contact-feature-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.5);
}

.contact-feature-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.contact-feature-content p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    text-align: left;
}

.contact-feature-content i.fa-arrow-right {
    transition: all 0.3s ease;
}

.contact-feature-btn:hover .contact-feature-content i.fa-arrow-right {
    transform: translateX(4px);
}

/* Animación de pulso para los iconos */
@keyframes pulse-icon {
    0%, 100% {
        box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6);
    }
}

.contact-feature-btn:hover .contact-feature-icon {
    animation: pulse-icon 2s infinite;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .contact-feature-btn {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .contact-feature-icon {
        width: 45px;
        height: 45px;
    }
    
    .contact-feature-content p {
        font-size: 0.8rem;
    }
}

/* Drawer lateral para móvil: menú deslizante con overlay */
@media (max-width: 768px) {
    /* Contenedor del nav: drawer fijo a la izquierda, inicialmente oculto por transform */
    #mainNav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        width: 280px !important;
        max-width: 80% !important;
        transform: translateX(-100%) !important;
        transition: transform 0.28s ease-in-out !important;
        background: #ffffff !important;
        box-shadow: 2px 0 18px rgba(2,6,23,0.12) !important;
        z-index: 60 !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 1.5rem 1rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Clase que activa el drawer (aplicada por JS) */
    #mainNav.open {
        transform: translateX(0) !important;
    }

    /* Enlaces del nav: línea completa, texto alineado a la izquierda con buen padding táctil */
    #mainNav .nav-link {
        display: block !important;
        text-align: left !important;
        padding: 0.875rem 0.5rem !important;
        width: 100% !important;
        color: var(--color-text-primary) !important;
        font-weight: 500 !important;
        font-size: 1rem !important;
        border-radius: 6px !important;
        transition: background-color 0.15s ease !important;
    }

    /* Hover en enlaces del drawer */
    #mainNav .nav-link:hover {
        background-color: rgba(59, 130, 246, 0.08) !important;
    }

    /* Primer enlace del nav: añadir margen superior para separarlo del borde */
    #mainNav .nav-link:first-child {
        margin-top: 0.5rem !important;
    }

    /* Si el HTML añade utilidades tipo space-y-4, normalizar margen interno */
    #mainNav.space-y-4 > *,
    #mainNav .space-y-4 > * {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    /* Eliminar márgenes entre enlaces para que el espaciado sea uniforme */
    #mainNav > a {
        margin: 0 !important;
    }

    /* Overlay oscuro que aparece detrás del drawer (creado por JS) */
    #mobileOverlay {
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0,0,0,0.45) !important;
        z-index: 50 !important;
        opacity: 0 !important;
        transition: opacity 0.2s ease !important;
        pointer-events: none !important;
    }

    #mobileOverlay.show {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Botón de cerrar dentro del drawer (si se añade) */
    .mobile-close-btn {
        position: absolute !important;
        top: 12px !important;
        right: 12px !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 9999px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #ffffff !important;
        border: 1px solid rgba(0,0,0,0.06) !important;
        box-shadow: 0 6px 18px rgba(2,6,23,0.08) !important;
        cursor: pointer !important;
        z-index: 70 !important;
    }

    /* Ajustes para que el header no empuje el contenido al abrir el drawer */
    header {
        position: relative !important;
        z-index: 70 !important; /* mantener header por encima si se desea */
    }
}