/* 
 * responsive.css - Central de Adaptabilidad "De Remate" (2026)
 * Este archivo centraliza todas las media queries del sistema para facilitar el mantenimiento.
 */

/* =========================================================================
   1. UTILIDADES GLOBALES (U-Classes)
   ========================================================================= */
.u-hide-sm {
    display: block;
}

.u-show-sm {
    display: none;
}

.u-show-xs {
    display: none;
}

@media (min-width: 1024px) /* Desktop: nav horizontal */ {
    .u-hide-lg {
        display: none !important;
    }
}

@media (max-width: 1023px) /* Mobile+Tablet: nav hamburguesa */ {
    .u-hide-lg {
        display: flex !important;
    }

    .u-hide-sm {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .u-hide-sm {
        display: none !important;
    }

    .u-show-sm {
        display: block !important;
    }

    .u-stack-sm {
        flex-direction: column !important;
    }

    .u-text-center-sm {
        text-align: center !important;
    }

    .u-full-width-sm {
        width: 100% !important;
    }

    .u-no-padding-sm {
        padding: 0 !important;
    }
}

/* =========================================================================
   2. SITIO PÃšBLICO (Proveniente de index.css)
   ========================================================================= */

/* --- NAVEGACIÃ“N Y HEADER --- */
@media (min-width: 1024px) /* Desktop: nav horizontal */ {
    .nav-links {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: static !important;
        transform: none !important;
        height: auto !important;
        background: transparent !important;
        padding: 0 !important;
    }

    .menu-toggle,
    .mobile-search-trigger {
        display: none !important;
    }

    #nav-links {
        display: flex !important;
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        backdrop-filter: none !important;
        pointer-events: auto !important;
        z-index: 1 !important;
        flex-direction: row !important;
    }

    .nav-link {
        font-size: 1rem;
        font-weight: 500;
        padding: 0;
        transform: none !important;
    }
}

@media (max-width: 1023px) /* Mobile+Tablet: nav hamburguesa */ {
    .top-nav {
        z-index: var(--z-toast) !important; /* --z-toast: 10000 */
    }

    .nav-links {
        z-index: calc(var(--z-toast) + 1000) !important; /* 11000 */
        background: var(--surface) !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw !important;
        height: 100dvh !important;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--space-xl);
        padding: var(--space-huge);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    [data-theme="dark"] .nav-links {
        background: rgba(18, 18, 18, 0.95);
    }

    .nav-links.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        display: flex !important;
    }

    .menu-toggle {
        display: block;
    }

    .menu-toggle.is-active {
        z-index: calc(var(--z-toast) + 2000) !important; /* 12000: toggle activo, encima de nav-links */
    }

    .nav-link {
        font-family: var(--font-display);
        font-size: 2.2rem;
        font-weight: 600;
        color: var(--on-surface);
        text-align: center;
        width: auto;
        padding: 10px;
        transition: transform 0.3s ease, color 0.3s ease;
    }

    .nav-link:hover,
    .nav-link.active {
        color: var(--primary);
        transform: scale(1.1);
    }

    .nav-actions {
        gap: 8px;
        z-index: var(--z-base) !important; /* --z-base: 1 â€” nav-actions en mobile */
    }

    .search-bar {
        display: none !important;
    }

    .action-icons {
        gap: 4px;
    }

    .container {
        padding: 0 var(--space-md);
    }
}

/* --- HERO SECTION --- */
@media (max-width: 1023px) /* Mobile+Tablet: nav hamburguesa */ {
    .hero {
        padding: 100px 0 40px;
    }

    .hero-layout {
        flex-direction: column;
        gap: var(--space-xl);
    }

    .hero-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .hero-meta {
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .bcv-badge {
        width: auto !important;
        align-self: flex-end;
        padding: 4px 12px 4px 4px;
        background: rgba(var(--primary-rgb), 0.05);
        border: 1px solid rgba(var(--primary-rgb), 0.08);
        gap: 8px;
    }

    .bcv-icon {
        width: 32px;
        height: 32px;
    }

    .bcv-text {
        font-size: 0.6rem;
    }

    .bcv-value {
        font-size: 0.95rem;
    }

    .hero-meta {
        align-items: flex-end !important;
        gap: 4px;
        margin-bottom: var(--space-sm);
    }

    .bcv-status {
        justify-content: flex-end;
        font-size: 0.7rem;
        opacity: 0.7;
    }

    .nav-container {
        padding: 0 12px;
        gap: 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .logo-composite {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .logo-icon {
        height: 36px !important;
        margin-left: 0;
    }

    .logo-text-wrapper {
        display: flex !important;
        flex-direction: column;
    }

    .logo-main {
        font-size: 1rem !important;
        letter-spacing: 0.2px;
    }

    .logo-slogan {
        font-size: 0.65rem !important;
        display: block !important;
        opacity: 0.8;
    }

    .nav-actions {
        display: flex;
        align-items: center;
        gap: 4px;
        margin-left: auto;
    }

    .action-icons {
        gap: 2px !important;
    }

    #search-overlay-input {
        font-size: 1.4rem !important;
        padding-left: 40px !important;
    }
}

@media (max-width: 360px) {

    /* --- UTILIDADES XS --- */
    .u-show-xs {
        display: block !important;
    }

    .u-hide-xs {
        display: none !important;
    }

    /* --- AJUSTES XS SITIO PÃšBLICO --- */
    .top-nav {
        padding: var(--space-xs) 0;
    }

    .logo-slogan {
        display: none !important;
    }

    .logo-main {
        font-size: 0.9rem !important;
        letter-spacing: 0.5px;
        margin-left: -40px;
        /* Ajuste para centrar tras quitar gavel */
    }

    .hero h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    .container {
        padding: 0 var(--space-sm);
    }

    .nav-actions {
        gap: 8px !important;
        margin-left: auto;
    }

    /* Ocultar iconos que saturan el header en XS */
    .logo-slogan,
    #xs-menu-toggle {
        display: none !important;
    }

    .action-icons {
        gap: 6px !important;
    }

    .icon-btn {
        padding: 5px !important;
    }

    .icon-btn .material-symbols-outlined {
        font-size: 20px !important;
    }

    .notif-badge, .fav-badge {
        position: absolute;
        top: 0;
        right: 0;
        background: #FF3B30 !important; /* Rojo estilo Apple/Premium */
        color: white !important;
        font-size: 8px !important;
        font-weight: 800 !important;
        min-width: 14px !important;
        height: 14px !important;
        border-radius: 10px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        border: 1.5px solid var(--surface);
    }

    .user-avatar-xs {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        overflow: hidden;
        border: 1px solid var(--primary-container);
        flex-shrink: 0;
    }

    /* --- XS SEARCH WRAPPER --- */
    .xs-search-container {
        padding: var(--space-xl) 0 var(--space-md);
        display: block !important;
        margin-top: 60px;
    }

    .xs-search-wrapper {
        position: relative;
        width: 100%;
        background: #F3F1EC;
        /* Tono crema sutil de la foto */
        border-radius: 100px;
        padding: 4px; /* Reducido de 6px a 4px */
        height: 54px;
        /* MÃ¡s alto y cÃ³modo - pero reducido de 64px a 54px (~15%) */
        display: flex;
        flex-direction: row !important;
        align-items: center;
        border: 1px solid rgba(0, 0, 0, 0.03);
    }

    .xs-search-input {
        width: 100%;
        background: transparent;
        border: none;
        padding: 0 20px; /* Reducido un poco para compensar */
        font-size: 1rem; /* Reducido de 1.1rem a 1rem */
        color: var(--on-surface);
        cursor: pointer;
        font-weight: 500;
    }

    .xs-search-btn {
        width: 40px; /* Reducido de 48px a 40px (~15%) */
        height: 40px; /* Reducido de 48px a 40px (~15%) */
        background: #00585C;
        /* Teal sÃ³lido */
        color: white;
        border: none;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        box-shadow: 0 4px 10px rgba(0, 88, 92, 0.2);
    }

    /* --- HERO XS ADJUSTMENTS --- */
    .hero {
        padding: 0 !important;
    }

    .hero-text {
        display: none !important;
        /* Ocultar frase y tasa BCV por orden del usuario */
    }

    /* --- CATEGORY CAROUSEL XS --- */
    .hero-filters {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        padding: 0 var(--space-sm);
        margin-bottom: var(--space-md);
    }

    .category-pills {
        display: flex !important;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 12px !important;
        padding-bottom: 8px;
        /* Espacio para scroll suave */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Ocultar scrollbar Firefox */
        width: 100%;
    }

    .category-pills::-webkit-scrollbar {
        display: none;
        /* Ocultar scrollbar Chrome/Safari */
    }

    .category-pills .pill {
        flex: 0 0 auto;
        width: auto !important;
        margin: 0 !important;
        background: #EBEBE6 !important;
        /* Gris claro de la foto */
        color: #1A1A1A !important;
        border-radius: 99px !important;
        padding: 10px 20px !important;
        font-size: 0.95rem !important;
        font-weight: 600;
        border: none;
        text-align: center;
        white-space: nowrap;
    }

    .category-pills .pill.active {
        background: #258784 !important;
        /* Teal de la foto */
        color: white !important;
    }
}

/* --- BOTTOM NAVIGATION STYLES --- */
.bottom-nav {
    position: fixed !important;
    /* Obligar fixed */
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 70px !important;
    background: var(--surface);
    display: flex !important;
    flex-direction: row !important;
    /* Forzar horizontal */
    justify-content: space-around !important;
    align-items: center !important;
    border-top: 1px solid var(--outline-variant);
    padding: 0 5px !important;
    z-index: var(--z-nav) !important; /* --z-nav: 1000 */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .bottom-nav {
    background: #121212;
    border-color: #333;
}

.bottom-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    color: var(--on-surface-variant);
    gap: 4px !important;
    flex: 1 !important;
    height: 100% !important;
    transition: all 0.2s ease;
}

.bottom-nav-item .material-symbols-outlined {
    font-size: 24px !important;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.bottom-nav-item.active {
    color: var(--primary) !important;
}

.bottom-nav-item.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.bottom-nav-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: capitalize !important;
    letter-spacing: 0px !important;
}

/* --- QUICKVIEW Y FOOTER --- */
@media (max-width: 1023px) /* Mobile+Tablet: nav hamburguesa */ {
    .qv-content {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .quickview-drawer {
        max-width: 100%;
    }

    .qv-gallery {
        padding: var(--space-xl);
        overflow-y: visible;
        border-right: none;
        border-bottom: 1px solid var(--outline-variant);
    }

    .qv-main-img {
        min-height: auto;
    }

    .qv-info {
        padding: var(--space-xl);
        overflow-y: visible;
    }

    .qv-thumbnails {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 4px var(--space-md) var(--space-md);
        -webkit-overflow-scrolling: touch;
        gap: 12px;
    }

    .qv-thumbnails img {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }

    .qv-price-box {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .qv-tasa-note {
        text-align: left;
    }

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

@media (max-width: 640px) {
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-logo {
        justify-content: center;
    }

    .footer-desc,
    .footer-brand p {
        max-width: 100%;
    }

    .trust-badges {
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--space-md);
    }

    .copy {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
}

/* =========================================================================
   3. PANEL ADMINISTRATIVO (Proveniente de admin.css)
   ========================================================================= */

@media (max-width: 768px) {

    /* Sidebar se oculta fuera de la pantalla por defecto */
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
            width var(--transition-fast),
            padding var(--transition-fast);
        z-index: 200;
        width: min(260px, 85vw) !important;
        padding: var(--space-lg) var(--space-md);
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Logo mÃ¡s pequeÃ±o en mobile */
    .logo-wrapper .logo-icon {
        height: 40px !important;
    }

    .logo-text-container {
        display: none;
    }

    /* Nav items con mejor spacing en mobile */
    .admin-nav .nav-link {
        padding: var(--space-md) var(--space-sm);
    }

    .admin-nav .nav-link span:not(.material-symbols-outlined) {
        display: inline;
    }

    /* BotÃ³n cerrar dentro del sidebar */
    .sidebar-close-btn {
        display: none;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        border: none;
        background: var(--surface-container-high);
        color: var(--on-surface-variant);
        cursor: pointer;
        margin-bottom: var(--space-lg);
        margin-left: auto;
        flex-shrink: 0;
    }

    .sidebar-close-btn:hover {
        background: var(--primary);
        color: var(--on-primary);
    }

    .u-show-sm {
        display: flex !important;
    }

    /* Sidebar visible cuando body tiene .sidebar-open */
    body.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    /* Overlay oscuro al abrir sidebar en mobile */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
        animation: fadeIn 0.3s ease;
    }

    /* Contenido principal ocupa todo el ancho */
    .admin-main {
        margin-left: 0 !important;
        padding: var(--space-md);
    }

    /* Reducción de espacios muertos en tarjetas para ganar área útil */
    .admin-card {
        padding: var(--space-lg) !important;
    }

    .admin-stat-card {
        padding: var(--space-md) !important;
        gap: var(--space-md) !important;
    }

    .admin-stat-card .stat-icon-box {
        width: 48px !important;
        height: 48px !important;
        border-radius: 12px !important;
    }

    .admin-stat-card .stat-content .admin-stat-value {
        font-size: 1.5rem !important;
    }

    /* Header top en mobile */
    .admin-header-top {
        gap: var(--space-sm);
    }

    .h2-title {
        font-size: 1.1rem;
    }

    /* Modal responsive en mobile */
    .admin-modal-content {
        max-width: calc(100% - 32px) !important;
        margin: 16px auto !important;
    }

    /* Tablas con scroll horizontal en mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Stats grid 2 columnas en mobile */
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Table Stacking (Transforma tablas en tarjetas) */
    .table-stack-sm thead {
        display: none;
    }

    .table-stack-sm tr {
        display: block;
        margin-bottom: var(--space-lg);
        background: var(--surface-container-low);
        border: 1px solid var(--outline-variant);
        border-radius: 16px;
        padding: var(--space-md);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .table-stack-sm td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border: none !important;
        padding: 8px 0 !important;
        min-height: 40px;
    }

    .table-stack-sm td::before {
        content: attr(data-label);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.7rem;
        color: var(--on-surface-variant);
        text-align: left;
        padding-right: 15px;
    }

    .table-stack-sm .product-cell {
        min-width: 0;
        flex-direction: row-reverse;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {

    /* Stats grid 1 columna en pantallas muy pequeÃ±as */
    .admin-stats-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 360px) {

    /* --- AJUSTES XS PANEL ADMINISTRATIVO --- */
    .h2-title {
        font-size: 1rem;
    }

    .admin-header-top {
        flex-direction: column;
        align-items: flex-start;
    }
}

