/**
 * AJIT Floating Menu - front CSS (rev r1)
 * Kolory przez zmienne CSS ustawiane inline z konfiguracji menu.
 */

/* ---------- pasek ---------- */
.ajitfm-bar {
    position: fixed;
    z-index: 1030;
    background: var(--ajitfm-bg, #fff);
    color: var(--ajitfm-text, #222);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease;
    margin: 0;
}

.ajitfm-place-bottom {
    left: 0;
    right: 0;
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.ajitfm-place-top {
    left: 0;
    right: 0;
    top: 0;
}

.ajitfm-place-left,
.ajitfm-place-right {
    top: 50%;
    transform: translateY(-50%);
    border-radius: 10px;
    max-height: 86vh;
    overflow-y: auto;
}

.ajitfm-place-left { left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ajitfm-place-right { right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* stan ukryty (smart / after_scroll) */
.ajitfm-place-bottom.ajitfm-hidden { transform: translateY(110%); }
.ajitfm-place-top.ajitfm-hidden { transform: translateY(-110%); }
.ajitfm-place-left.ajitfm-hidden { transform: translateY(-50%) translateX(-110%); }
.ajitfm-place-right.ajitfm-hidden { transform: translateY(-50%) translateX(110%); }

/* ---------- pozycje ---------- */
.ajitfm-items {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ajitfm-place-left .ajitfm-items,
.ajitfm-place-right .ajitfm-items {
    flex-direction: column;
}

.ajitfm-item { flex: 1 1 0; min-width: 0; }

.ajitfm-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    padding: 8px 6px;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    font-size: 11px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ajitfm-btn:hover,
.ajitfm-btn:focus,
.ajitfm-btn[aria-expanded="true"] {
    color: var(--ajitfm-accent, #e8590c);
    text-decoration: none;
    outline: none;
}

.ajitfm-icon {
    position: relative;
    display: inline-flex;
    width: 24px;
    height: 24px;
}

.ajitfm-svg { width: 24px; height: 24px; display: block; }
.ajitfm-icon svg { width: 24px; height: 24px; }
.ajitfm-fallback { font-size: 18px; line-height: 24px; }

.ajitfm-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ajitfm-nolabels .ajitfm-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- badge ---------- */
.ajitfm-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--ajitfm-accent, #e8590c);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.ajitfm-badge-empty { display: none; }

/* ---------- overlay ---------- */
.ajitfm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1031;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ajitfm-overlay.ajitfm-open { opacity: 1; }

/* ---------- panele ---------- */
.ajitfm-panel {
    position: fixed;
    z-index: 1032;
    background: var(--ajitfm-bg, #fff);
    color: var(--ajitfm-text, #222);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.ajitfm-panel-from-bottom {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 75vh;
    border-radius: 14px 14px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    transform: translateY(100%);
}

.ajitfm-panel-from-top {
    left: 0;
    right: 0;
    top: 0;
    max-height: 75vh;
    border-radius: 0 0 14px 14px;
    transform: translateY(-100%);
}

.ajitfm-panel-from-left,
.ajitfm-panel-from-right {
    top: 0;
    bottom: 0;
    width: min(86vw, 360px);
}

.ajitfm-panel-from-left { left: 0; transform: translateX(-100%); }
.ajitfm-panel-from-right { right: 0; transform: translateX(100%); }

.ajitfm-panel.ajitfm-open { transform: none; }

.ajitfm-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex: 0 0 auto;
}

.ajitfm-panel-title { font-weight: 700; font-size: 15px; }

.ajitfm-panel-close {
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
}

.ajitfm-panel-body {
    padding: 12px 16px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---------- drzewko kategorii ---------- */
.ajitfm-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ajitfm-cat-item { border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.ajitfm-cat-level-1 .ajitfm-cat-item,
.ajitfm-cat-level-2 .ajitfm-cat-item { border-bottom: 0; }

.ajitfm-cat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ajitfm-cat-row a {
    flex: 1 1 auto;
    padding: 11px 4px;
    color: inherit;
    text-decoration: none;
    font-size: 14px;
}

.ajitfm-cat-row a:hover { color: var(--ajitfm-accent, #e8590c); }

.ajitfm-cat-toggle {
    flex: 0 0 auto;
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    padding: 8px 10px;
    display: inline-flex;
    transition: transform 0.2s ease;
}

.ajitfm-cat-toggle svg { width: 18px; height: 18px; }
.ajitfm-cat-toggle[aria-expanded="true"] { transform: rotate(180deg); }

.ajitfm-cat-sub { padding-left: 14px; }

/* ---------- szukajka ---------- */
.ajitfm-search-form { display: flex; gap: 8px; }

.ajitfm-search-input {
    flex: 1 1 auto;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 16px; /* 16px zapobiega zoomowi iOS */
}

.ajitfm-search-submit {
    flex: 0 0 auto;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--ajitfm-accent, #e8590c);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

/* gdy aktywny panel — blokada scrolla body (klasa nadawana przez JS) */
body.ajitfm-noscroll { overflow: hidden; }
