/* Mobile Bottom Bar — CSS */

/* Bar — only on mobile */
.mbb-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mbb-height, 64px);
    background: var(--mbb-bg, #6e0931);
    z-index: var(--mbb-z, 9999);
    flex-direction: row;
    align-items: stretch;
    justify-content: space-around;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.18);
    padding: 0;
    margin: 0;
}

/* Bar visibility controlled via PHP-injected media query */

/* Bar items */
.mbb-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 4px;
    color: var(--mbb-icon-color, #fff);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 4px;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s ease, transform 0.15s ease;
    position: relative;
    font-family: inherit;
}

.mbb-item:hover,
.mbb-item:focus {
    opacity: 0.85;
    outline: none;
}

.mbb-item:active {
    transform: scale(0.93);
}

/* Active state for menu toggle */
.mbb-menu-toggle.is-active .mbb-icon svg line:nth-child(1) {
    transform-origin: center;
}

/* Ripple effect */
.mbb-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.12);
    opacity: 0;
    border-radius: 4px;
    transition: opacity 0.2s;
}
.mbb-item:active::after { opacity: 1; }

/* Icon */
.mbb-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--mbb-icon-size, 24px);
    height: var(--mbb-icon-size, 24px);
    flex-shrink: 0;
}

.mbb-icon svg {
    width: 100%;
    height: 100%;
    color: var(--mbb-icon-color, #fff);
}

/* Hamburger animation */
.mbb-menu-toggle .mbb-icon svg line {
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: 12px 12px;
}

.mbb-menu-toggle.is-active .mbb-icon svg line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.mbb-menu-toggle.is-active .mbb-icon svg line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.mbb-menu-toggle.is-active .mbb-icon svg line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Label */
.mbb-label {
    font-size: var(--mbb-font-size, 11px);
    color: var(--mbb-label-color, #fff);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* Separator between items */
.mbb-bar .mbb-item + .mbb-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 1px;
    background: rgba(255,255,255,0.15);
}

/* ——— Overlay ——— */
.mbb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--mbb-overlay-bg, rgba(0,0,0,0.5));
    z-index: calc(var(--mbb-z, 9999) - 1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mbb-overlay.is-visible {
    display: block;
}
.mbb-overlay.is-active {
    opacity: 1;
}

/* ——— Menu Panel ——— */
.mbb-menu-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--mbb-height, 64px);
    background: var(--mbb-menu-bg, #fff);
    z-index: var(--mbb-z, 9999);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.15);
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    -webkit-overflow-scrolling: touch;
}

.mbb-menu-panel[aria-hidden="false"] {
    transform: translateY(0);
}

/* Fade animation variant */
.mbb-anim-fade .mbb-menu-panel {
    transform: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.mbb-anim-fade .mbb-menu-panel[aria-hidden="false"] {
    opacity: 1;
}

/* Drag handle */
.mbb-menu-panel::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(0,0,0,0.15);
    border-radius: 2px;
    margin: 12px auto 0;
}

/* Menu header */
.mbb-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
}

.mbb-menu-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--mbb-menu-text, #1a1a1a);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.5;
}

.mbb-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.06);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--mbb-menu-text, #1a1a1a);
    padding: 0;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.mbb-close-btn:hover { background: rgba(0,0,0,0.1); }
.mbb-close-btn svg { width: 16px; height: 16px; }

/* Menu body */
.mbb-menu-body {
    padding: 8px 0 24px;
}

/* Nav list */
.mbb-menu-panel .mbb-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mbb-menu-panel .mbb-nav-list li {
    margin: 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.mbb-menu-panel .mbb-nav-list li:last-child {
    border-bottom: none;
}

.mbb-menu-panel .mbb-nav-list a {
    display: block;
    padding: 14px 20px;
    color: var(--mbb-menu-text, #1a1a1a);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.15s;
}

.mbb-menu-panel .mbb-nav-list a:hover,
.mbb-menu-panel .mbb-nav-list a:focus {
    background: rgba(0,0,0,0.04);
}

.mbb-menu-panel .mbb-nav-list a:active {
    background: rgba(0,0,0,0.08);
}

/* Current item */
.mbb-menu-panel .mbb-nav-list .current-menu-item > a,
.mbb-menu-panel .mbb-nav-list .current-page-ancestor > a {
    color: var(--mbb-bg, #6e0931);
    font-weight: 600;
}

/* Sub-menu */
.mbb-menu-panel .mbb-nav-list .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(0,0,0,0.02);
}

.mbb-menu-panel .mbb-nav-list .sub-menu a {
    padding-left: 36px;
    font-size: 14px;
    font-weight: 400;
    opacity: 0.8;
}

/* No menu notice */
.mbb-no-menu {
    padding: 20px;
    color: #666;
    font-size: 14px;
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mbb-bar {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--mbb-height, 64px) + env(safe-area-inset-bottom));
    }
}

/* ——— Dismiss button (× inside bar) ——— */
.mbb-dismiss-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 4px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--mbb-icon-color, #fff);
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.mbb-dismiss-btn:hover { opacity: 1; background: rgba(255,255,255,0.25); }
.mbb-dismiss-btn svg { width: 11px; height: 11px; }

/* ——— Bar hidden state ——— */
.mbb-bar--hidden {
    transform: translateY(100%) !important;
    pointer-events: none;
}

/* When bar is dismissed, also hide panel and overlay */
body.mbb-dismissed .mbb-menu-panel,
body.mbb-dismissed .mbb-overlay {
    display: none !important;
}

/* ——— Restore tab (alumine vasak nurk) ——— */
.mbb-restore-btn {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    transform: none;
    width: 36px;
    height: 28px;
    background: var(--mbb-bg, #6e0931);
    color: var(--mbb-icon-color, #fff);
    border: none;
    border-radius: 0 10px 0 0;
    cursor: pointer;
    box-shadow: 2px -2px 10px rgba(0,0,0,0.2);
    z-index: var(--mbb-z, 9999);
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: width 0.2s ease, height 0.2s ease, box-shadow 0.2s ease;
}
.mbb-restore-btn:hover,
.mbb-restore-btn:focus {
    width: 44px;
    height: 34px;
    box-shadow: 3px -3px 14px rgba(0,0,0,0.3);
    outline: none;
}
.mbb-restore-btn svg {
    width: 14px;
    height: 14px;
    transform: rotate(-90deg);
    flex-shrink: 0;
}

/* Restore tab — visible when bar is dismissed (mobiilis) */
.mbb-restore-btn--visible {
    display: flex !important;
}
