/* =========================================
   YENİ HEADER TASARIMI (SURFER SEO STYLE)
   ========================================= */

/* Dış Kapsayıcı (Sticky Davranışı ve Konumlandırma) */
.floating-header-wrapper {
    position: -webkit-sticky; /* Safari */
    position: sticky;
    top: 40px; 
    margin-top: 40px; 
    
    /* Z-Index: Header her zaman en üstte */
    z-index: 10001; 
    
    display: flex;
    justify-content: center;
    width: 100%;
    pointer-events: none; /* Boşluklara tıklanabilsin */
    padding: 0 1rem;
}

/* Admin Bar Fix (Desktop) */
.admin-bar .floating-header-wrapper {
    top: 72px;
}

/* Header Hapı (Görsel Tasarım - Desktop Varsayılanı) */
.floating-pill {
    position: relative; 
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 24px;
    padding: 0.5rem 1.5rem;
    
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.05), 
        0 4px 6px -2px rgba(0, 0, 0, 0.02);
    
    display: inline-flex;
    align-items: center;
    gap: 2rem;
    
    width: auto;
    max-width: 100%;
    
    /* Geçiş efektleri */
    transition: border-radius 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.floating-pill:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Logo - En Üstte Görünürlük Ayarı */
.site-branding {
    position: relative;
    z-index: 10005; /* Menü açıldığında üstte kalsın */
}

.header-logo {
    display: block;
    max-height: 40px;
    width: auto;
}

/* Hamburger Menü Butonu */
.menu-toggle {
    display: none; /* Varsayılan gizli (masaüstü için) */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-direction: column;
    gap: 5px;
    position: relative; 
    z-index: 10005; /* Logo ile aynı seviyede en üstte */
    width: 30px;
    height: 24px;
    justify-content: center;
    align-items: center;
}

.menu-toggle .bar {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--clr-secondary);
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

/* X İKONU ANİMASYONU */
.menu-toggle.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* =========================================
   MENÜ YAPISI (GENEL)
   ========================================= */

.main-navigation > ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* =========================================
   MASAÜSTÜ GÖRÜNÜM (1024px ve Üzeri)
   ========================================= */
@media (min-width: 1024px) {
    /* Hover Efekti için Hap Şekli Değişimi */
    .floating-pill:has(.menu-item-has-children:hover),
    .floating-pill:has(.menu-item-has-children:focus-within) {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        border-bottom: 1px solid transparent;
        background: rgba(255, 255, 255, 1);
        box-shadow: none;
    }

    /* Menü Hizalaması */
    .main-navigation > ul {
        gap: 0.5rem;
        align-items: center;
    }

    .main-navigation > ul > li {
        position: static; 
        height: 100%; 
    }

    /* Ana Menü Linkleri */
    .main-navigation > ul > li > a {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--clr-text);
        text-decoration: none;
        padding: 0.6rem 1.2rem;
        display: flex; 
        align-items: center;
        gap: 6px; 
        border-radius: 99px;
        transition: all 0.2s ease;
        position: relative; 
        z-index: 2; 
    }

    .main-navigation > ul > li:hover > a,
    .main-navigation > ul > li:focus-within > a {
        background-color: var(--clr-surface); 
        color: var(--clr-primary);
    }

    /* Ok İşareti */
    .menu-item-has-children > a::after {
        content: '';
        display: block;
        width: 6px;
        height: 6px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        margin-top: -3px; 
        transition: transform 0.3s ease;
    }

    .menu-item-has-children:hover > a::after,
    .menu-item-has-children:focus-within > a::after {
        transform: rotate(225deg);
        margin-top: 3px;
    }

    /* SUB-MENU (STANDART DROPDOWN) */
    .main-navigation ul.sub-menu {
        display: none;
        position: absolute;
        top: 100%; 
        left: 0;
        width: 100%; 
        background: rgba(255, 255, 255, 1);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(226, 232, 240, 0.8);
        border-top: none; 
        border-radius: 0 0 24px 24px; 
        padding: 2rem;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
        z-index: -1; 
    }

    /* Görünmez Köprü */
    .main-navigation ul.sub-menu::before {
        content: '';
        position: absolute;
        top: -30px; 
        left: 0;
        width: 100%;
        height: 30px; 
        background: transparent; 
        z-index: 1;
    }

    /* Hover Durumu: GÖSTER */
    .main-navigation li:hover > ul.sub-menu,
    .main-navigation li:focus-within > ul.sub-menu {
        display: grid; 
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
        animation: slideDownFade 0.3s ease forwards;
    }

    /* MEGA MENU / KART TASARIMI */
    .main-navigation li.mega-menu-parent > ul.sub-menu {
        grid-template-columns: repeat(2, 1fr); 
        gap: 1.5rem;
        padding: 2rem;
        box-sizing: border-box; 
    }

    .main-navigation li.mega-menu-parent:hover > ul.sub-menu,
    .main-navigation li.mega-menu-parent:focus-within > ul.sub-menu {
        display: grid; 
    }

    /* Kart Stilleri */
    .main-navigation li.mega-menu-parent ul.sub-menu li a {
        display: flex;
        flex-direction: column; 
        align-items: flex-start;
        padding: 1.5rem;
        background: #fff;
        border: 1px solid var(--clr-border);
        border-radius: 16px;
        height: 100%;
        transition: all 0.3s ease;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }

    .main-navigation li.mega-menu-parent ul.sub-menu li a:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 20px rgba(0,0,0,0.08);
        border-color: var(--clr-primary);
    }

    .nav-icon {
        width: 48px;
        height: 48px;
        background: var(--clr-surface);
        border-radius: 12px;
        margin-bottom: 1rem;
        color: var(--clr-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        transition: all 0.3s ease;
    }

    .main-navigation li.mega-menu-parent ul.sub-menu li a:hover .nav-icon {
        background: var(--clr-primary);
        color: #fff;
    }

    /* CTA BUTONU (MENU-BTN) */
    .main-navigation ul li.menu-btn {
        margin-left: 10px;
    }

    .main-navigation ul li.menu-btn a {
        background: linear-gradient(135deg, var(--clr-primary) 0%, #ff8a65 100%);
        color: #fff !important;
        padding: 0.75rem 2rem;
        border-radius: 999px;
        font-weight: 700;
        text-transform: uppercase;
        box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3);
    }

    .main-navigation ul li.menu-btn a:hover {
        transform: translateY(-3px) scale(1.02);
        box-shadow: 0 8px 25px rgba(255, 87, 34, 0.5);
    }

    /* Alt Menü Linkleri */
    .main-navigation ul.sub-menu li {
        display: block;
        margin-bottom: 0.5rem;
    }

    .main-navigation ul.sub-menu li a {
        font-size: 0.9rem;
        color: var(--clr-text); /* DÜZELTME: clr-text-light yerine clr-text yapıldı */
        padding: 0.5rem;
        display: block;
        border-radius: 8px;
        transition: all 0.2s;
        background: transparent;
    }

    .main-navigation ul.sub-menu li a:hover {
        color: var(--clr-primary);
        background: rgba(255, 87, 34, 0.05);
        transform: translateX(5px);
    }
}

/* Animasyonlar */
@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   MOBİL MENÜ TASARIMI (1023px Altı)
   ========================================= */
@media (max-width: 1023px) {
    
    /* GÜNCELLEME: Wrapper Sıfırlama (Tam Yapışık) */
    .floating-header-wrapper {
        top: 0; 
        margin-top: 0; 
        padding: 0; /* Padding kaldırıldı */
        max-width: 100%;
        /* Admin bar varsa onu JS veya body class'ı ile yönetiriz, şimdilik üstte kalsın */
    }
    
    .admin-bar .floating-header-wrapper {
        top: 0; /* Admin bar mobilde genelde fixed olmaz */
    }

    /* GÜNCELLEME: Hap Tasarımını Tam Genişlik Header'a Dönüştür */
    .floating-pill {
        width: 100%;
        max-width: 100%;
        border-radius: 0; /* Köşeleri düzleştir */
        border: none;
        border-bottom: 1px solid rgba(226, 232, 240, 0.8);
        padding: 1rem 1.5rem; /* Biraz daha geniş iç boşluk */
        justify-content: space-between;
        background: #fff; /* Tam beyaz arka plan */
        box-shadow: 0 2px 10px rgba(0,0,0,0.05); /* Hafif gölge */
    }

    /* Hamburger Göster */
    .menu-toggle {
        display: flex;
    }

    /* Menü Kapsayıcısı (Tam Ekran) */
    .main-navigation {
        display: none; /* JS ile açılacak */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: #fff;
        /* Header yüksekliği (yaklaşık 70-80px) kadar üstten boşluk */
        padding: 90px 20px 40px; 
        z-index: 10000;
        overflow-y: auto;
        flex-direction: column;
    }

    .main-navigation.toggled {
        display: flex;
    }

    /* Liste Düzeni */
    .main-navigation ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }

    .main-navigation ul li {
        width: 100%;
        border-bottom: 1px solid var(--clr-border);
    }

    .main-navigation ul li a {
        padding: 1rem 0;
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--clr-text);
        text-decoration: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    /* Ok İşareti (Mobilde Sağa Yaslı) */
    .menu-item-has-children > a::after {
        content: '';
        display: block;
        width: 8px;
        height: 8px;
        border-right: 2px solid var(--clr-text);
        border-bottom: 2px solid var(--clr-text);
        transform: rotate(45deg);
        transition: transform 0.3s ease;
    }

    .menu-item-has-children.active > a::after {
        transform: rotate(225deg);
        margin-top: 5px;
        border-color: var(--clr-primary);
    }

    /* SUB-MENU & MEGA MENU (MOBİL) - VARSAYILAN GİZLİ */
    .main-navigation ul.sub-menu {
        display: none !important;
        position: static;
        box-shadow: none;
        padding: 0 0 0 1rem;
        border: none;
        background: transparent;
        width: 100%;
        grid-template-columns: 1fr !important;
    }

    /* Sadece 'active' class'ı varsa GÖSTER */
    .main-navigation li.menu-item-has-children.active > ul.sub-menu {
        display: flex !important;
        flex-direction: column;
        animation: fadeIn 0.3s ease forwards;
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* Kart Tasarımını İptal Et -> Liste Görünümü */
    .main-navigation li.mega-menu-parent ul.sub-menu li a {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start; 
        padding: 0.8rem 0;
        border: none;
        box-shadow: none;
        border-bottom: 1px dashed var(--clr-border);
        border-radius: 0;
        height: auto;
        background: transparent !important;
    }

    /* İkon Düzeni (Mobil) */
    .nav-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 0;
        margin-right: 15px; 
        background: transparent; 
        color: var(--clr-primary);
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav-icon svg {
        width: 20px;
        height: 20px;
    }

    .nav-content-wrapper {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-title {
        font-size: 1rem;
        margin-bottom: 0;
        color: var(--clr-text);
    }

    .nav-desc {
        display: none;
    }

    /* CTA Butonu (En Alta Sabitle) */
    .main-navigation ul li.menu-btn {
        margin-top: 20px;
        border-bottom: none;
    }

    .main-navigation ul li.menu-btn a {
        justify-content: center;
        width: 100%;
        text-align: center;
        background: var(--clr-primary);
        color: #fff !important;
        border-radius: 99px;
        padding: 1rem;
    }
}