/**
 * Sade Mobil Menü Stilleri V28
 * header.php HTML yapısıyla uyumlu: .ap-mobile-menu, .ap-mobile-nav, .ap-mobile-backdrop
 */

/* --- VARSAYILAN: Masaüstünde Gizle --- */
.ap-mobile-menu,
.ap-mobile-backdrop {
    /* functions.php inline CSS zaten kontrol ediyor, burada fallback */
}

/* Hamburger Butonu (Header içinde) - hem ap-hamburger hem ap-burger */
.ap-hamburger,
.ap-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 1001;
    color: var(--nav-text, #152C52);
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.ap-hamburger svg,
.ap-burger svg {
    width: 28px;
    height: 28px;
}

/* --- MOBİL GÖRÜNÜM (1023px altı) --- */
@media screen and (max-width: 1023px) {

    /* 1. Masaüstü Menüyü Gizle */
    .ap-nav.main-navigation,
    .header-actions {
        display: none !important;
    }

    .ap-hamburger,
    .ap-burger {
        display: flex;
    }

    /* 2. Mobil Menü Drawer - sağdan açılan beyaz panel */
    .ap-mobile-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: min(420px, 90vw);
        height: 100vh;
        height: 100dvh;
        /* Modern browsers */
        background: #ffffff;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        z-index: 1000001;
        padding: 24px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
    }

    body.ap-menu-open .ap-mobile-menu {
        transform: translateX(0);
    }

    /* 3. Backdrop */
    .ap-mobile-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 1000000;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body.ap-menu-open .ap-mobile-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.ap-menu-open {
        overflow: hidden;
    }

    /* 4. Menü Üst Kısım (Logo ve Kapat) */
    .ap-mobile-top {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 15px;
        margin-bottom: 30px;
        width: 100%;
    }

    .ap-mobile-logo {
        margin: 0;
    }

    .ap-mobile-logo img {
        height: 45px;
        width: auto;
    }

    .ap-mobile-close {
        margin-left: auto;
        width: 44px;
        height: 44px;
        border: 0;
        background: transparent;
        font-size: 28px;
        color: #152C52;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: color 0.2s;
        -webkit-tap-highlight-color: transparent;
    }

    .ap-mobile-close:hover {
        color: #3a7bd5;
    }

    /* 5. Menü Navigasyonu */
    .ap-mobile-nav,
    .ap-mobile-nav ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .ap-mobile-nav>li>a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 5px;
        text-decoration: none;
        color: #152C52;
        font-size: 19px;
        font-weight: 700;
        border-bottom: 1px solid rgba(21, 44, 82, 0.08);
        transition: all 0.2s ease;
    }

    .ap-mobile-nav>li>a:hover {
        color: #3a7bd5;
        padding-left: 10px;
    }

    /* Dropdown Ok İşaretleri */
    .ap-mobile-nav li.menu-item-has-children>a:after {
        content: "▾";
        font-size: 18px;
        transition: transform 0.3s ease;
        opacity: 0.6;
    }

    .ap-mobile-nav li.menu-item-has-children.ap-submenu-open>a:after {
        transform: rotate(180deg);
        color: #3a7bd5;
        opacity: 1;
    }

    /* Alt Menü */
    .ap-mobile-nav li ul {
        display: none;
        background: rgba(21, 44, 82, 0.02);
        border-left: 3px solid #3a7bd5;
        margin-left: 8px;
    }

    .ap-mobile-nav li.ap-submenu-open>ul {
        display: block;
        animation: apSubMenuSlide 0.25s ease-out;
    }

    @keyframes apSubMenuSlide {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .ap-mobile-nav li ul a {
        padding: 12px 25px;
        font-weight: 600;
        font-size: 16px;
        color: #152C52;
        border-bottom: 1px solid rgba(21, 44, 82, 0.04);
        text-decoration: none;
        display: block;
        transition: all 0.2s ease;
    }

    .ap-mobile-nav li ul a:hover {
        color: #3a7bd5;
        padding-left: 30px;
    }

    .ap-mobile-nav li ul a:before {
        content: "—";
        margin-right: 10px;
        opacity: 0.3;
    }

    /* 6. Bağış CTA Butonu */
    .ap-mobile-cta {
        display: block !important;
        margin-top: auto;
        padding: 14px 24px;
        background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
        color: #ffffff !important;
        text-align: center;
        text-decoration: none !important;
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        border-radius: 12px;
        min-height: 50px;
        line-height: 50px;
        padding: 0 24px;
        box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
        transition: all 0.3s ease;
    }

    .ap-mobile-cta:hover,
    .ap-mobile-cta:active {
        background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
    }

    /* 7. Menü Footer / Aksiyonlar */
    .ap-mobile-actions {
        margin-top: auto;
        padding-top: 24px;
        border-top: 1px solid rgba(21, 44, 82, 0.08);
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .ap-mobile-actions .btn {
        display: block;
        width: 100%;
        text-align: center;
        padding: 12px;
        border-radius: 8px;
        font-weight: 600;
        text-decoration: none;
        font-size: 15px;
        transition: all 0.2s;
    }

    .ap-mobile-actions .btn-primary {
        background: #1e3a8a;
        color: #fff;
    }

    .ap-mobile-actions .btn-danger {
        background: #dc2626;
        color: #fff;
        box-shadow: 0 2px 5px rgba(220, 38, 38, 0.3);
    }
}