/* Fonika Category Menu - Frontend Styles */

.fbn-cm-root {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    direction: rtl;
}

.fbn-cm-root.fbn-cm-open { display: block; }

.fbn-cm-backdrop {
    position: absolute;
    inset: 0;
    background: var(--fbn-cm-backdrop, rgba(14,22,51,.55));
    opacity: 0;
    transition: opacity .25s ease;
}
.fbn-cm-root.fbn-cm-open .fbn-cm-backdrop { opacity: 1; }

.fbn-cm-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    width: min(86vw, 380px);
    background: var(--fbn-cm-bg, #fff);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0,0,0,.25);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.22,.9,.34,1);
}

/* Position variants */
.fbn-cm-pos-right .fbn-cm-panel { right: 0; transform: translateX(100%); }
.fbn-cm-pos-right.fbn-cm-root.fbn-cm-open .fbn-cm-panel { transform: translateX(0); }

.fbn-cm-pos-left .fbn-cm-panel { left: 0; transform: translateX(-100%); }
.fbn-cm-pos-left.fbn-cm-root.fbn-cm-open .fbn-cm-panel { transform: translateX(0); }

.fbn-cm-pos-bottom .fbn-cm-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 82vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
}
.fbn-cm-pos-bottom.fbn-cm-root.fbn-cm-open .fbn-cm-panel { transform: translateY(0); }

.fbn-cm-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--fbn-cm-header-bg, #0e1633);
    color: var(--fbn-cm-header-text, #fff);
    flex-shrink: 0;
}
.fbn-cm-title { flex: 1; font-size: 15px; font-weight: 700; }
.fbn-cm-back, .fbn-cm-close {
    background: rgba(255,255,255,.12);
    border: none;
    color: inherit;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.fbn-cm-back svg, .fbn-cm-close svg { width: 16px; height: 16px; }

.fbn-cm-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ---------------- Drill-down list ---------------- */
.fbn-cm-panel-level {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    background: var(--fbn-cm-bg, #fff);
    animation: fbnCmSlideIn .28s ease;
}
@keyframes fbnCmSlideIn {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.fbn-cm-list { list-style: none; margin: 0; padding: 6px 0; }
.fbn-cm-row {
    border-bottom: 1px solid var(--fbn-cm-divider, #eee);
    position: relative;
}
.fbn-cm-drill-trigger,
.fbn-cm-leaf-link {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    text-align: right;
    padding: 14px 16px;
    font-size: 14.5px;
    color: var(--fbn-cm-item-text, #20242f);
    text-decoration: none;
    cursor: pointer;
    gap: 8px;
}
.fbn-cm-drill-trigger:active,
.fbn-cm-leaf-link:active { background: var(--fbn-cm-item-hover, #f6f7fb); }

.fbn-cm-name { flex: 1; }
.fbn-cm-count { color: #9a9fae; font-size: 12px; }
.fbn-cm-root:not(.fbn-cm-show-count) .fbn-cm-count { display: none; }
.fbn-cm-chevron { display: flex; color: #b7bbca; }
.fbn-cm-chevron svg { width: 16px; height: 16px; }

.fbn-cm-shortcut {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ---------------- Accordion ---------------- */
.fbn-cm-accordion-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.fbn-cm-depth-0 { padding: 4px 0; }
.fbn-cm-acc-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--fbn-cm-divider, #eee);
}
.fbn-cm-acc-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    text-decoration: none;
    color: var(--fbn-cm-item-text, #20242f);
    font-size: 14px;
}
.fbn-cm-depth-1 .fbn-cm-acc-link,
.fbn-cm-depth-1 .fbn-cm-acc-toggle { padding-right: 30px; }
.fbn-cm-depth-2 .fbn-cm-acc-link,
.fbn-cm-depth-2 .fbn-cm-acc-toggle { padding-right: 44px; }
.fbn-cm-depth-3 .fbn-cm-acc-link,
.fbn-cm-depth-3 .fbn-cm-acc-toggle { padding-right: 58px; }
.fbn-cm-acc-link:active { background: var(--fbn-cm-item-hover, #f6f7fb); }
.fbn-cm-acc-toggle {
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    color: #9a9fae;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.fbn-cm-acc-toggle svg { width: 16px; height: 16px; transition: transform .2s ease; }
.fbn-cm-acc-item.fbn-cm-expanded > .fbn-cm-acc-row .fbn-cm-acc-toggle svg { transform: rotate(180deg); color: var(--fbn-cm-active, #f2b705); }
.fbn-cm-acc-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    background: #fafbfc;
}
.fbn-cm-acc-item.fbn-cm-expanded > .fbn-cm-acc-children { max-height: 2000px; }

/* ---------------- Grid (root level) ---------------- */
.fbn-cm-grid-level { padding: 12px; overflow-y: auto; }
.fbn-cm-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.fbn-cm-card { border-radius: 12px; overflow: hidden; }
.fbn-cm-card-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    background: #fafbfc;
    border: 1px solid var(--fbn-cm-divider, #eee);
    border-radius: 12px;
    padding: 10px 8px 12px;
    text-decoration: none;
    cursor: pointer;
    color: var(--fbn-cm-item-text, #20242f);
    gap: 6px;
}
.fbn-cm-card-media {
    width: 100%;
    aspect-ratio: 1.3 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: #eef0f5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fbn-cm-card-media img { width: 100%; height: 100%; object-fit: cover; }
.fbn-cm-card-fallback {
    font-size: 22px;
    font-weight: 700;
    color: var(--fbn-cm-active, #f2b705);
}
.fbn-cm-card-name { font-size: 13.5px; font-weight: 600; text-align: center; }
.fbn-cm-card-btn .fbn-cm-count { font-size: 11px; }

/* Highlighted active accents reused from settings */
.fbn-cm-drill-trigger:hover .fbn-cm-name,
.fbn-cm-leaf-link:hover .fbn-cm-name { color: var(--fbn-cm-active, #f2b705); }

body.fbn-cm-locked { overflow: hidden; }
