/**
 * WPBakery Posts/Terms Menu Styles
 */

.enym-posts-terms-menu {
    width: 100%;
    box-sizing: border-box;
    --enym-ptm-gap: 8px;
}

.enym-posts-terms-menu *,
.enym-posts-terms-menu *::before,
.enym-posts-terms-menu *::after {
    box-sizing: border-box;
}

/* Base List Structure */
.enym-posts-terms-menu .enym-ptm-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--enym-ptm-gap, 8px);
}

/* UL / OL semantic styling when not in collapsible mode */
.enym-posts-terms-menu.enym-ptm-mode-ul ul.enym-ptm-list {
    list-style-type: disc;
    padding-left: 1.4rem;
}

.enym-posts-terms-menu.enym-ptm-mode-ol ol.enym-ptm-list {
    list-style-type: decimal;
    padding-left: 1.5rem;
}

/* Item Structure */
.enym-posts-terms-menu .enym-ptm-item {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: inherit;
}

.enym-posts-terms-menu .enym-ptm-item-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.enym-posts-terms-menu .enym-ptm-item-inner:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

/* Item Link & Title */
.enym-posts-terms-menu .enym-ptm-link {
    display: inline-flex;
    align-items: center;
    flex: 1 1 auto;
    text-decoration: none;
    color: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.enym-posts-terms-menu .enym-ptm-link:hover {
    color: #2271b1;
}

/* Active / Current State */
.enym-posts-terms-menu .enym-ptm-item.enym-ptm-current > .enym-ptm-item-inner {
    background-color: rgba(34, 113, 177, 0.08);
}

.enym-posts-terms-menu .enym-ptm-item.enym-ptm-current > .enym-ptm-item-inner .enym-ptm-link {
    color: #2271b1;
    font-weight: 600;
}

.enym-posts-terms-menu .enym-ptm-item.enym-ptm-current-ancestor > .enym-ptm-item-inner .enym-ptm-link {
    font-weight: 600;
}

/* Subtitle below Title */
.enym-posts-terms-menu .enym-ptm-subtitle {
    display: block;
    font-size: 13px;
    line-height: 1.4;
    color: #666;
    margin-top: 2px;
    padding-left: 10px;
    word-break: break-word;
}

/* Toggle Button for Collapsible Mode */
.enym-posts-terms-menu .enym-ptm-toggle {
    background: transparent;
    border: none;
    padding: 4px 6px;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #666;
    border-radius: 4px;
    outline: none;
    line-height: 1;
    transition: transform 0.25s ease, background-color 0.2s ease, color 0.2s ease;
}

.enym-posts-terms-menu .enym-ptm-toggle:hover,
.enym-posts-terms-menu .enym-ptm-toggle:focus {
    color: #111;
    background-color: rgba(0, 0, 0, 0.08);
}

.enym-posts-terms-menu .enym-ptm-chevron {
    display: block;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.enym-posts-terms-menu .enym-ptm-item.enym-ptm-expanded > .enym-ptm-item-inner .enym-ptm-chevron {
    transform: rotate(180deg);
}

/* Nested Submenu Wrapper */
.enym-posts-terms-menu .enym-ptm-sub-wrapper {
    margin-top: var(--enym-ptm-gap, 8px);
    margin-left: 8px;
    padding-left: 16px;
    border-left: 2px solid rgba(0, 0, 0, 0.08);
}

/* In non-collapsible modes, ensure sub-wrapper is always block */
.enym-posts-terms-menu:not(.enym-ptm-mode-collapsible) .enym-ptm-sub-wrapper {
    display: block !important;
}

/* Empty / Not Found Message */
.enym-posts-terms-menu .enym-ptm-not-found {
    padding: 12px 14px;
    color: #666;
    font-size: 14px;
    font-style: italic;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
}

/* Media (Icon/Image) Prepend */
.enym-posts-terms-menu .enym-ptm-media {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-inline-end: 8px;
    line-height: 1;
    width: var(--enym-ptm-icon-size, 18px);
    height: var(--enym-ptm-icon-size, 18px);
    color: var(--enym-ptm-icon-color, inherit);
}

.enym-posts-terms-menu .enym-ptm-media svg,
.enym-posts-terms-menu .enym-ptm-media .wpex-icon svg {
    width: var(--enym-ptm-icon-size, 18px);
    height: var(--enym-ptm-icon-size, 18px);
    max-width: 100%;
    max-height: 100%;
    fill: currentColor;
    display: block;
}

.enym-posts-terms-menu .enym-ptm-media i {
    font-size: var(--enym-ptm-icon-size, 18px);
    line-height: 1;
    color: inherit;
}

.enym-posts-terms-menu .enym-ptm-media img,
.enym-posts-terms-menu .enym-ptm-media .enym-ptm-thumb {
    width: var(--enym-ptm-icon-size, 18px);
    height: var(--enym-ptm-icon-size, 18px);
    object-fit: cover;
    border-radius: 3px;
    display: block;
}
