/* ==========================================================
   Afette Çocuk – Header / Menü (boydan boya mavi header)
   Porto'nun menü sınıflarından bağımsızdır (ac- önekli).
   Yol: wwwroot/css/navbar.css  (custom.css'ten SONRA)
   ========================================================== */

:root {
    /* Mavi tonları – koyudan açığa */
    --ac-900: #04294a;
    --ac-800: #053d6b;
    --ac-700: #0661a0;
    --ac-600: #0782cf;
    --ac-500: #099cf4; /* sitenin ana mavisi */
    --ac-400: #3fb3f7;
    --ac-300: #86d0fa;
    --ac-200: #c3e8fd;
    --ac-100: #e7f5fe;
    --ac-50: #f4faff;
    --ac-header-h: 96px;
    --ac-header-h-small: 72px;
}

/* ---------- Header: boydan boya mavi ---------- */
#header.ac-header {
    position: sticky !important;
    top: 0;
    z-index: 1030;
    min-height: 0 !important;
    height: auto !important;
    background: linear-gradient(90deg, var(--ac-800) 0%, var(--ac-700) 30%, var(--ac-600) 65%, var(--ac-500) 100%);
    box-shadow: 0 10px 30px -18px rgba(4, 41, 74, .7);
    transition: box-shadow .25s ease;
}

    /* Header üzerinde çok hafif ışık dokusu */
    #header.ac-header::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background: radial-gradient(600px 160px at 85% -40%, rgba(255, 255, 255, .22), transparent 70%), radial-gradient(400px 120px at 10% 140%, rgba(134, 208, 250, .18), transparent 70%);
    }

    #header.ac-header.is-scrolled {
        box-shadow: 0 12px 28px -14px rgba(4, 41, 74, .75);
    }

.ac-header-inner {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 24px;
    max-width: 1320px;
    height: var(--ac-header-h);
    margin: 0 auto;
    padding: 0 20px;
    transition: height .25s ease;
}

#header.ac-header.is-scrolled .ac-header-inner {
    height: var(--ac-header-h-small);
}

/* ---------- Logo: beyaz kart üzerinde ---------- */
.ac-logo {
    flex: 0 0 auto;
    align-self: center;
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 20px -10px rgba(4, 41, 74, .6);
    transition: padding .25s ease, transform .2s ease;
}

    .ac-logo:hover {
        transform: translateY(-1px);
    }

    .ac-logo img,
    #header .layout_logo {
        height: 70px;
        width: auto;
        transition: height .25s ease;
    }

#header.ac-header.is-scrolled .ac-logo {
    padding: 4px 10px;
}

    #header.ac-header.is-scrolled .ac-logo img {
        height: 50px;
    }

/* ---------- Ortak sıfırlama (özgüllük 0) ---------- */
#header :where(.ac-nav ul, .ac-nav li) {
    list-style: none;
    margin: 0;
    padding: 0;
}

#header :where(.ac-nav a) {
    text-decoration: none;
}

#header :where(.ac-nav button) {
    font: inherit;
    border: 0;
    background: none;
    cursor: pointer;
}

.ac-nav {
    display: flex;
    align-items: center;
    font-family: 'Poppins', Arial, sans-serif;
}

.ac-nav-toggle,
.ac-sub-toggle,
#header .ac-indicator {
    display: none;
}

/* ==========================================================
   MASAÜSTÜ
   ========================================================== */
@media (min-width: 992px) {

    #header .ac-nav {
        align-self: stretch;
    }

    #header .ac-menu {
        position: relative;
        display: flex;
        flex-wrap: nowrap;
        align-items: stretch;
        height: 100%;
    }

    /* Header'ın alt kenarında kayan beyaz çizgi */
    #header .ac-indicator {
        display: block;
        position: absolute;
        left: 0;
        bottom: 0;
        width: 0;
        height: 4px;
        border-radius: 4px 4px 0 0;
        background: #fff;
        box-shadow: 0 -2px 12px rgba(255, 255, 255, .55);
        opacity: 0;
        pointer-events: none;
        transition: transform .35s cubic-bezier(.3, .7, .2, 1), width .35s cubic-bezier(.3, .7, .2, 1), opacity .2s ease;
    }

        #header .ac-indicator.is-visible {
            opacity: 1;
        }

    #header .ac-item {
        position: relative;
        display: flex;
        align-items: stretch;
        flex: 0 0 auto;
    }

    /* 1. seviye link: kutusuz, tam yükseklik */
    #header .ac-link {
        position: relative;
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 0 15px;
        color: rgba(255, 255, 255, .86);
        font-size: 12.5px;
        font-weight: 600;
        letter-spacing: .02em;
        line-height: 1.2;
        white-space: nowrap;
        transition: color .2s ease, background-color .2s ease;
    }

    #header .ac-has-sub > .ac-link::after {
        content: "";
        width: 6px;
        height: 6px;
        margin-top: -3px;
        border-right: 1.6px solid currentColor;
        border-bottom: 1.6px solid currentColor;
        opacity: .75;
        transform: rotate(45deg);
        transition: transform .2s ease, margin .2s ease;
    }

    #header .ac-item:hover > .ac-link,
    #header .ac-item:focus-within > .ac-link,
    #header .ac-link.active {
        color: #fff;
    }

    #header .ac-item:hover > .ac-link,
    #header .ac-item:focus-within > .ac-link {
        background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, .10) 100%);
    }

    #header .ac-has-sub:hover > .ac-link::after,
    #header .ac-has-sub:focus-within > .ac-link::after {
        transform: rotate(-135deg);
        margin-top: 3px;
    }

    /* JS çalışmazsa aktif ve hover için sabit çizgi */
    #header .ac-menu:not(.js-indicator) .ac-link.active,
    #header .ac-menu:not(.js-indicator) .ac-item:hover > .ac-link {
        box-shadow: inset 0 -4px 0 #fff;
    }

    #header .ac-nav a:focus-visible {
        outline: 2px solid #fff;
        outline-offset: -4px;
        border-radius: 8px;
    }

    #header .ac-sub a:focus-visible {
        outline-color: var(--ac-500);
        outline-offset: 2px;
    }

    /* --- Dropdown paneli: header'ın altına yapışık --- */
    #header .ac-sub {
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 20;
        min-width: 250px;
        width: max-content;
        max-width: 340px;
        padding: 10px 8px 8px;
        background: #fff;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 26px 50px -20px rgba(4, 41, 74, .5);
        opacity: 0;
        visibility: hidden;
        transform: translateY(6px);
        transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
    }

    #header .ac-has-sub:hover > .ac-sub,
    #header .ac-has-sub:focus-within > .ac-sub {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        transition: opacity .2s ease, transform .2s ease, visibility 0s;
    }

    /* Alt menü öğeleri */
    #header .ac-sub-item {
        position: relative;
    }

    #header .ac-sub-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 9px 12px;
        border-radius: 10px;
        color: var(--ac-900);
        font-size: 13px;
        font-weight: 500;
        line-height: 1.35;
        transition: background-color .15s ease, color .15s ease;
    }

        #header .ac-sub-link::before {
            content: "";
            flex: 0 0 auto;
            width: 8px;
            height: 8px;
            border-radius: 3px;
            background: var(--ac-200);
            transition: background-color .15s ease, transform .2s ease;
        }

    #header .ac-sub-item:hover > .ac-sub-link,
    #header .ac-sub-item:focus-within > .ac-sub-link {
        color: var(--ac-700);
        background: var(--ac-100);
    }

        #header .ac-sub-item:hover > .ac-sub-link::before,
        #header .ac-sub-item:focus-within > .ac-sub-link::before {
            background: var(--ac-500);
            transform: rotate(45deg);
        }

    #header .ac-sub-item.ac-has-sub > .ac-sub-link::after {
        content: "";
        flex: 0 0 auto;
        margin-left: auto;
        width: 6px;
        height: 6px;
        border-right: 1.6px solid currentColor;
        border-top: 1.6px solid currentColor;
        transform: rotate(45deg);
        opacity: .45;
        transition: transform .15s ease, opacity .15s ease;
    }

    #header .ac-sub-item.ac-has-sub:hover > .ac-sub-link::after {
        opacity: 1;
        transform: translateX(2px) rotate(45deg);
    }

    /* --- Yana açılan (3. ve 4. seviye) --- */
    #header .ac-sub .ac-sub {
        top: -10px;
        left: calc(100% + 10px);
        padding: 8px;
        border-radius: 16px;
        transform: translateX(8px);
        background: var(--ac-50);
        box-shadow: 0 24px 50px -20px rgba(4, 41, 74, .45), inset 3px 0 0 var(--ac-400), 0 0 0 1px rgba(6, 97, 160, .08);
    }

        #header .ac-sub .ac-sub .ac-sub-item:hover > .ac-sub-link {
            background: var(--ac-200);
            color: var(--ac-800);
        }

        /* Yana geçerken kapanmasın */
        #header .ac-sub .ac-sub::before {
            content: "";
            position: absolute;
            top: 0;
            bottom: 0;
            left: -16px;
            width: 16px;
        }

    #header .ac-sub .ac-has-sub:hover > .ac-sub,
    #header .ac-sub .ac-has-sub:focus-within > .ac-sub {
        transform: translateX(0);
    }

    /* Sağdaki menüler sola açılsın */
    #header .ac-item--end > .ac-sub {
        left: auto;
        right: 0;
    }

    #header .ac-item--end .ac-sub .ac-sub {
        left: auto;
        right: calc(100% + 10px);
        transform: translateX(-8px);
        box-shadow: 0 24px 50px -20px rgba(4, 41, 74, .45), inset -3px 0 0 var(--ac-400), 0 0 0 1px rgba(6, 97, 160, .08);
    }

        #header .ac-item--end .ac-sub .ac-sub::before {
            left: auto;
            right: -16px;
        }
}

/* Dar masaüstü: menü tek satırda kalsın */
@media (min-width: 992px) and (max-width: 1239px) {
    .ac-header-inner {
        gap: 10px;
        padding: 0 12px;
    }

    .ac-logo {
        padding: 5px 8px;
    }

        .ac-logo img, #header .layout_logo {
            height: 56px;
        }

    #header .ac-link {
        font-size: 11px;
        padding: 0 9px;
        gap: 4px;
    }
}

/* ==========================================================
   MOBİL / TABLET
   ========================================================== */
@media (max-width: 991px) {

    .ac-header-inner {
        height: 78px;
        padding: 0 16px;
        align-items: center;
    }

    #header.ac-header.is-scrolled .ac-header-inner {
        height: 66px;
    }

    .ac-logo {
        padding: 5px 9px;
        border-radius: 14px;
    }

        .ac-logo img, #header .layout_logo {
            height: 54px;
        }

    #header.ac-header.is-scrolled .ac-logo img {
        height: 44px;
    }

    /* Hamburger */
    #header .ac-nav-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 48px;
        height: 48px;
        padding: 0 13px;
        border-radius: 14px;
        background: rgba(255, 255, 255, .16);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
    }

        #header .ac-nav-toggle span {
            display: block;
            height: 2.5px;
            border-radius: 2px;
            background: #fff;
            transition: transform .25s ease, opacity .2s ease;
        }

            #header .ac-nav-toggle span:nth-child(2) {
                width: 70%;
            }

    #header .ac-nav.is-open .ac-nav-toggle {
        background: #fff;
    }

        #header .ac-nav.is-open .ac-nav-toggle span {
            background: var(--ac-700);
        }

            #header .ac-nav.is-open .ac-nav-toggle span:nth-child(1) {
                transform: translateY(7.5px) rotate(45deg);
            }

            #header .ac-nav.is-open .ac-nav-toggle span:nth-child(2) {
                opacity: 0;
            }

            #header .ac-nav.is-open .ac-nav-toggle span:nth-child(3) {
                transform: translateY(-7.5px) rotate(-45deg);
            }

    /* Panel: header'ın devamı gibi, bir ton koyu */
    #header .ac-menu {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        max-height: calc(100vh - 90px);
        overflow-y: auto;
        padding: 6px 16px 20px;
        background: var(--ac-700);
        border-top: 1px solid rgba(255, 255, 255, .14);
        box-shadow: 0 24px 32px -20px rgba(4, 41, 74, .6);
    }

    #header .ac-nav.is-open .ac-menu {
        display: block;
    }

    #header .ac-item,
    #header .ac-sub-item {
        position: relative;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    #header .ac-item {
        border-bottom: 1px solid rgba(255, 255, 255, .12);
    }

    #header .ac-menu > .ac-item:last-child,
    #header .ac-menu > .ac-item:has(+ .ac-indicator) {
        border-bottom: 0;
    }

    #header .ac-link,
    #header .ac-sub-link {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 4px;
        color: rgba(255, 255, 255, .9);
        font-size: 13px;
        font-weight: 600;
        line-height: 1.35;
    }

        /* Aktif: solda beyaz çizgi */
        #header .ac-link.active {
            color: #fff;
            padding-left: 14px;
            box-shadow: inset 4px 0 0 #fff;
        }

    #header .ac-sub-link {
        padding: 10px 8px;
        font-weight: 500;
        color: var(--ac-100);
    }

        #header .ac-sub-link::before {
            content: "";
            flex: 0 0 auto;
            width: 7px;
            height: 7px;
            border-radius: 2px;
            background: var(--ac-300);
        }

    /* Alt menü aç/kapa oku */
    #header .ac-sub-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 40px;
        height: 40px;
        border-radius: 12px;
        color: #fff;
    }

        #header .ac-sub-toggle::before {
            content: "";
            width: 7px;
            height: 7px;
            margin-top: -3px;
            border-right: 2px solid currentColor;
            border-bottom: 2px solid currentColor;
            transform: rotate(45deg);
            transition: transform .2s ease;
        }

    #header .is-open > .ac-sub-toggle {
        background: rgba(255, 255, 255, .15);
    }

        #header .is-open > .ac-sub-toggle::before {
            transform: rotate(-135deg);
            margin-top: 3px;
        }

    #header .ac-sub {
        display: none;
        flex: 0 0 100%;
        margin: 0 0 12px;
        padding: 4px 8px;
        border-radius: 12px;
        background: var(--ac-800);
    }

        #header .ac-sub .ac-sub {
            flex-basis: calc(100% - 14px);
            margin: 0 0 6px 14px;
            background: var(--ac-900);
        }

    #header .is-open > .ac-sub {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    #header *, #header::before {
        transition: none !important;
    }
}
