/* Poznet Category Tree - Styled to match leftmenu sidebar block */

/* Base container - match leftmenu: border-radius, shadow, white bg */
.poznet-cattree-block {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Title block - dark gradient header matching leftmenu .title_block */
.poznet-cattree-title {
    background: linear-gradient(135deg, #060735 0%, #0a0d4a 100%);
    color: #ffffff;
    margin: 0;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 7px 7px 0 0;
}

/* Content container */
.poznet-cattree-content {
    padding: 0;
}

/* Lists */
.poznet-cattree-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.poznet-cattree-root {
    display: block !important;
}

/* Nested levels - subtle background differentiation */
.poznet-cattree-list .poznet-cattree-list {
    padding-left: 0;
    background: #f8f9fa;
    border-top: 1px solid #e5e5e5;
}

.poznet-cattree-list .poznet-cattree-list .poznet-cattree-list {
    background: #ffffff;
}

/* Items - separator lines */
.poznet-cattree-item {
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
}

.poznet-cattree-item:last-child {
    border-bottom: none;
}

/* Row layout */
.poznet-cattree-row {
    display: flex;
    align-items: center;
    padding: 0;
    transition: background-color 0.3s ease;
}

.poznet-cattree-row:hover {
    background-color: rgba(47, 181, 210, 0.08);
}

/* Toggle arrow */
.poznet-cattree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    margin-right: 2px;
}

.poznet-cattree-toggle::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent #999;
    transition: transform 0.3s ease;
}

.poznet-cattree-toggle-open::before,
.poznet-cattree-expanded > .poznet-cattree-row .poznet-cattree-toggle::before {
    transform: rotate(90deg);
    border-left-color: #2fb5d2;
}

.poznet-cattree-toggle-leaf {
    cursor: default;
}

.poznet-cattree-toggle-leaf::before {
    border-width: 3px 0 3px 5px;
    border-left-color: #ddd;
}

/* Links - match leftmenu sizing */
.poznet-cattree-link {
    display: block;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
    padding: 12px 10px 12px 0;
    transition: color 0.3s ease;
}

/* Root level padding - reduced indents */
.poznet-cattree-root > .poznet-cattree-item > .poznet-cattree-row {
    padding-left: 15px;
}

/* Level 2 */
.poznet-cattree-list .poznet-cattree-list > .poznet-cattree-item > .poznet-cattree-row {
    padding-left: 26px;
}

/* Level 3 */
.poznet-cattree-list .poznet-cattree-list .poznet-cattree-list > .poznet-cattree-item > .poznet-cattree-row {
    padding-left: 37px;
}

/* Level 4 */
.poznet-cattree-list .poznet-cattree-list .poznet-cattree-list .poznet-cattree-list > .poznet-cattree-item > .poznet-cattree-row {
    padding-left: 48px;
}

/* Deeper levels - smaller text */
.poznet-cattree-list .poznet-cattree-list .poznet-cattree-link {
    font-size: 13px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.poznet-cattree-list .poznet-cattree-list .poznet-cattree-list .poznet-cattree-link {
    font-size: 12px;
}

.poznet-cattree-link:hover {
    color: #2fb5d2;
    text-decoration: none;
}

/* Active category - INVERTED: dark bg + white text */
.poznet-cattree-active > .poznet-cattree-row {
    background: linear-gradient(135deg, #060735 0%, #0a0d4a 100%);
}

.poznet-cattree-active > .poznet-cattree-row .poznet-cattree-link {
    color: #ffffff;
    font-weight: 700;
}

.poznet-cattree-active > .poznet-cattree-row .poznet-cattree-toggle::before {
    border-left-color: #2fb5d2;
}

.poznet-cattree-active > .poznet-cattree-row .poznet-cattree-toggle-leaf::before {
    border-left-color: rgba(255, 255, 255, 0.3);
}

.poznet-cattree-active > .poznet-cattree-row:hover {
    background: linear-gradient(135deg, #0a0d4a 0%, #12165a 100%);
}

/* Categories in path - visible highlight */
.poznet-cattree-in-path > .poznet-cattree-row {
    background-color: rgba(47, 181, 210, 0.08);
    box-shadow: inset 3px 0 0 #2fb5d2;
}

.poznet-cattree-in-path > .poznet-cattree-row .poznet-cattree-link {
    font-weight: 600;
    color: #2fb5d2;
}

/* Override: active takes precedence over in-path */
.poznet-cattree-active.poznet-cattree-in-path > .poznet-cattree-row {
    background: linear-gradient(135deg, #060735 0%, #0a0d4a 100%);
    box-shadow: none;
}

.poznet-cattree-active.poznet-cattree-in-path > .poznet-cattree-row .poznet-cattree-link {
    color: #ffffff;
    font-weight: 700;
}

/* Expanded children visible */
.poznet-cattree-expanded > .poznet-cattree-list,
.poznet-cattree-in-path > .poznet-cattree-list {
    display: block !important;
}

/* Product count */
.poznet-cattree-count {
    font-size: 11px;
    color: #999;
    margin-left: 4px;
    flex-shrink: 0;
}

.poznet-cattree-active > .poznet-cattree-row .poznet-cattree-count {
    color: rgba(255, 255, 255, 0.6);
}

/* Expand animation */
.poznet-cattree-list .poznet-cattree-list {
    animation: cattreeSlideDown 0.3s ease-out;
}

@keyframes cattreeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================== */
/* Responsive - Mobile   */
/* ===================== */
@media (max-width: 767px) {
    .poznet-cattree-block {
        margin-bottom: 15px;
    }

    .poznet-cattree-title {
        padding: 12px 15px;
        font-size: 14px;
    }

    /* Bigger touch targets (44px min) */
    .poznet-cattree-row {
        min-height: 44px;
    }

    .poznet-cattree-link {
        padding: 10px 10px 10px 0;
        font-size: 14px;
    }

    .poznet-cattree-toggle {
        width: 28px;
        height: 28px;
    }

    /* Reduce indent on mobile */
    .poznet-cattree-root > .poznet-cattree-item > .poznet-cattree-row {
        padding-left: 12px;
    }

    .poznet-cattree-list .poznet-cattree-list > .poznet-cattree-item > .poznet-cattree-row {
        padding-left: 22px;
    }

    .poznet-cattree-list .poznet-cattree-list .poznet-cattree-list > .poznet-cattree-item > .poznet-cattree-row {
        padding-left: 32px;
    }
}

/* ===================== */
/* Responsive - Tablet   */
/* ===================== */
@media (min-width: 768px) and (max-width: 991px) {
    .poznet-cattree-link {
        font-size: 13px;
        padding: 10px 10px 10px 0;
    }

    .poznet-cattree-root > .poznet-cattree-item > .poznet-cattree-row {
        padding-left: 12px;
    }
}
