/* ==========================================================================
   KapanStore (zpro.am) Full-Stage Visual Catalog Mega-Menu & Mobile Drawer
   Tailwind v2.2.19 Safe Scoped CSS (360px - 2560px+)
   ========================================================================== */

.zpro-mm-root,
.zpro-mm-root *,
.zpro-mm-root *::before,
.zpro-mm-root *::after,
.zpro-mmd-drawer,
.zpro-mmd-drawer *,
.zpro-mmd-drawer *::before,
.zpro-mmd-drawer *::after {
    box-sizing: border-box;
}

/* Trigger Active Indicator */
.zpro-catalog-btn[data-catalog-megamenu-trigger].is-megamenu-open,
.zpro-catalog-btn[data-catalog-megamenu-trigger][aria-expanded="true"] {
    background-color: #991b1b;
    border-color: #991b1b;
    color: #ffffff;
}

/* ==========================================================================
   Desktop Full-Stage Mega-Menu (>= 1024px)
   ========================================================================== */
.zpro-mm-backdrop {
    position: fixed;
    top: var(--zpro-megamenu-top, 104px);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
    display: none;
}

.zpro-mm-backdrop.is-open {
    display: block;
}

.zpro-mm-root {
    position: fixed;
    top: var(--zpro-megamenu-top, 104px);
    left: 0;
    right: 0;
    z-index: 120;
    padding-top: 0;
    padding-bottom: 12px;
    display: none;
    pointer-events: none;
}

.zpro-mm-root.is-open {
    display: block;
    pointer-events: auto;
}

.zpro-mm-container {
    width: 100%;
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.zpro-mm-surface {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: 0;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.22), 0 8px 20px -6px rgba(15, 23, 42, 0.1);
    overflow: hidden;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 296px;
    max-height: min(calc(100vh - var(--zpro-megamenu-top, 104px) - 16px), 640px);
    max-height: min(calc(100dvh - var(--zpro-megamenu-top, 104px) - 16px), 640px);
}

/* Left Rail: Level 1 Departments */
.zpro-mm-rail {
    background-color: #f8fafc;
    border-right: 1px solid #e2e8f0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
    scrollbar-width: thin;
}

.zpro-mm-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 10px 12px 10px 14px;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #334155;
    font-size: 0.84375rem;
    font-weight: 600;
    line-height: 1.28;
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.zpro-mm-tab:hover {
    background-color: rgba(255, 255, 255, 0.8);
    color: #0f172a;
}

.zpro-mm-tab.is-active {
    background-color: #ffffff;
    color: #0f172a;
    font-weight: 700;
    border-color: rgba(204, 0, 0, 0.42);
    box-shadow: inset 3px 0 0 #cc0000, 0 4px 12px -4px rgba(15, 23, 42, 0.08);
}

.zpro-mm-tab:focus-visible {
    outline: 2px solid #cc0000;
    outline-offset: -2px;
}

.zpro-mm-tab-label {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: break-word;
}

.zpro-mm-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 9999px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.zpro-mm-tab.is-active .zpro-mm-count {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

/* Right Stage */
.zpro-mm-stage {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background-color: #ffffff;
    padding: 16px 20px 13px;
    gap: 14px;
}

.zpro-mm-panels-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
    scrollbar-width: thin;
}

.zpro-mm-panel {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.zpro-mm-panel.is-active:not([hidden]) {
    display: flex;
}

.zpro-mm-stage-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.zpro-mm-stage-title {
    font-size: 1.1875rem;
    font-weight: 800;
    line-height: 1.25;
    color: #0f172a;
    letter-spacing: -0.015em;
    text-decoration: none;
    transition: color 140ms ease;
}

.zpro-mm-stage-title:hover {
    color: #cc0000;
}

.zpro-mm-stage-viewall {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #cc0000;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 140ms ease;
}

.zpro-mm-stage-viewall:hover {
    color: #991b1b;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.zpro-mm-arrow-icon {
    width: 15px;
    height: 15px;
    transition: transform 150ms ease;
}

.zpro-mm-stage-viewall:hover .zpro-mm-arrow-icon {
    transform: translateX(3px);
}

/* Adaptive L2 Subcategory Grid */
.zpro-mm-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.zpro-mm-grid--n1 {
    grid-template-columns: repeat(1, minmax(0, 236px));
}

.zpro-mm-grid--n2 {
    grid-template-columns: repeat(2, minmax(0, 236px));
}

.zpro-mm-grid--n3 {
    grid-template-columns: repeat(3, minmax(0, 236px));
}

.zpro-mm-grid--n4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.zpro-mm-grid--n5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.zpro-mm-grid--n6 {
    grid-template-columns: repeat(3, minmax(0, 240px));
}

.zpro-mm-grid--n7,
.zpro-mm-grid--n8 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.zpro-mm-tile {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 150ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.zpro-mm-tile:hover {
    border-color: rgba(225, 29, 72, 0.65);
    box-shadow: 0 10px 22px -10px rgba(15, 23, 42, 0.16);
    transform: translateY(-2px);
}

.zpro-mm-tile:focus-visible,
.zpro-mm-stage-title:focus-visible,
.zpro-mm-stage-viewall:focus-visible,
.zpro-mm-brand-pill:focus-visible,
.zpro-mm-footer-link:focus-visible {
    outline: 2px solid #cc0000;
    outline-offset: 2px;
}

.zpro-mm-tile-stage {
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 118px;
    background-color: #ffffff;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.zpro-mm-tile-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 200ms ease;
}

.zpro-mm-tile:hover .zpro-mm-tile-stage img {
    transform: scale(1.04);
}

.zpro-mm-tile-fallback {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.zpro-mm-tile-fallback svg {
    width: 22px;
    height: 22px;
}

.zpro-mm-tile-foot {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    padding: 7px 9px;
    min-height: 46px;
    background-color: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.zpro-mm-tile-label {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.26;
    color: #0f172a;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    transition: color 140ms ease;
}

.zpro-mm-tile:hover .zpro-mm-tile-label {
    color: #cc0000;
}

.zpro-mm-tile-count {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.2;
    color: #475569;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 2px 7px;
    font-variant-numeric: tabular-nums;
}

.zpro-mm-empty {
    padding: 28px 16px;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
    background-color: #f8fafc;
    text-align: center;
}

.zpro-mm-empty-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 700;
    color: #cc0000;
    text-decoration: none;
}

/* Bottom Featured Brands Strip */
.zpro-mm-footer {
    flex-shrink: 0;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.zpro-mm-brands-label {
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #64748b;
    white-space: nowrap;
}

.zpro-mm-brands-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.zpro-mm-brand-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 7px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.zpro-mm-brand-pill:hover {
    border-color: #e11d48;
    color: #cc0000;
    background-color: #fff1f2;
}

.zpro-mm-footer-links {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.zpro-mm-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #475569;
    text-decoration: none;
    white-space: nowrap;
    transition: color 140ms ease;
}

.zpro-mm-footer-link:hover {
    color: #cc0000;
}

.zpro-mm-footer-link--catalog {
    color: #cc0000;
}

/* Compact Laptop / Tablet-Pro Breakpoints */
@media (max-width: 1279px) {
    .zpro-mm-surface {
        grid-template-columns: 248px minmax(0, 1fr);
    }

    .zpro-mm-stage {
        padding: 14px 16px 12px;
        gap: 12px;
    }

    .zpro-mm-grid--n5 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .zpro-mm-tile-stage {
        max-height: 102px;
    }
}

/* ==========================================================================
   Mobile & Tablet Catalog Slide-Over Drawer (360px - 1023px)
   ========================================================================== */
.zpro-mmd-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000005;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none;
}

.zpro-mmd-backdrop.is-open {
    display: block;
}

.zpro-mmd-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    height: 100dvh;
    z-index: 1000010;
    background-color: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.zpro-mmd-drawer.is-open {
    display: flex;
}

.zpro-mmd-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px 10px 16px;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    min-height: 58px;
}

.zpro-mmd-head-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.zpro-mmd-head-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background-color: #cc0000;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.zpro-mmd-head-icon svg {
    width: 16px;
    height: 16px;
}

.zpro-mmd-head-title {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}

.zpro-mmd-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.zpro-mmd-full-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 0.78125rem;
    font-weight: 700;
    color: #cc0000;
    text-decoration: none;
    white-space: nowrap;
}

.zpro-mmd-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #334155;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.zpro-mmd-close:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.zpro-mmd-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px calc(20px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.zpro-mmd-accordions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zpro-mmd-acc-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background-color: #ffffff;
    overflow: hidden;
}

.zpro-mmd-acc-btn {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background-color: #f8fafc;
    border: 0;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.3;
    color: #0f172a;
    cursor: pointer;
}

.zpro-mmd-acc-btn.is-open {
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    color: #cc0000;
}

.zpro-mmd-acc-title {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: break-word;
}

.zpro-mmd-acc-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.zpro-mmd-acc-chevron {
    width: 16px;
    height: 16px;
    color: #64748b;
    transition: transform 160ms ease;
}

.zpro-mmd-acc-btn.is-open .zpro-mmd-acc-chevron {
    transform: rotate(180deg);
    color: #cc0000;
}

.zpro-mmd-acc-panel {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #ffffff;
}

.zpro-mmd-acc-panel[hidden] {
    display: none !important;
}

.zpro-mmd-viewall {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 10px;
    background-color: #fff1f2;
    border: 1px solid #fecdd3;
    color: #cc0000;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
}

.zpro-mmd-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.zpro-mmd-tile {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 44px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background-color: #ffffff;
    overflow: hidden;
    text-decoration: none;
}

.zpro-mmd-tile-stage {
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #ffffff;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.zpro-mmd-tile-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.zpro-mmd-tile-foot {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 6px 7px;
    min-height: 44px;
    background-color: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.zpro-mmd-tile-label {
    font-size: 0.71875rem;
    font-weight: 700;
    line-height: 1.24;
    color: #0f172a;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.zpro-mmd-brands {
    border-top: 1px solid #e2e8f0;
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zpro-mmd-brands-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.zpro-mmd-brands-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.zpro-mmd-brand-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
}

@media (max-width: 1023px) {
    .zpro-mm-root,
    .zpro-mm-backdrop {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    .zpro-mmd-drawer,
    .zpro-mmd-backdrop {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zpro-mm-tab,
    .zpro-mm-tile,
    .zpro-mm-tile-stage img,
    .zpro-mm-arrow-icon,
    .zpro-mmd-acc-chevron,
    .zpro-mm-trigger-chevron {
        transition: none !important;
        transform: none !important;
    }
}

@media print {
    #zpro-catalog-megamenu,
    #zpro-megamenu-backdrop,
    #zpro-megamenu-drawer,
    #zpro-megamenu-drawer-backdrop {
        display: none !important;
    }
}
