/* --- Ecologika Digital Catalog - Custom Theme --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* MODO NOCHE POR DEFECTO */
    --ec-bg: #0f172a;
    /* Slate 900 - Más profundo */
    --ec-panel-bg: #1e293b;
    /* Slate 800 */
    --ec-text-light: #f8fafc;
    --ec-text-muted: #94a3b8;
    --ec-border-color: #334155;
    --ec-primary-green: #10b981;
    /* Emerald 500 - Más vibrante */
    --ec-secondary-blue: #0ea5e9;
    /* Sky 500 */
    --ec-glass-bg: rgba(30, 41, 59, 0.7);
    --ec-glass-border: rgba(255, 255, 255, 0.1);
    --ec-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --ec-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --ec-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --ec-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --ec-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

body.light-mode {
    /* MODO DÍA */
    --ec-bg: #f8fafc;
    /* Slate 50 */
    --ec-panel-bg: #ffffff;
    --ec-text-light: #0f172a;
    --ec-text-muted: #64748b;
    --ec-border-color: #e2e8f0;
    --ec-glass-bg: rgba(255, 255, 255, 0.8);
    --ec-glass-border: rgba(0, 0, 0, 0.05);
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--ec-bg);
    color: var(--ec-text-light);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

/* --- UTILIDADES GLASSMORPHISM --- */
.glass-panel {
    background: var(--ec-glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--ec-glass-border);
    box-shadow: var(--ec-shadow-lg);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

.header {
    background-color: var(--ec-panel-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--ec-border-color);
    box-shadow: var(--ec-shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    /* Sticky header */
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    margin-right: auto;
    /* Push everything else to the right on desktop if needed, but space-between handles it */
}

.brand img {
    height: 40px;
    transition: transform 0.3s ease;
}

.brand:hover img {
    transform: scale(1.05);
}

/* --- SEPARATED CATALOG LINK --- */
.header-catalog-link {
    background: linear-gradient(135deg, var(--ec-primary-green), #059669);
    color: white !important;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    white-space: nowrap;
    padding: 0.5rem 1.25rem;
    border-radius: 99px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.header-catalog-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
    filter: brightness(1.1);
}

.header-catalog-link:active {
    transform: translateY(0);
}

.header-catalog-link i {
    font-size: 1rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--ec-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--ec-secondary-blue);
}

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

.nav-link:hover::after {
    width: 100%;
}

/* --- THEME TOGGLE ICON --- */
.btn-theme-toggle {
    background: transparent;
    border: none;
    color: var(--ec-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-theme-toggle:hover {
    color: var(--ec-secondary-blue);
    background-color: rgba(14, 165, 233, 0.1);
    transform: rotate(15deg);
}

/* --- MOBILE MENU TOGGLE --- */
.mobile-menu-toggle {
    display: none;
    /* Hidden on desktop */
    background: transparent;
    border: none;
    color: var(--ec-text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 1rem;
}

/* --- RESPONSIVE HEADER --- */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
        z-index: 1002;
    }

    /* Hide the main nav by default on mobile */
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        /* Hidden off-screen */
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background-color: #1e293b !important;
        /* Solid dark background (Slate 800) */
        flex-direction: column;
        justify-content: center;
        padding: 2rem;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.7);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 9999 !important;
        /* Highest z-index */
        align-items: center;
        opacity: 1 !important;
        visibility: visible;
    }

    .main-nav.active {
        right: 0;
    }

    /* Ensure content inside is visible */
    .main-nav * {
        opacity: 1 !important;
        visibility: visible !important;
    }

    .nav-right {
        flex-direction: column;
        width: 100%;
        gap: 2.5rem;
        margin-top: 0;
        align-items: center;
        display: flex;
    }

    .nav-link {
        font-size: 1.5rem;
        /* Larger text */
        font-weight: 600;
        width: 100%;
        text-align: center;
        padding: 1rem 0;
        display: block;
        color: #ffffff !important;
        /* Force pure white text */
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        /* Add shadow for better contrast */
    }

    .nav-link:hover {
        color: var(--ec-secondary-blue) !important;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 0.5rem;
    }

    /* Overlay backdrop */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8) !important;
        /* Very dark overlay */
        backdrop-filter: blur(5px);
        z-index: 9998 !important;
        /* Just below nav */
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .menu-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Fix for Mobile Menu Stacking Context */
body.menu-open {
    overflow: hidden;
    /* Prevent scrolling when menu is open */
}

body.menu-open .header {
    z-index: 10000 !important;
    /* Bring header above overlay when menu is open */
    position: relative;
    /* Ensure it breaks out if needed, though sticky + high z-index should work */
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ec-primary-green), #059669);
    color: white !important;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(16, 185, 129, 0.4);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: transparent;
    color: var(--ec-text-muted);
    border: 1px solid var(--ec-border-color);
}

.btn-secondary:hover {
    background-color: var(--ec-border-color);
    color: var(--ec-text-light);
}

.hero-card {
    background-size: cover;
    background-position: center;
    padding: 6rem 2rem;
    color: white;
    border-radius: 1.5rem;
    position: relative;
    overflow: hidden;
    margin-bottom: 3rem;
    box-shadow: var(--ec-shadow-xl);
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.3), rgba(15, 23, 42, 0.7));
    z-index: 1;
}

.hero-card>* {
    position: relative;
    z-index: 2;
}

.hero-card h1 {
    font-weight: 800;
    letter-spacing: -0.025em;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.card {
    background-color: var(--ec-panel-bg);
    border-radius: 1rem;
    border: 1px solid var(--ec-border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Product Grid - Masonry Layout (CSS Columns) */
.product-grid {
    column-count: 4;
    column-gap: 1.5rem;
    display: block;
}

@media (max-width: 1200px) {
    .product-grid {
        column-count: 3;
    }
}

@media (max-width: 992px) {
    .product-grid {
        column-count: 2;
    }
}

@media (max-width: 576px) {
    .product-grid {
        column-count: 1;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    position: relative;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--ec-panel-bg);
    border: 1px solid var(--ec-border-color);
    border-radius: 1.25rem;
    overflow: hidden;
    animation: fadeUp 0.6s ease-out forwards;
    opacity: 0;
    /* Masonry Fixes */
    break-inside: avoid;
    margin-bottom: 1.5rem;
    display: inline-block;
    width: 100%;
}

/* Stagger animation delays */
.product-card:nth-child(1) {
    animation-delay: 0.1s;
}

.product-card:nth-child(2) {
    animation-delay: 0.15s;
}

.product-card:nth-child(3) {
    animation-delay: 0.2s;
}

.product-card:nth-child(4) {
    animation-delay: 0.25s;
}

.product-card:nth-child(n+5) {
    animation-delay: 0.3s;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--ec-shadow-xl);
    border-color: var(--ec-primary-green);
}

.product-card .content {
    padding: 1.5rem;
}

/* Placeholder with category color and centered text */
.product-card .image-placeholder {
    height: 180px;
    position: relative;
    overflow: hidden;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: transparent !important;
    /* Ensure no white bg covers it */
}

.product-card .placeholder-fallback {
    width: 100%;
    height: 100%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 2rem;
    font-weight: 700;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.05em;
}

.product-card .image-placeholder::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .image-placeholder::after {
    opacity: 1;
}

.product-card .category-badge {
    background-color: rgba(14, 165, 233, 0.1);
    color: var(--ec-secondary-blue);
    padding: 0.35rem 0.85rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.product-card h3 {
    margin: 0.5rem 0 0.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ec-text-light);
    line-height: 1.3;
}

.product-card .sku {
    font-size: 0.8rem;
    color: var(--ec-text-muted);
    margin-bottom: 1rem;
    font-family: monospace;
}

/* Dark Mode Contrast Fix */
/* Dark Mode Contrast Fix */
/* Dark Mode Contrast Fix */
body:not(.light-mode) .product-card .sku {
    color: #ffffff !important;
    /* White for max contrast */
    font-weight: 600;
}

.product-card .description {
    font-size: 0.9rem;
    color: var(--ec-text-muted);
    line-height: 1.6;
}

/* Dark Mode Contrast Fix */
body:not(.light-mode) .product-card .description,
body:not(.light-mode) .product-card .details {
    color: #f1f5f9 !important;
    /* Slate 100 */
}

/* --- FILTRO VISUAL DE MARCAS --- */
.brand-filter-container {
    max-width: 800px;
    margin: 0 auto 3rem;
    padding: 2rem;
    background: var(--ec-panel-bg);
    border-radius: 1.5rem;
    border: 1px solid var(--ec-border-color);
}

.brand-logo-filter {
    background-color: var(--ec-bg);
    border: 2px solid transparent;
    border-radius: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--ec-shadow-sm);
}

.brand-logo-filter:hover {
    transform: scale(1.05);
    border-color: var(--ec-primary-green);
    box-shadow: var(--ec-shadow-md);
}

.brand-logo-filter.active {
    border-color: var(--ec-primary-green);
    background-color: rgba(16, 185, 129, 0.05);
}

/* --- DATATABLES --- */
.dataTables_wrapper {
    background-color: var(--ec-panel-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--ec-border-color);
}

div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label {
    color: var(--ec-text-muted);
    font-weight: 500;
}

div.dataTables_wrapper div.dataTables_filter input {
    background-color: var(--ec-bg);
    border: 1px solid var(--ec-border-color);
    color: var(--ec-text-light);
    border-radius: 0.5rem;
    padding: 0.4rem 0.8rem;
}

table.dataTable thead th {
    color: var(--ec-text-light);
    font-weight: 600;
    border-bottom: 2px solid var(--ec-border-color) !important;
}

table.dataTable tbody td {
    border-bottom: 1px solid var(--ec-border-color) !important;
}

/* --- FOOTER --- */
.footer-global {
    background-color: #1e293b !important;
    border-top: 1px solid #334155 !important;
    padding: 4rem 0 2rem !important;
    margin-top: 5rem !important;
    color: #f7fafc !important;
    /* Force white text */
}

/* --- SELECTION BAR (FLOATING) --- */
#selection-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 9999;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Spring-like effect */
}

/* Glassmorphism applied via .glass-panel class in JS or here */
#selection-bar.glass-panel {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

body.light-mode #selection-bar.glass-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

/* --- EXPORT MODAL PREMIUM STYLES (v8.2 - Compact & Scroll Safe) --- */
#export-modal.modal {
    padding-right: 0 !important;
}

#export-modal .modal-dialog {
    max-width: 900px;
    margin: 1rem auto;
    /* Margen reducido */
    height: calc(100% - 2rem);
    /* Altura completa menos margen */
    display: flex;
    align-items: center;
    /* Centrado vertical */
}

#export-modal .modal-content {
    background-color: var(--ec-panel-bg);
    border: 1px solid var(--ec-border-color);
    border-radius: 1.5rem;
    box-shadow: var(--ec-shadow-2xl);
    overflow: hidden;
    max-height: 90vh;
    /* Límite estricto */
    width: 100%;
    display: flex;
    flex-direction: column;
    /* Flex vertical para header/body/footer */
}

/* Glassmorphism Enhancement */
#export-modal .modal-content.glass-panel {
    background: rgba(30, 41, 59, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-mode #export-modal .modal-content.glass-panel {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Header Compacto */
#export-modal .modal-header {
    border-bottom: none;
    padding: 1.5rem 2rem 0.5rem;
    /* Padding reducido arriba/abajo */
    flex-shrink: 0;
    /* No encoger */
}

#export-modal .modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, var(--ec-text-light), var(--ec-text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

#export-modal .modal-header .btn-close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    padding: 0.5rem;
    transition: all 0.2s ease;
}

#export-modal .modal-header .btn-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

body.light-mode #export-modal .modal-header .btn-close {
    filter: invert(1);
}

/* Body con Scroll Interno */
#export-modal .modal-body {
    padding: 1rem 2rem;
    overflow-y: auto;
    /* SCROLL AQUÍ */
    flex: 1 1 auto;
    /* Ocupar espacio disponible */
    -webkit-overflow-scrolling: touch;
}

/* Typography Hierarchy */
#export-modal h6 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ec-secondary-blue);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#export-modal h6::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--ec-border-color), transparent);
}

/* Form Controls Compact */
#export-modal .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ec-text-muted);
    margin-bottom: 0.3rem;
}

#export-modal .form-control {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    color: var(--ec-text-light);
    border-radius: 0.6rem;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#export-modal .form-control:focus {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: var(--ec-primary-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    transform: translateY(-1px);
}

body.light-mode #export-modal .form-control {
    background-color: #f1f5f9;
}

body.light-mode #export-modal .form-control:focus {
    background-color: #ffffff;
}

/* Custom Radio & Checkbox Containers */
#export-modal .form-check {
    padding-left: 2rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
    min-height: 1.5rem;
}

#export-modal .form-check-input {
    margin-left: -1.6rem;
    transform: scale(1.05);
    border-color: var(--ec-text-muted);
    background-color: transparent;
    cursor: pointer;
    float: left;
}

#export-modal .form-check-input:checked {
    background-color: var(--ec-primary-green);
    border-color: var(--ec-primary-green);
}

#export-modal .form-check-input:checked+.form-check-label {
    color: var(--ec-text-light);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Preview Container Compact */
#preview-container {
    border-radius: 1rem;
    border: none;
    background-color: #ffffff;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
    height: 250px;
    /* Altura reducida */
    position: relative;
    width: 100%;
}

#preview-container::before {
    content: 'Vista Previa';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 800;
    color: #f1f5f9;
    z-index: 0;
    pointer-events: none;
}

#preview-container iframe {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border: none;
}

/* Footer Fixed at Bottom */
#export-modal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1rem 2rem;
    background-color: rgba(0, 0, 0, 0.2);
    justify-content: space-between;
    flex-shrink: 0;
    /* No encoger */
}

#export-modal .btn {
    border-radius: 99px;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}

/* Desktop Modal Grid */
@media (min-width: 769px) {
    .modal-options-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    #preview-container {
        height: 500px !important;
        /* Taller preview on desktop */
    }
}

/* Modal Footer Buttons */
#export-modal .btn-outline-danger {
    color: #ef4444;
    border-color: #ef4444;
}

#export-modal .btn-secondary {
    border: 1px solid var(--ec-border-color);
}

#export-modal .btn-primary {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    #export-modal .modal-dialog {
        margin: 0;
        height: 100%;
        max-width: 100%;
    }

    #export-modal .modal-content {
        border-radius: 0;
        height: 100%;
        border: none;
        max-height: 100vh;
        overflow-y: auto;
        /* Fix scroll */
        display: flex;
        flex-direction: column;
        overflow: hidden;
        /* Prevent double scrollbars */
    }

    #export-modal .modal-body {
        overflow-y: auto;
        flex: 1 1 auto;
        min-height: 0;
        /* Crucial for flex scrolling */
        padding-bottom: 80px;
        /* Space for footer above browser controls */
    }

    #export-modal .modal-header {
        padding: 0.75rem 1rem;
        /* Reduced top/bottom padding */
        padding-top: 0.5rem;
        /* Minimal top padding */
    }

    #export-modal .modal-body {
        padding: 0.75rem;
        padding-top: 0.5rem;
        /* Reduced top padding */
    }

    #export-modal .modal-footer {
        padding: 1rem;
        /* Mobile Layout: Force Row */
        display: flex;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0.5rem;
        background: var(--ec-panel-bg);
        z-index: 10;
        overflow-x: auto;
        /* Allow scroll if content is too wide */
    }

    #export-modal .modal-footer>* {
        width: auto !important;
        text-align: left;
        justify-content: flex-start;
        flex-shrink: 0;
    }

    #export-modal .modal-footer .d-flex {
        justify-content: flex-end;
        width: auto;
        flex-wrap: nowrap !important;
        gap: 8px;
    }

    /* Make footer sticky at bottom */
    #export-modal .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--ec-panel-bg) !important;
        z-index: 100;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    }

    #preview-container {
        height: 200px;
    }

    /* Forzar columnas en móvil si se rompe */
    #export-modal .col-md-6 {
        width: 100%;
        display: block;
        margin-bottom: 1.5rem;
    }

    /* ===== MOBILE MODAL LAYOUT IMPROVEMENTS ===== */

    /* 1. Formato de Salida: PDF/JPG en una sola fila */
    #export-modal .d-flex.gap-3 {
        display: flex !important;
        flex-direction: row !important;
        gap: 1.5rem !important;
        justify-content: flex-start !important;
    }

    /* 2. Contenido a Incluir: 2 columnas (2x2 grid) */
    #export-modal .p-3.rounded {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem 1rem !important;
        padding: 0.75rem !important;
        /* Reduced from 1rem */
    }

    #export-modal .form-check.form-switch {
        margin-bottom: 0 !important;
    }

    /* 3. Vista Previa: Altura optimizada en móvil */
    #export-modal #preview-container {
        height: 220px !important;
        /* Reduced from 280px for better fit */
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    /* Reduce spacing in modal sections */
    #export-modal .mb-4 {
        margin-bottom: 0.75rem !important;
    }

    #export-modal h5 {
        margin-bottom: 0.5rem !important;
    }
}


/* --- PREMIUM BRAND FILTER REDESIGN --- */
.brand-filter-wrapper {
    background: rgba(30, 41, 59, 0.7);
    /* Dark glass base */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    /* More rounded */
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.2),
        0 8px 10px -6px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    /* Inner highlight */
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow: hidden;
}

/* Subtle background glow effect */
.brand-filter-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.brand-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    /* Increased gap for more spacing */
    position: relative;
    z-index: 1;
    margin-bottom: 2rem;
}

.brand-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 110px;
    /* Reduced from 140px */
    height: 65px;
    /* Reduced from 80px */
    background: rgba(255, 255, 255, 0.95);
    /* Almost white for logo contrast */
    border-radius: 16px;
    padding: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    filter: none;
    /* Full color by default */
    opacity: 1;
}

.brand-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.brand-item span {
    font-weight: 600;
    color: #334155;
    font-size: 0.9rem;
}

/* Hover & Active States */
.brand-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
    filter: none;
    opacity: 1;
    transform: scale(1.05);
    /* Only scale */
    border-color: rgba(16, 185, 129, 0.3);
    /* Green hint */
}

.brand-item.active {
    filter: grayscale(0%);
    opacity: 1;
    border-color: var(--ec-primary-green);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
    transform: scale(1.05);
}

/* Filter Actions Toolbar */
.filter-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Premium Buttons */
.btn-premium {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--ec-text-light);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-premium:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-premium.primary {
    background: linear-gradient(135deg, var(--ec-primary-green) 0%, #059669 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.btn-premium.primary:hover {
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

/* ========================================
   RESPONSIVE BRAND FILTER CONFIGURATIONS
   ======================================== */

/* MOBILE: 0px - 576px (Smartphones) */
@media (max-width: 576px) {
    .brand-filter-wrapper {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }

    /* Mobile Brand Grid: 2 Columns */
    .brand-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        /* Reduced gap for mobile */
        padding-bottom: 1rem;
    }

    .brand-item {
        width: 80%;
        height: 55px;
        /* Smaller height for mobile */
        padding: 8px;
        border-radius: 12px;
    }

    /* Mobile Brand Filter: 2 Columns for Buttons */
    .filter-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
        width: 100%;
    }

    .btn-premium {
        width: 80%;
        justify-content: center;
        font-size: 0.85rem;
        padding: 0.6rem 0.5rem;
    }
}

/* TABLET: 577px - 992px */
@media (min-width: 577px) and (max-width: 992px) {
    .brand-filter-wrapper {
        padding: 1.75rem 1.5rem;
        border-radius: 20px;
    }

    /* Tablet Brand Grid: 3 Columns */
    .brand-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        max-width: 700px;
        margin: 0 auto 2.5rem;
    }

    .brand-item {
        width: 80%;
        height: 60px;
    }

    .filter-actions {
        display: flex;
        justify-content: center;
        gap: 1rem;
        flex-wrap: wrap;
    }
}

/* DESKTOP: 993px+ */
@media (min-width: 993px) {
    .brand-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem 2.5rem;
        /* row-gap column-gap */
        max-width: 750px;
        margin: 0 auto 3rem;
    }

    .brand-item {
        width: 100%;
        height: 65px;
    }
}