/* Responsive Styles */

/* Variables de espaciado (pueden estar en style.css también) */
:root {
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2.5rem;
    --color-neutral-dark: #263238;
    --color-white: #FFFFFF;
    --color-primary-light: #FFCDD2;
    --color-primary: #E53935;
}

/* Large devices (desktops, less than 1200px) */
@media (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
    .search-bar {
        margin: 0 var(--spacing-md);
    }
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Medium devices (tablets, less than 992px) */
@media (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }
    .header-container {
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
    }
    .logo {
        margin-bottom: 0;
    }
    .search-bar {
        order: 3;
        margin: var(--spacing-md) 0 0;
        max-width: 100%;
        flex-basis: 100%;
    }
    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    .service-card {
        padding: var(--spacing-md);
    }
    .cta-title {
        font-size: 1.75rem;
    }
    .cta-text {
        font-size: 1rem;
    }
}

/* Small devices (landscape phones, less than 768px) */
@media (max-width: 767.98px) {
    .container {
        max-width: 100%; /* Full width */
        padding-left: var(--spacing-md); /* Consistent side padding */
        padding-right: var(--spacing-md);
    }
    .top-bar-content {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
    }
    .contact-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-sm);
    }
    .contact-info span, .contact-info a {
        font-size: 0.75rem; /* Slightly smaller for very small screens */
    }
    .social-media {
        margin-top: var(--spacing-xs);
    }

    /* --- Mobile Menu Styles --- */
    .header-container {
        position: relative; /* Para que el menú no se solape con el header incorrectamente */
    }
    .mobile-menu-toggle {
        display: block;
        order: 2;
        background: none;
        border: none;
        color: var(--color-neutral-dark, #263238);
        font-size: 1.7rem; /* Ajustar tamaño */
        cursor: pointer;
        padding: 0.5rem;
        margin-left: var(--spacing-sm); /* Espacio si hay barra de búsqueda */
        line-height: 1;
    }
    .main-nav {
        order: 1; /* El logo puede ser order 0 */
        /* El main-nav en sí no necesita ser flex si el toggle está fuera de él en el DOM del header */
    }
    .nav-list {
        position: fixed;
        top: 0;
        left: -100%; /* Start off-screen */
        width: 80%;
        max-width: 300px; /* Max width for the menu */
        height: 100vh;
        background-color: var(--color-neutral-dark, #263238);
        flex-direction: column;
        align-items: stretch; /* Make items take full width */
        transition: left 0.3s ease-in-out; /* Smoother transition */
        z-index: 1010; /* High z-index to be on top of everything, including header */
        overflow-y: auto;
        padding-top: 0; /* Remove top padding, close button will be positioned */
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    .nav-list.active {
        left: 0; /* Slide in */
    }
    /* Close button (added by JS) */
    .close-menu {
        position: absolute;
        top: 10px;
        right: 10px;
        background: transparent;
        border: none;
        color: var(--color-white, #FFFFFF);
        font-size: 1.8rem; /* Icon size */
        cursor: pointer;
        padding: 0.5rem;
        line-height: 1;
        z-index: 1011; /* Above nav items */
    }
    /* Space for close button if items start from top */
    .nav-list > .nav-item:first-child {
         margin-top: 45px; /* Adjust this value if close button size/position changes */
    }

    .nav-item {
        width: 100%;
    }
    .nav-link {
        color: var(--color-white, #FFFFFF);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding: 0.9rem 1.2rem; /* Adjusted padding */
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        font-size: 0.95rem; /* Adjusted font size */
        box-sizing: border-box;
    }
    .nav-link:hover,
    .nav-link.active { /* For current page */
        background-color: rgba(255,255,255,0.07);
        color: var(--color-primary-light, #FFCDD2);
    }
    /* Style for the dropdown trigger link when its dropdown is open */
    .nav-item.dropdown-trigger > .nav-link.active { /* This 'active' is for the open state of dropdown */
        background-color: var(--color-primary, #E53935);
        color: var(--color-white, #FFFFFF);
    }
    .nav-item.dropdown-trigger > .nav-link.active i.fa-chevron-down { /* Rotate arrow when open */
        transform: rotate(180deg);
    }
    .nav-item.dropdown-trigger .nav-link i.fa-chevron-down {
        transition: transform 0.25s ease-out;
        font-size: 0.75em; /* Smaller arrow */
    }

    /* Mobile Dropdowns */
    .dropdown {
        position: static;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out; /* Smoother accordion transition */
        box-shadow: none;
        background-color: rgba(0,0,0,0.2); /* Slightly darker background for sub-menu */
    }
    .dropdown.show { /* Class 'show' added by JS to open */
        max-height: 500px; /* Adjust as needed, enough for items */
        overflow-y: auto; /* Scroll if many items */
    }
    .dropdown-link {
        padding: 0.75rem 1.2rem 0.75rem 2.2rem; /* Indented */
        font-size: 0.85rem; /* Slightly smaller */
        color: var(--color-neutral-light, #ECEFF1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    .dropdown-link:last-child {
        border-bottom: none;
    }
    .dropdown-link:hover {
        background-color: rgba(255,255,255,0.12);
    }
    /* --- End Mobile Menu Styles --- */


    .section-title {
        font-size: 1.5rem; /* Smaller section titles */
    }
    .section-title::after {
        width: 50px;
        height: 2px; /* Thinner line */
        bottom: -8px;
    }
    .categories-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns for categories */
        gap: var(--spacing-sm);
    }
    .category-card {
        height: 120px; /* Smaller category cards */
    }
    .category-title {
        font-size: 0.85rem;
    }
    .category-count {
        font-size: 0.65rem;
    }
    .section-header {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
        text-align: center;
    }
    .section-header .section-title {
        margin-bottom: var(--spacing-xs);
    }
    .products-grid {
        grid-template-columns: 1fr; /* Single column for products */
    }
    .product-card {
        margin-bottom: var(--spacing-lg); /* More space between products */
    }
    .partners-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Smaller partner logos */
        gap: var(--spacing-md);
    }
    .services-grid {
        grid-template-columns: 1fr;
    }
    .cta-section {
        padding: var(--spacing-lg) var(--spacing-md);
    }
    .cta-title {
        font-size: 1.4rem;
    }
    .footer-main {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .footer-col {
        align-items: center;
    }
    .footer-col:not(:last-child) {
        margin-bottom: var(--spacing-lg);
    }
    .footer-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
    .footer-links a {
        justify-content: center;
    }
     .footer-social {
        justify-content: center;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    .logo {
        font-size: 1.2rem;
    }
    .logo i {
        font-size: 1.1rem;
    }
    .search-input {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    .search-button {
        padding: 0 0.7rem;
    }
    .category-title {
        font-size: 0.75rem;
    }
    .category-card {
        height: 100px;
    }
    .product-badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.3rem;
        top: var(--spacing-xs);
        left: var(--spacing-xs);
    }
    .product-title {
        font-size: 0.9rem;
        min-height: 2.7em;
    }
    .product-price {
        font-size: 0.95rem;
    }
    .product-features {
        font-size: 0.7rem;
    }
    .product-btn {
        font-size: 0.7rem;
        padding: 0.35rem;
    }
    .cta-btn {
        width: 100%;
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }
    .whatsapp-float {
        width: 40px;
        height: 40px;
        bottom: 12px;
        right: 12px;
    }
    .whatsapp-float i {
        font-size: 1.2rem;
    }
}

/* Fix for very small devices (e.g. iPhone SE 1st gen width 320px) */
@media (max-width: 359.98px) {
    .top-bar {
        font-size: 0.6rem;
    }
    .contact-info {
        flex-direction: column;
        align-items: center;
        gap: 2px; /* very small gap */
    }
    .contact-info span, .contact-info a {
        font-size: 0.6rem;
    }
    .logo {
        font-size: 1rem;
    }
    .logo i {
        font-size: 0.9rem;
    }
    .section-title {
        font-size: 1.2rem;
    }
    .product-title {
        font-size: 0.8rem;
    }
    .footer-title {
        font-size: 0.85rem;
    }
}

/* Print styles */
@media print {
    .whatsapp-float,
    .slider-nav,
    .slider-dots,
    .hero-buttons,
    .search-bar,
    .mobile-menu-toggle,
    .top-bar,
    .footer-social {
        display: none !important;
    }
    .nav-list {
        display: none !important;
        position: static !important;
    }
    .header {
        position: static !important;
    }
    .logo {
        margin: 0 auto;
    }
    .hero-section {
        height: auto !important;
        min-height: 0 !important;
        page-break-after: always;
    }
    .hero-content {
        color: #000000 !important;
        text-shadow: none !important;
        padding: 20px !important;
        margin-left: 0 !important;
        text-align: left !important;
    }
     .hero-subtitle {
        background-color: #dddddd !important;
        color: #000000 !important;
        border: 1px solid #cccccc;
    }
    .hero-title, .hero-text {
        color: #000000 !important;
        text-shadow: none !important;
    }
    .btn, .btn-outline {
        display: none !important;
    }
    .products-grid {
        page-break-inside: avoid;
    }
    .footer {
        background-color: transparent !important;
        color: #000000 !important;
        padding-top: 20px !important;
    }
    .footer-logo, .footer-title, .footer-links a {
        color: #000000 !important;
    }
    .footer-title::after {
        background-color: #555555 !important;
    }
    .footer-bottom-text {
        color: #000000 !important;
        opacity: 1 !important;
    }
}
