/* Mobil alt navigasyon — yalnızca ≤1024px
 * Yüzen kapsül bar + 3D ikonlar + yukarı taşan Anasayfa butonu.
 * İçerik (slotlar, etiketler, ikonlar) admin → Menü Ayarları → Mobil Alt Menü'den gelir. */

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 1024px) {
    :root {
        /* bar yüksekliği (64px) + alt boşluk (10px): sayfa alt padding'leri bunu kullanır */
        --mobile-nav-height: 74px;
        --mobile-nav-bar-height: 64px;
        --mobile-nav-gap: 10px;
    }

    .mobile-bottom-nav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        left: var(--mobile-nav-gap);
        right: var(--mobile-nav-gap);
        /* bottom'u main.js (visualViewport) inline verir; kenar boşluğu margin ile eklenir */
        bottom: 0;
        margin: 0 0 calc(var(--mobile-nav-gap) + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: calc(100vw - (var(--mobile-nav-gap) * 2));
        z-index: 1200;
        height: var(--mobile-nav-bar-height);
        min-height: var(--mobile-nav-bar-height);
        padding: 0 4px;
        background-color: var(--surface-800);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 18px;
        box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.75);
        box-sizing: border-box;
        overflow: visible;
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        isolation: isolate;
        pointer-events: auto;
        visibility: visible;
        opacity: 1;
        transition:
            transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.28s ease,
            visibility 0s linear 0s;
    }

    button.mobile-nav__item {
        border: none;
        background: none;
        font-family: inherit;
        cursor: pointer;
        -webkit-appearance: none;
        appearance: none;
    }

    body.sidebar-open .mobile-bottom-nav,
    body.chat-open .mobile-bottom-nav {
        transform: translate3d(0, calc(100% + var(--mobile-nav-gap) + env(safe-area-inset-bottom, 0px) + 24px), 0);
        -webkit-transform: translate3d(0, calc(100% + var(--mobile-nav-gap) + env(safe-area-inset-bottom, 0px) + 24px), 0);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition:
            transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.28s ease,
            visibility 0s linear 0.32s;
    }

    /* eski tam genişlik arka plan / gölge katmanları artık kapsülün kendisinde */
    .mobile-bottom-nav::before,
    .mobile-bottom-nav::after {
        display: none;
    }

    .mobile-nav__item {
        position: relative;
        z-index: 1;
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 0;
        height: 100%;
        padding: 0;
        color: var(--text-gray);
        text-decoration: none;
        font-size: 10.5px;
        font-weight: 600;
        line-height: 1;
        text-align: center;
        background: none;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.2s ease;
    }

    .mobile-nav__ico {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 28px;
        border-radius: 9px;
        transition: background 0.2s ease, transform 0.15s ease;
    }

    .mobile-nav__ico img {
        display: block;
        width: 26px;
        height: 26px;
        object-fit: contain;
        pointer-events: none;
    }

    /* 3D görseli olmayan sayfalar için Phosphor yedeği */
    .mobile-nav__ico i {
        font-size: 22px;
        line-height: 1;
        color: var(--text-gray);
        transition: color 0.2s ease;
    }

    .mobile-nav__label {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-nav__item:active .mobile-nav__ico {
        transform: scale(0.9);
    }

    .mobile-nav__item:hover,
    .mobile-nav__item:focus-visible {
        color: var(--text-secondary);
        outline: none;
    }

    /* aktif sayfa: ikon kutusu hafif tema rengi + üstte ince çizgi */
    .mobile-nav__item.is-active {
        color: var(--text-primary, #f2f2f2);
        background: none;
    }

    /* aktif ışık: köşeli kutu değil, ikonun arkasında yumuşak yuvarlak parıltı */
    .mobile-nav__ico {
        position: relative;
    }

    .mobile-nav__ico img,
    .mobile-nav__ico i {
        position: relative;
        z-index: 1;
    }

    .mobile-nav__item.is-active .mobile-nav__ico::before {
        content: '';
        position: absolute;
        left: 50%;
        top: 50%;
        width: 44px;
        height: 44px;
        margin: -22px 0 0 -22px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(var(--primary), 0.38) 0%, rgba(var(--primary), 0.14) 45%, transparent 72%);
        pointer-events: none;
    }

    .mobile-nav__item--home.is-active .mobile-nav__ico::before {
        display: none;
    }

    .mobile-nav__item.is-active .mobile-nav__ico i {
        color: var(--brand-red);
    }

    .mobile-nav__item.is-active::after {
        content: '';
        position: absolute;
        top: 0;
        left: 30%;
        right: 30%;
        height: 2px;
        border-radius: 0 0 2px 2px;
        background: var(--brand-red);
    }

    /* Anasayfa: ortada yukarı taşan buton */
    .mobile-nav__item--home {
        justify-content: flex-end;
        padding-bottom: 9px;
        color: var(--text-primary, #f2f2f2);
    }

    .mobile-nav__item--home::after {
        display: none;
    }

    .mobile-nav__item--home .mobile-nav__ico {
        position: absolute;
        top: -18px;
        left: 50%;
        width: 54px;
        height: 54px;
        margin-left: -27px;
        border-radius: 17px;
        background: linear-gradient(180deg, rgba(var(--primary), 0.34) 0%, rgba(var(--primary), 0.12) 100%), var(--surface-900);
        border: 1px solid rgba(var(--primary), 0.55);
        box-shadow: 0 0 0 5px var(--surface-800), 0 6px 18px rgba(var(--primary), 0.35);
        box-sizing: border-box;
    }

    .mobile-nav__item--home.is-active .mobile-nav__ico {
        background: linear-gradient(180deg, rgba(var(--primary), 0.5) 0%, rgba(var(--primary), 0.2) 100%), var(--surface-900);
    }

    .mobile-nav__item--home .mobile-nav__ico img {
        width: 34px;
        height: 34px;
    }

    .mobile-nav__item--home .mobile-nav__ico i {
        font-size: 28px;
        color: var(--brand-red);
    }
}

@media (min-width: 1025px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}
