/* General Layout & Base Styles */
body {
    font-family: Arial, sans-serif; /* Example font */
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
}

/* Header Adjustments for Announcement Banner */
header {
    /* Top will be set by JS */
    position: fixed; /* Ensure it stays fixed */
    width: 100%;
    z-index: 40;
    height: auto; /* Let content define height normally */
    transition: top 0.3s ease; /* Only top needs JS control */
}

main {
    /* Padding-top will be set by JS */
    transition: padding-top 0.3s ease; /* Animate padding changes */
}

/* Announcement banner adjustments for close button */
#announcement-banner button {
    cursor: pointer;
}

/* Hero Section / Slider */
#hero-slider {
    width: 100%;
    height: 70vh; /* Default height for desktop */
    min-height: 350px; /* Minimum height */
    max-height: 700px; /* Maximum height */
    position: relative;
    overflow: hidden;
    background-color: #f0f0f0; /* Placeholder background */
}

.slider-container {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.slide {
    min-width: 100%; /* Each slide takes full width */
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    justify-content: center;
    text-align: center;
    color: white;
    
    /* Default: center alignment for desktop */
    align-items: center;
}

.slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.2) 100%);
    z-index: 1;
    transition: background 0.5s ease-in-out; /* Add transition for smoothness */
}

.slide-overlay-transparent {
    background: transparent !important; /* Force transparent background */
}

.slide-content {
    position: relative;
    z-index: 2;
    padding: 1rem;
    max-width: 800px;
}

.slide-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    opacity: 0; /* Hidden initially for animation */
    transform: translateY(15px); /* Offset for animation */
    transition: opacity 0.6s ease 0.2s, transform 0.6s ease 0.2s;
}

.slide-subtitle {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease 0.4s, transform 0.6s ease 0.4s;
}

.slide-description {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease 0.6s, transform 0.6s ease 0.6s;
}

.slide-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #2563eb;
    color: white;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease, opacity 0.6s ease 0.8s, transform 0.6s ease 0.8s;
    opacity: 0;
    transform: translateY(15px);
}

/* Animation classes for slide content */
.slide-content.animate .slide-title,
.slide-content.animate .slide-subtitle,
.slide-content.animate .slide-description,
.slide-content.animate .slide-button {
    opacity: 1;
    transform: translateY(0);
}

.slide-button:hover {
    background-color: #1d4ed8;
}

/* Slider Navigation Arrows */
#prev-slide, #next-slide {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background-color 0.3s ease; /* Keep transition for hover effect */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#prev-slide:hover, #next-slide:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

/* Slider Dots */
#slider-dots {
    z-index: 2;
}

.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-dot.active {
    background-color: white;
    width: 12px;
    height: 12px;
}

.slider-dot:hover {
    background-color: rgba(255, 255, 255, 0.8);
}

/* Loading Bar for navigation */
#loading-bar {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    transition: width 0.4s ease-out;
}

/* Responsive adjustments for Hero Slider */
@media (max-width: 768px) {
    #hero-slider {
        height: 50vh; /* Shorter height for mobile */
        min-height: 250px;
    }

    .slide {
        /* On mobile, align content to the top */
        align-items: flex-start;
        /* Reduce padding-top since main now has proper padding */
        padding-top: 1.5rem;
        padding-bottom: 1.5rem; /* Ensure some bottom padding too */
    }
    
    .slide-title {
        font-size: 1.8rem;
    }

    .slide-subtitle {
        font-size: 1.2rem;
    }

    .slide-description {
        font-size: 0.8rem;
    }

    .slide-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    #prev-slide, #next-slide {
        padding: 0.5rem;
        font-size: 1.2rem;
    }
    
    #slider-dots {
        bottom: 1rem;
    }
}

@media (max-width: 640px) {
    .slide-title {
        font-size: 1.5rem;
    }
    .slide-subtitle {
        font-size: 1rem;
    }
    .slide-description {
        font-size: 0.8rem;
    }
}

/* New: Collapsed Header state (desktop only) */
@media (min-width: 768px) {
    header {
        transition: top 0.3s ease, height 0.3s ease; /* Add height to transition */
    }

    header.header-collapsed {
        height: var(--top-bar-height, 80px); /* Use CSS custom property, with fallback */
    }

    header.header-collapsed:hover {
        height: var(--full-header-height, 120px); /* Use CSS custom property, with fallback */
    }
    
    header.header-collapsed #desktop-nav {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    header.header-collapsed:hover #desktop-nav {
        opacity: 1;
        pointer-events: auto;
    }

    /* Main padding based on header state */
    body[data-header-state="banner-visible"] main {
        padding-top: var(--initial-main-padding-top); /* Full height including banner */
    }
    body[data-header-state="banner-hidden"] main {
        padding-top: var(--full-header-height); /* Full height without banner */
    }
    body[data-header-state="collapsed"] main {
        padding-top: var(--top-bar-height); /* Collapsed height */
    }
}

/* Mobile-specific main padding */
@media (max-width: 767px) {
    body[data-header-state="banner-visible"] main {
        padding-top: calc(var(--initial-main-padding-top, 0px));
    }
    body[data-header-state="banner-hidden"] main {
        padding-top: calc(var(--top-bar-height, 80px));
    }
    body[data-header-state="collapsed"] main {
        padding-top: calc(var(--top-bar-height, 80px));
    }
    
    /* Fallback for when data-header-state is not set yet */
    main {
        padding-top: calc(var(--top-bar-height, 80px));
    }
}

/* Products Section */
#productos {
    background: linear-gradient(to bottom, #f9fafb, #edf2f7); /* Light gradient for contrast */
    padding-top: 4rem; /* Ensure padding is not lost due to previous instruction */
    padding-bottom: 4rem;
}

/* Services Section (already has gradient, make it more pronounced) */
#servicios {
    background: linear-gradient(to br, #e0f2fe, #dbeafe); /* Stronger blue gradient */
}

/* Contact Section */
#contacto {
    background: linear-gradient(to top, #f9fafb, #f3f4f6); /* Another subtle gradient */
    padding-top: 4rem; /* Ensure padding */
    padding-bottom: 4rem;
}