/**
 * HoReCa Mega Menu Styles v2
 */

/* Скрываем на мобильных (< 1025px) */
@media (max-width: 1024px) {
    .horeca-mega-wrapper {
        display: none !important;
    }
}

/* ==================== WRAPPER ==================== */
.horeca-mega-wrapper {
    position: relative;
    display: inline-block;
    z-index: 100000;
}

/* ==================== OVERLAY ==================== */
.horeca-mega-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99998;
    pointer-events: none;
}

.horeca-mega-wrapper.active .horeca-mega-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ==================== TRIGGER BUTTON ==================== */
.horeca-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    z-index: 100001;
}

.horeca-trigger-btn:focus {
    outline: none;
}

.horeca-trigger-btn svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.horeca-mega-wrapper.active .horeca-trigger-btn svg {
    transform: rotate(180deg);
}

.horeca-trigger-btn .icon-before,
.horeca-trigger-btn .icon-after {
    display: inline-flex;
    align-items: center;
}

/* ==================== DROPDOWN ==================== */
.horeca-mega-dropdown {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    opacity: 0;
    visibility: hidden;
    z-index: 99999;
    transition: all 0.3s ease;
    pointer-events: none;
}

.horeca-mega-wrapper.active .horeca-mega-dropdown {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ==================== INNER LAYOUT ==================== */
.horeca-mega-inner {
    display: flex;
    align-items: stretch;
}

/* ==================== LEVEL 1 COLUMN ==================== */
.horeca-level1-col {
    flex-shrink: 0;
    border-right: 1px solid #eee;
    padding-right: 15px;
    margin-right: 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 70vh;
    overflow-y: auto;
}

.horeca-level1-col::-webkit-scrollbar {
    width: 4px;
}

.horeca-level1-col::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.horeca-level1-col::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ==================== LEVEL 1 ITEM ==================== */
.horeca-level1-item {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.horeca-level1-item:hover,
.horeca-level1-item:focus {
    text-decoration: none;
}

.horeca-level1-icon {
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 6px;
}

.horeca-level1-name {
    flex-grow: 1;
}

/* ==================== RIGHT AREA ==================== */
.horeca-right-area {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.horeca-category-panel {
    display: none;
    flex-direction: column;
    height: 100%;
}

.horeca-category-panel.active {
    display: flex;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== SUBCATEGORIES GRID ==================== */
.horeca-subcategories-grid {
    column-gap: 25px;
    flex-grow: 0;
}

.horeca-subcategories-grid.columns-2 {
    column-count: 2;
}

.horeca-subcategories-grid.columns-3 {
    column-count: 3;
}

.horeca-subcategories-grid.columns-4 {
    column-count: 4;
}

/* ==================== LEVEL 2 ==================== */
.horeca-level2-group {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 12px;
}

.horeca-level2-item {
    display: block;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
    margin-bottom: 4px;
    line-height: 1.3;
}

.horeca-level2-item:hover {
    text-decoration: none;
}

/* ==================== LEVEL 3 ==================== */
.horeca-level3-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.horeca-level3-item {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 400;
    line-height: 1.3;
}

.horeca-level3-item:hover {
    text-decoration: none;
}

.level3-marker {
    opacity: 0.5;
    font-size: 0.9em;
}

/* ==================== PROMO BANNER ==================== */
.horeca-promo-banner {
    margin-top: 20px;
    flex-shrink: 0;
}

.horeca-promo-banner img {
    width: 100%;
    display: block;
}

.horeca-promo-banner a {
    display: block;
    transition: opacity 0.2s ease;
}

.horeca-promo-banner a:hover {
    opacity: 0.9;
}

/* ==================== PRODUCTS SECTION ==================== */
.horeca-products-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.horeca-products-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 5px;
}

.horeca-products-list::-webkit-scrollbar {
    height: 4px;
}

.horeca-products-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.horeca-products-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ==================== PRODUCT CARD ==================== */
.horeca-product-card {
    flex: 0 0 140px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    padding: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.horeca-product-card:hover {
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.horeca-product-image {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
}

.horeca-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.horeca-product-title {
    font-size: 12px;
    line-height: 1.3;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.horeca-product-price {
    font-size: 13px;
    font-weight: 600;
    margin-top: auto;
}

.horeca-product-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 5px 10px;
    background: #17a2b8;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    text-align: center;
    transition: background 0.2s ease;
}

.horeca-product-card:hover .horeca-product-btn {
    background: #138496;
}

/* ==================== NO SUBCATS ==================== */
.horeca-no-subcats {
    color: #999;
    font-style: italic;
    padding: 20px 0;
}

/* ==================== ELEMENTOR EDITOR ==================== */
.elementor-editor-active .horeca-mega-dropdown {
    position: relative;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    left: 0;
    margin-top: 10px;
}

.elementor-editor-active .horeca-mega-overlay {
    display: none;
}
