/* ==========================================================================
   CSS UNIFICADO: SIDEBAR PRO + CARDS COMPACTAS + ACORDEÓN DESPLEGABLE
   ========================================================================== */
:root {
    --mk-accent: #bc0000;
    --mk-accent-hover: #960000;
    --mk-dark: #0f172a;
    --mk-dark-hover: #1e293b;
    --mk-text-main: #0f172a;
    --mk-text-muted: #64748b;
    --mk-border: #cbd5e1;
    --mk-card-border: #cbd5e1;
    --mk-font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mk-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* SECCIÓN PRINCIPAL */
.mk-section.mk-inventory { 
    background-color: transparent;
    width: 100%;
    box-sizing: border-box;
    padding-top: 50px !important;
    padding-bottom: 60px !important;
    overflow: hidden;
}

/* CONTENEDOR CENTRAL */
.mk-inventory__container,
.mk-container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}

#mk-inventory-main { scroll-margin-top: 100px; }

/* LAYOUT PRINCIPAL */
.mk-inventory__layout { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 16px; 
    padding: 0; 
    align-items: start; 
}

/* =========================================
   SIDEBAR & BOTÓN TOGGLE FILTROS
   ========================================= */
.mk-mobile-filter-toggle {
    display: none;
}

@media (min-width: 1024px) { 
    .mk-inventory__layout { 
        grid-template-columns: 260px 1fr; 
        gap: 18px;
    } 

    .mk-mobile-filter-toggle {
        display: none;
    }

    .mk-inventory__sidebar {
        display: block !important;
        position: sticky; 
        top: 110px; 
        background: #ffffff;
        border-radius: 4px;
        padding: 26px 22px;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.14), 0 8px 24px rgba(0, 0, 0, 0.08);
        border: 1px solid #cbd5e1;
        height: fit-content;
    }

    .mk-hide-mobile {
        display: block;
    }
}

@media (max-width: 1023px) {
    .mk-inventory__sidebar-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    /* Botón compacto, centrado y sin border-radius solo en mobile */
    .mk-mobile-filter-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        max-width: 220px;
        margin: 0 auto 20px auto;
        padding: 9px 16px;
        background: #ffffff;
        border: 1.5px solid var(--mk-dark);
        border-radius: 0 !important;
        font-family: var(--mk-font);
        font-size: 0.85rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--mk-dark);
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
        transition: var(--mk-transition);
    }

    .mk-mobile-filter-toggle svg {
        width: 16px;
        height: 16px;
        color: var(--mk-dark);
        transition: color 0.2s ease;
    }

    .mk-mobile-filter-toggle:active {
        transform: scale(0.97);
    }

    .mk-inventory__sidebar {
        display: none;
        width: 100%;
        background: #fff;
        padding: 20px;
        border: 1px solid #cbd5e1;
        border-radius: 12px;
        box-shadow: 0 0 25px rgba(0, 0, 0, 0.18), 0 10px 30px rgba(0, 0, 0, 0.12);
        margin-bottom: 2rem;
    }
    
    .mk-inventory__sidebar.is-active {
        display: block !important;
        animation: slideDown 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    }
    
    .mk-hide-mobile {
        display: none !important;
    }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

.mk-sidebar-header { 
    margin-bottom: 1.25rem; 
    border-bottom: 2px solid var(--mk-dark); 
    padding-bottom: 0.85rem; 
}

.mk-sidebar-title { 
    font-size: 1.25rem; 
    font-weight: 700; 
    color: var(--mk-dark); 
    margin: 0 0 4px 0; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

.mk-sidebar-subtitle { 
    font-size: 0.82rem; 
    color: var(--mk-text-muted); 
}

/* =========================================
   SISTEMA DE ACORDEÓN / DESPLEGABLES
   ========================================= */
.mk-filter-group { 
    margin-bottom: 0.75rem; 
    padding-bottom: 0.75rem; 
    border-bottom: 1px solid #f1f5f9; 
}

.mk-filter-group:last-child { 
    border-bottom: none; 
    margin-bottom: 0; 
    padding-bottom: 0; 
}

.mk-filter-group__header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    padding: 6px 0;
    margin: 0;
    cursor: pointer;
    user-select: none;
    text-align: left;
}

.mk-filter-group__title { 
    font-family: var(--mk-font);
    font-size: 0.88rem; 
    font-weight: 700; 
    color: var(--mk-dark); 
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    transition: color 0.15s ease;
}

.mk-filter-group__header:hover .mk-filter-group__title {
    color: var(--mk-accent);
}

.mk-filter-chevron {
    color: #64748b;
    transform: rotate(0deg);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
    flex-shrink: 0;
}

.mk-filter-group__header:hover .mk-filter-chevron {
    color: var(--mk-accent);
}

.mk-filter-group__body {
    display: none;
    padding-top: 0.75rem;
    animation: fadeInGroup 0.25s ease;
}

.mk-filter-group.is-open .mk-filter-group__body {
    display: block;
}

.mk-filter-group.is-open .mk-filter-chevron {
    transform: rotate(90deg);
}

@keyframes fadeInGroup {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.mk-filter-toggles { 
    display: flex; 
    background: #f1f5f9; 
    padding: 3px; 
    border-radius: 8px; 
    border: 1px solid #e2e8f0; 
    box-sizing: border-box;
}

.mk-toggle-btn { 
    flex: 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 34px; 
    margin: 0; 
    padding: 0; 
    cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    font-family: var(--mk-font); 
    font-weight: 600; 
    font-size: 0.78rem; 
    letter-spacing: 0.3px; 
    color: #64748b; 
    border-radius: 6px; 
    user-select: none; 
}

.mk-toggle-btn:hover { 
    color: var(--mk-dark); 
}

.mk-toggle-btn input { 
    display: none; 
}

.mk-toggle-btn:has(input:checked) { 
    background: #ffffff; 
    color: var(--mk-dark) !important; 
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); 
}

.mk-scroll-area { max-height: 320px; overflow-y: auto; padding-right: 6px; }
.mk-scroll-area--small { max-height: 180px; }
.mk-scroll-area::-webkit-scrollbar { width: 4px; }
.mk-scroll-area::-webkit-scrollbar-track { background: transparent; }
.mk-scroll-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.mk-filter-list { list-style: none; padding: 0; margin: 0; }
.mk-filter-item { margin-bottom: 6px; }
.mk-filter-item:last-child { margin-bottom: 0; }

.mk-checkbox-container { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 6px 0; 
    cursor: pointer; 
    user-select: none; 
}

.mk-checkbox-text {
    font-family: var(--mk-font);
    font-size: 0.88rem; 
    font-weight: 400; 
    color: var(--mk-text-main); 
    transition: color 0.15s ease;
}

.mk-checkbox-container:hover .mk-checkbox-text {
    color: var(--mk-accent);
}

.mk-checkbox-container input { 
    display: none; 
}

.mk-checkbox-custom {
    width: 18px; 
    height: 18px; 
    border: 1.5px solid #cbd5e1; 
    border-radius: 4px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.2s ease; 
    background: #ffffff; 
    flex-shrink: 0; 
    box-sizing: border-box;
}

.mk-checkbox-container:hover .mk-checkbox-custom {
    border-color: #94a3b8;
}

.mk-checkbox-container:has(input:checked) .mk-checkbox-custom { 
    background-color: var(--mk-accent); 
    border-color: var(--mk-accent); 
    box-shadow: 0 2px 4px rgba(188, 0, 0, 0.25);
}

.mk-checkbox-container:has(input:checked) .mk-checkbox-custom::after {
    content: ""; 
    width: 4px; 
    height: 8px; 
    border: solid white; 
    border-width: 0 2px 2px 0;
    transform: rotate(45deg); 
    margin-bottom: 2px;
}

/* ==========================================================================
   GRILLA & CARDS COMPACTAS
   ========================================================================== */
.mk-grid-agency { 
    display: grid; 
    grid-template-columns: repeat(1, 1fr); 
    gap: 16px; 
}
@media (min-width: 768px) { .mk-grid-agency { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 1200px) { .mk-grid-agency { grid-template-columns: repeat(3, 1fr); gap: 16px; } }

.mk-card-vehicle { 
    background: #ffffff; 
    border: 1px solid var(--mk-card-border); 
    border-radius: 12px; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), 
                box-shadow 0.3s cubic-bezier(0.165, 0.84, 0.44, 1),
                border-color 0.3s ease; 
    height: 100%; 
}

.mk-card-vehicle:hover { 
    transform: translateY(-5px); 
    border-color: #94a3b8;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.18), 0 16px 32px rgba(0, 0, 0, 0.12); 
}

.mk-card-vehicle__media { 
    aspect-ratio: 16 / 10; 
    overflow: hidden; 
    display: block; 
    position: relative; 
    background: #f1f5f9;
}

.mk-card-vehicle__img,
.mk-card-vehicle__media img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.5s ease; 
}

.mk-card-vehicle:hover .mk-card-vehicle__media img { 
    transform: scale(1.04); 
}

.mk-card-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.mk-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--mk-font);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mk-badge--0km {
    background: #bc0000;
    color: #ffffff;
}

.mk-badge--usado {
    background: #3b506d;
    color: #ffffff;
}

/* Badges y modificadores para Vendido / Reservado */
.mk-badge--vendido {
    background: #b91c1c;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.mk-badge--reservado {
    background: #d97706;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.mk-card-vehicle--vendido .mk-card-vehicle__img,
.mk-card-vehicle--vendido .mk-card-vehicle__media img {
    filter: grayscale(85%) contrast(0.95);
    opacity: 0.85;
}

.mk-card-vehicle--vendido:hover .mk-card-vehicle__media img {
    filter: grayscale(40%) contrast(1);
    opacity: 1;
}

.mk-btn-action-primary--vendido {
    background: #475569 !important;
    box-shadow: none !important;
}

.mk-btn-action-primary--vendido:hover {
    background: #334155 !important;
}

.mk-card-vehicle__content { 
    padding: 16px 14px 14px 14px; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
    align-items: stretch; 
}

.mk-card-vehicle__title { 
    font-family: var(--mk-font); 
    font-size: 1.15rem; 
    font-weight: 600; 
    margin: 0; 
    line-height: 1.3; 
    min-height: 1.5rem;
}

.mk-card-vehicle__title a { 
    color: var(--mk-dark); 
    text-decoration: none; 
    transition: color 0.2s ease; 
    display: -webkit-box; 
    -webkit-line-clamp: 1; 
    line-clamp: 1; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}

.mk-card-vehicle__title a:hover { 
    color: var(--mk-accent); 
}

.mk-card-vehicle__specs-box {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: transparent;
    border: none;
    border-top: 1px solid #f1f5f9;    
    border-bottom: 1px solid #f1f5f9; 
    padding: 12px 0;                  
    margin: 14px 0;                   
}

.mk-spec-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
}

.mk-spec-col--center {
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}

.mk-spec-col__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1e293b;
    font-size: 1.05rem;
    line-height: 1;
}

.mk-spec-col__icon i {
    color: #1e293b;
}

.mk-spec-col__value {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
    white-space: nowrap;
}

.mk-card-vehicle__footer {
    margin-top: auto;
}

.mk-btn-action-primary {
    background: #8b0000;
    color: #ffffff !important;
    height: 38px;
    border-radius: 6px;
    font-family: var(--mk-font);
    font-size: 0.84rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: var(--mk-transition);
    box-shadow: 0 2px 6px rgba(139, 0, 0, 0.25);
}

.mk-btn-action-primary svg {
    transition: transform 0.25s ease;
}

.mk-btn-action-primary:hover {
    background: #700000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.35);
}

.mk-btn-action-primary:hover svg {
    transform: translateX(4px);
}

/* ==========================================================================
   OPTIMIZACIÓN EXCLUSIVA PARA CELULARES (< 768px)
   ========================================================================== */
@media (max-width: 767px) {
    .mk-grid-agency {
        gap: 14px;
        justify-items: center;
    }

    .mk-card-vehicle {
        width: 100%;
        max-width: 360px;
        border-radius: 10px;
    }

    .mk-card-vehicle__media {
        aspect-ratio: 16 / 9;
    }

    .mk-card-vehicle__content {
        padding: 12px 12px 10px 12px;
    }

    .mk-card-vehicle__title {
        font-size: 1.02rem;
        min-height: auto;
        margin-bottom: 2px;
    }

    .mk-card-vehicle__specs-box {
        padding: 8px 0;
        margin: 8px 0 10px 0;
    }

    .mk-spec-col__icon {
        font-size: 0.95rem;
    }

    .mk-spec-col__value {
        font-size: 0.75rem;
    }

    .mk-btn-action-primary {
        height: 34px;
        font-size: 0.8rem;
    }
}

/* PAGINACIÓN */
.mk-pagination { 
    margin-top: 3.5rem; 
    margin-bottom: 1.5rem;
    display: flex; 
    justify-content: center; 
    gap: 8px; 
}

.mk-pagination .page-numbers { 
    padding: 10px 16px; 
    background: #fff; 
    border: 1px solid #cbd5e1; 
    border-radius: 8px; 
    text-decoration: none; 
    color: var(--mk-dark); 
    font-family: var(--mk-font); 
    font-weight: 600; 
    font-size: 0.9rem; 
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease; 
}

.mk-pagination .page-numbers:hover { 
    border-color: var(--mk-dark); 
    color: var(--mk-dark-hover); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.mk-pagination .current { 
    background: var(--mk-dark); 
    color: #ffffff; 
    border-color: var(--mk-dark); 
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.mk-no-results {
    text-align: center; 
    padding: 4rem 2rem; 
    background: #fff; 
    border-radius: 16px; 
    border: 1px dashed var(--mk-border); 
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
}

.mk-no-results h3 { 
    font-size: 1.4rem; 
    color: var(--mk-dark); 
    margin: 0 0 0.5rem; 
}

.mk-no-results p { 
    color: var(--mk-text-muted); 
    margin-bottom: 1.5rem; 
}

.mk-btn-reset {
    display: inline-block; 
    padding: 10px 20px; 
    background: #f1f5f9; 
    color: var(--mk-dark); 
    font-weight: 600; 
    border-radius: 6px; 
    text-decoration: none; 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    transition: 0.2s ease;
}

.mk-btn-reset:hover { 
    background: #e2e8f0; 
}