/* ==========================================================================
   DLASER CATALOG MENU COMPONENT
   ========================================================================== */

/* ==========================================================================
   DESKTOP CATALOG MENU (>= 1025px)
   ========================================================================== */
@media (min-width: 1025px) {
    /* Hide offcanvas drawer on desktop completely so desktop list gets full 100% width */
    .header__nav .offcanvas,
    .offcanvas,
    .dlaser-mobile-drilldown-wrap,
    .dlaser-drill-screen {
        display: none;
    }

    /* Desktop menu list takes 100% full width */
    nav.header__nav .dlaser-desktop-list,
    .header .header__list.dlaser-desktop-list {
        display: flex;
        width: 100%;
        flex: 1 1 100%;
        justify-content: space-between;
    }

    .header__item.dlaser-catalog-trigger {
        position: relative;
    }

    /* Left Dropdown (Vertical list of all 1st level categories) */
    .header .header__dropdown.dlaser-categories-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        width: 480px;
        min-width: 480px;
        background-color: #ffffff;
        box-shadow: 0 20px 45px rgba(2, 53, 75, 0.14);
        border: 1px solid #e3edf4;
        border-radius: 0 0 12px 12px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                    visibility 0.25s ease;
        z-index: 999;
        pointer-events: none;
        padding: 10px 0;
        margin: 0;
        list-style: none;
    }

    /* Bridge to avoid losing hover between trigger and dropdown */
    .header .header__dropdown.dlaser-categories-dropdown:before {
        content: '';
        position: absolute;
        top: -15px;
        left: 0;
        right: 0;
        height: 15px;
        background: transparent;
        z-index: 10;
    }

    /* В закрытом состоянии меню и все его потомки полностью игнорируют курсор */
    .header .header__dropdown.dlaser-categories-dropdown,
    .header .header__dropdown.dlaser-categories-dropdown *,
    .header .header__dropdown.dlaser-categories-dropdown:before {
        pointer-events: none;
    }

    /* Меню активируется ТОЛЬКО при наведении непосредственно на пункт меню КАТАЛОГ */
    .header__item.dlaser-catalog-trigger:hover > .dlaser-categories-dropdown,
    .header__item.dlaser-catalog-trigger.active-hover > .dlaser-categories-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
        display: block;
    }

    .header__item.dlaser-catalog-trigger:hover > .dlaser-categories-dropdown *,
    .header__item.dlaser-catalog-trigger.active-hover > .dlaser-categories-dropdown *,
    .header__item.dlaser-catalog-trigger:hover > .dlaser-categories-dropdown:before,
    .header__item.dlaser-catalog-trigger.active-hover > .dlaser-categories-dropdown:before {
        pointer-events: auto;
    }

    /* Category Items in Left Dropdown (Высокая специфичность против bootstrap input-group) */
    .header nav.header__nav ul.header__list.input-group li.header__item ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item,
    .header ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item,
    .dlaser-cat-item {
        position: static;
        margin: 3px 8px;
        padding: 0;
        border-radius: 8px;
        transition: background-color 0.18s ease;
        list-style: none;
    }

    .header nav.header__nav ul.header__list.input-group li.header__item ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item a.dlaser-cat-link,
    .header ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item a.dlaser-cat-link {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        padding: 8px 14px;
        gap: 14px;
        min-height: 54px;
        color: #1e293b;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.35;
        text-decoration: none;
        border-radius: 8px;
        transition: color 0.18s ease, background-color 0.18s ease;
    }

    .dlaser-cat-thumb {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 8px;
        background-color: #f8fafc;
        border: 1px solid #dce8f1;
        flex-shrink: 0;
        align-self: center;
        overflow: hidden;
        padding: 3px;
    }

    .dlaser-cat-thumb img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .dlaser-cat-thumb--empty {
        background-color: #e8f0f6;
    }

    .dlaser-cat-text {
        flex: 1 1 auto;
        min-width: 0;
        display: block;
        white-space: normal;
        word-wrap: break-word;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.35;
        color: #1e293b;
        text-align: left;
        align-self: center;
    }

    .dlaser-cat-arrow {
        color: #94a3b8;
        width: 14px;
        height: 14px;
        min-width: 14px;
        margin-left: auto;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        align-self: center;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .header nav.header__nav ul.header__list.input-group li.header__item ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item:hover,
    .header nav.header__nav ul.header__list.input-group li.header__item ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item.active,
    .header ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item:hover,
    .header ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item.active,
    .dlaser-cat-item:hover,
    .dlaser-cat-item.active {
        background-color: #e5f1fa;
    }

    .header nav.header__nav ul.header__list.input-group li.header__item ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item:hover a.dlaser-cat-link,
    .header nav.header__nav ul.header__list.input-group li.header__item ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item.active a.dlaser-cat-link,
    .header ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item:hover a.dlaser-cat-link,
    .header ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item.active a.dlaser-cat-link {
        color: #02354B;
        text-decoration: none;
    }

    .header nav.header__nav ul.header__list.input-group li.header__item ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item:hover .dlaser-cat-arrow,
    .header nav.header__nav ul.header__list.input-group li.header__item ul.header__dropdown.dlaser-categories-dropdown li.dlaser-cat-item.active .dlaser-cat-arrow,
    .dlaser-cat-item:hover .dlaser-cat-arrow,
    .dlaser-cat-item.active .dlaser-cat-arrow {
        color: #02354B;
        transform: translateX(3px);
    }

    /* --- RIGHT FLYOUT WINDOW --- */
    .dlaser-cat-flyout {
        position: absolute;
        top: 0;
        left: 100%;
        width: 740px;
        height: 100%;
        min-height: 520px;
        background-color: #ffffff;
        box-shadow: 15px 20px 45px rgba(2, 53, 75, 0.14);
        border: 1px solid #e3edf4;
        border-left: 1px solid #eef3f7;
        border-radius: 0 12px 12px 0;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.18s ease, visibility 0.18s ease;
        z-index: 1000;
    }

    /* Invisible bridge to prevent mouse leaving hover between category row and flyout */
    .dlaser-cat-flyout:before {
        content: '';
        position: absolute;
        top: 0;
        left: -15px;
        width: 15px;
        height: 100%;
        background: transparent;
        z-index: 10;
    }

    .dlaser-cat-item:hover > .dlaser-cat-flyout,
    .dlaser-cat-item.active > .dlaser-cat-flyout {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .dlaser-cat-flyout__inner {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        height: 100%;
        padding: 24px 28px;
        gap: 24px;
    }

    /* Subsections List (Left / Center of Flyout) */
    .dlaser-flyout-subs {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-width: 0;
    }

    .dlaser-flyout-head {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding-bottom: 10px;
        margin-bottom: 12px;
        border-bottom: 1px solid #eef3f7;
        flex-shrink: 0;
    }

    .dlaser-flyout-head__all {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        font-weight: 600;
        color: #4AA0AF;
        text-decoration: none;
        white-space: nowrap;
        transition: color 0.2s ease;
    }

    .dlaser-flyout-head__all:hover {
        color: #02354B;
        text-decoration: none;
    }

    /* Scrollable Area for Subsections with Custom Scrollbar */
    .dlaser-flyout-scroll {
        flex-grow: 1;
        overflow-y: auto;
        overflow-x: hidden;
        max-height: 440px;
        padding-right: 10px;
        scrollbar-width: thin;
        scrollbar-color: #cbdbe6 #f1f5f9;
    }

    .dlaser-flyout-scroll::-webkit-scrollbar {
        width: 6px;
    }

    .dlaser-flyout-scroll::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 8px;
    }

    .dlaser-flyout-scroll::-webkit-scrollbar-thumb {
        background: #cbdbe6;
        border-radius: 8px;
        transition: background-color 0.2s ease;
    }

    .dlaser-flyout-scroll::-webkit-scrollbar-thumb:hover {
        background: #9abfd7;
    }

    /* 1-Column List of Subsections */
    .dlaser-flyout-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .dlaser-flyout-group {
        display: flex;
        flex-direction: column;
    }

    .dlaser-flyout-group__title {
        font-size: 14px;
        font-weight: 600;
        color: #1e293b;
        padding: 8px 12px;
        border-radius: 8px;
        background-color: #f8fbfe;
        border: 1px solid #eef3f7;
        text-decoration: none;
        line-height: 1.35;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: all 0.18s ease;
    }

    .dlaser-flyout-group__title:hover {
        background-color: #e5f1fa;
        border-color: #cce2f4;
        color: #02354B;
        text-decoration: none;
    }

    .dlaser-flyout-group__count {
        font-size: 11px;
        font-weight: 700;
        color: #64748b;
        background-color: #ffffff;
        padding: 1px 7px;
        border-radius: 10px;
        border: 1px solid #e2e8f0;
        flex-shrink: 0;
        margin-left: 8px;
    }

    .dlaser-flyout-group__list {
        list-style: none;
        padding: 6px 0 8px 28px;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .header nav.header__nav ul.header__list.input-group li.header__item ul.header__dropdown.dlaser-categories-dropdown .dlaser-flyout-group__list li,
    .header ul.header__dropdown.dlaser-categories-dropdown .dlaser-flyout-group__list li {
        padding: 0;
        margin: 0;
    }

    .dlaser-flyout-group__list a {
        font-size: 13px;
        color: #475569;
        text-decoration: none;
        line-height: 1.35;
        padding: 2px 0;
        display: inline-block;
        transition: color 0.15s ease, padding-left 0.15s ease;
    }

    .dlaser-flyout-group__list a:hover {
        color: #02354B;
        padding-left: 4px;
        text-decoration: none;
    }

    .dlaser-flyout-empty {
        padding: 40px 15px;
        text-align: center;
        color: #64748b;
        font-size: 14px;
    }

    .dlaser-flyout-empty p {
        margin-bottom: 14px;
    }

    /* Popular Product Block (СПРАВА в окне подразделов) */
    .dlaser-flyout-pop {
        flex: 0 0 250px;
        width: 250px;
        display: flex;
        flex-direction: column;
        border-left: 1px solid #eef3f7;
        padding-left: 20px;
        flex-shrink: 0;
    }

    .dlaser-flyout-pop__title {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #7b94a6;
        margin-bottom: 12px;
    }

    .dlaser-pop-item {
        display: flex;
        flex-direction: column;
        width: 100%;
        background-color: #ffffff;
        border: 1px solid #d8e6f1;
        border-radius: 12px;
        padding: 14px;
        position: relative;
        overflow: hidden;
        transition: border-color 0.25s ease, box-shadow 0.25s ease;
    }

    .dlaser-pop-item:hover {
        border-color: #bcd5e8;
        box-shadow: 0 8px 20px rgba(2, 53, 75, 0.08);
    }

    .dlaser-pop-item__badges {
        position: absolute;
        top: 10px;
        left: 10px;
        display: flex;
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
        z-index: 5;
        pointer-events: none;
    }

    .dlaser-badge {
        font-size: 11px;
        font-weight: 700;
        line-height: 1;
        padding: 4px 8px;
        border-radius: 4px;
        letter-spacing: 0.3px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    }

    .dlaser-badge.badge-hit {
        background-color: #02354B;
        color: #ffffff;
    }

    .dlaser-badge.badge-new {
        background-color: #BEDBE5;
        color: #02354B;
    }

    .dlaser-badge.badge-sale {
        background-color: #4AA0AF;
        color: #ffffff;
    }

    .dlaser-pop-item__img-link {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 160px;
        width: 100%;
        margin-bottom: 10px;
        overflow: hidden;
        text-decoration: none;
        background-color: #f8fbfe;
        border-radius: 8px;
        padding: 6px;
    }

    .dlaser-pop-item__img-link img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        transition: transform 0.35s ease;
    }

    .dlaser-pop-item:hover .dlaser-pop-item__img-link img {
        transform: scale(1.05);
    }

    .dlaser-pop-item__details {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        justify-content: space-between;
    }

    .dlaser-pop-item__name {
        font-size: 13px;
        font-weight: 700;
        color: #02354B;
        line-height: 1.35;
        margin-bottom: 8px;
        text-decoration: none;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        transition: color 0.2s ease;
    }

    .dlaser-pop-item__name:hover {
        color: #4AA0AF;
        text-decoration: none;
    }

    .dlaser-pop-item__price {
        font-size: 15px;
        font-weight: 800;
        color: #02354B;
        margin-bottom: 10px;
    }

    .dlaser-pop-item__btn {
        display: block;
        width: 100%;
        text-align: center;
        font-size: 13px;
        font-weight: 600;
        color: #ffffff;
        background-color: #02354B;
        padding: 8px 12px;
        border-radius: 6px;
        text-decoration: none;
        transition: background-color 0.2s ease;
    }

    .dlaser-pop-item__btn:hover {
        background-color: #4AA0AF;
        color: #ffffff;
        text-decoration: none;
    }

    .dlaser-pop-item--empty {
        justify-content: center;
        align-items: center;
        text-align: center;
        background-color: #f8fafc;
    }
}

/* ==========================================================================
   MOBILE DRILL-DOWN NAVIGATION (<= 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
    /* Hide desktop list and dropdown on mobile */
    .header__nav .dlaser-desktop-list,
    .dlaser-desktop-list,
    .dlaser-categories-dropdown {
        display: none;
    }

    /* Wrap inside offcanvas takes full height and flex layout */
    .dlaser-mobile-drilldown-wrap {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    /* Reset blue tap highlight */
    .offcanvas,
    .offcanvas * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        outline: none;
    }

    .dlaser-drill-track {
        display: flex;
        width: 100%;
        height: 100%;
        position: relative;
        overflow: hidden;
    }

    .dlaser-drill-screen {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #ffffff;
        display: flex;
        flex-direction: column;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        visibility: hidden;
        overflow: hidden;
    }

    .dlaser-drill-screen.active {
        transform: translateX(0);
        visibility: visible;
        z-index: 2;
    }

    .dlaser-drill-screen.slide-left {
        transform: translateX(-30%);
        visibility: hidden;
        z-index: 1;
    }

    /* Header for nested drilldown screens */
    .dlaser-drill-header {
        padding: 10px 0 16px 0;
        margin-bottom: 12px;
        border-bottom: 1px solid #eef2f6;
        display: flex;
        flex-direction: column;
        gap: 16px;
        flex-shrink: 0;
    }

    .dlaser-drill-back-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: none;
        border: none;
        padding: 0;
        font-size: 13px;
        font-weight: 600;
        color: #02354B;
        cursor: pointer;
    }

    .dlaser-drill-heading {
        font-size: 17px;
        font-weight: 700;
        color: #02354B;
        line-height: 1.3;
    }

    /* Scrollable body in each screen */
    .dlaser-drill-body {
        flex: 1 1 auto;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 5px 0 25px 0;
    }

    /* Screen 0 Main Mobile Menu */
    .dlaser-mobile-main-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
    }

    .dlaser-mobile-main-item {
        border-bottom: 1px solid #f1f5f9;
    }

    .dlaser-mobile-main-item:last-child {
        border-bottom: none;
    }

    .dlaser-mobile-main-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 0;
        font-size: 18px;
        font-weight: 700;
        text-transform: uppercase;
        color: #252525;
        text-decoration: none;
        cursor: pointer;
        letter-spacing: 0.3px;
        transition: color 0.15s ease;
    }

    .dlaser-mobile-main-link:hover,
    .dlaser-mobile-main-link:active,
    .dlaser-mobile-main-item.active .dlaser-mobile-main-link {
        color: #4AA0AF;
        text-decoration: none;
    }

    .dlaser-mobile-main-arrow {
        color: #94a3b8;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .dlaser-mobile-main-link:active .dlaser-mobile-main-arrow {
        color: #4AA0AF;
        transform: translateX(3px);
    }

    /* Categories List in Nested Screens */
    .dlaser-mobile-cat-items {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .dlaser-mobile-cat-entry {
        border-radius: 0;
        overflow: hidden;
        border-bottom: 1px solid #f1f5f9;
    }

    .dlaser-mobile-cat-entry:last-child {
        border-bottom: none;
    }

    .dlaser-mobile-cat-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 4px;
        background-color: transparent;
        border: none;
        border-radius: 8px;
        color: #02354B;
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .dlaser-mobile-cat-row:active {
        background-color: #f1f7fc;
        text-decoration: none;
        color: #4AA0AF;
    }

    .dlaser-mobile-cat-left-side {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-grow: 1;
        min-width: 0;
    }

    .dlaser-mobile-cat-pic {
        width: 48px;
        height: 48px;
        min-width: 48px;
        border-radius: 8px;
        background-color: #f8fafc;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        flex-shrink: 0;
        padding: 3px;
    }

    .dlaser-mobile-cat-pic img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .dlaser-mobile-cat-pic--empty {
        background-color: #edf2f7;
    }

    .dlaser-mobile-cat-name {
        font-size: 14px;
        font-weight: 600;
        color: #02354B;
        line-height: 1.35;
    }

    .dlaser-mobile-cat-row:active .dlaser-mobile-cat-name {
        color: #4AA0AF;
    }

    .dlaser-mobile-menu-arrow {
        color: #94a3b8;
        flex-shrink: 0;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .dlaser-mobile-cat-row:active .dlaser-mobile-menu-arrow {
        color: #4AA0AF;
        transform: translateX(3px);
    }

    .dlaser-mobile-action-bar {
        margin-bottom: 10px;
    }

    .dlaser-mobile-all-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 12px;
        background: linear-gradient(135deg, #02354B 0%, #034b6a 100%);
        color: #ffffff;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 700;
        text-decoration: none;
    }

    .dlaser-mobile-all-btn:active {
        opacity: 0.9;
        text-decoration: none;
        color: #ffffff;
    }

    /* Socials & User Panel directly under menu */
    .dlaser-mobile-bottom-section {
        margin-top: 24px;
        padding-top: 18px;
        border-top: 1px solid #eef2f6;
        display: flex;
        flex-direction: column;
    }

    .dlaser-mobile-bottom-section .btn.btn-square {
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .dlaser-mobile-bottom-section .personal-i,
    .dlaser-mobile-lk-btn {
        display: flex;
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 10px;
        background-image: url(/local/templates/dlaser/assets/img/icons/user-i.svg);
        background-position: center;
        background-repeat: no-repeat;
        background-size: 20px;
    }
}
