/**
 * Header & Navigation - Baştan yazıldı
 * Masaüstü: yatay menü + dropdown
 * Mobil: alttan açılan panel (bottom sheet), tek sütun, büyük yazı
 */

/* ========== HEADER ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 14, 39, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border);
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.header.scrolled {
    background: rgba(10, 14, 39, 0.98);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.navbar {
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text-primary);
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: scale(1.03);
}

.logo img {
    height: 40px;
    width: auto;
}

.logo-text {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== DESKTOP MENÜ ========== */
.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

.nav-menu > li {
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-sm);
    line-height: 1.4;
    padding: var(--space-2) var(--space-3);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: 100%;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--space-3);
    right: var(--space-3);
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
}

.nav-item-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-item-dropdown:not(:hover):not(.active) > .nav-dropdown,
.nav-item-dropdown:not(:hover):not(.active) > ul {
    display: none;
}

.nav-item-dropdown > .nav-link {
    padding-right: var(--space-4);
}

.nav-item-dropdown > .nav-link .fa-chevron-down {
    font-size: 0.5rem;
    margin-left: 2px;
    transition: transform 0.2s ease;
}

.nav-item-dropdown:hover > .nav-link .fa-chevron-down,
.nav-item-dropdown.active > .nav-link .fa-chevron-down {
    transform: rotate(180deg);
}

.nav-dropdown,
.nav-item-dropdown > ul {
    position: absolute;
    top: 100%;
    left: 0;
    list-style: none;
    margin: 0;
    padding: var(--space-2) 0;
    min-width: 200px;
    background: rgba(30, 41, 59, 0.98);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px);
    z-index: 1001;
}

.nav-item-dropdown:hover > .nav-dropdown,
.nav-item-dropdown:hover > ul,
.nav-item-dropdown.active > .nav-dropdown,
.nav-item-dropdown.active > ul {
    display: block;
}

@media (min-width: 769px) {
    .nav-menu > .nav-item-dropdown:last-of-type > .nav-dropdown,
    .nav-menu > .nav-item-dropdown:last-of-type > ul,
    .nav-menu > .nav-item-dropdown:nth-last-of-type(2) > .nav-dropdown,
    .nav-menu > .nav-item-dropdown:nth-last-of-type(2) > ul {
        left: auto;
        right: 0;
    }
}

.nav-dropdown li,
.nav-item-dropdown > ul > li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-dropdown a,
.nav-item-dropdown > ul a {
    display: block;
    padding: var(--space-3) var(--space-5);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-dropdown a:hover,
.nav-item-dropdown > ul a:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--color-text-primary);
}

.nav-dropdown a i,
.nav-item-dropdown > ul a i {
    margin-right: var(--space-2);
    width: 18px;
    text-align: center;
    opacity: 0.8;
}

/* 3. seviye (varsa) */
.nav-item-dropdown-sub {
    position: relative;
}

.nav-dropdown-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item-dropdown-sub:hover > .nav-dropdown-link,
.nav-item-dropdown-sub.active > .nav-dropdown-link {
    background: rgba(148, 163, 184, 0.1);
    color: var(--color-text-primary);
}

.nav-dropdown-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 220px;
    list-style: none;
    margin: 0;
    padding: var(--space-2) 0;
    background: rgba(30, 41, 59, 0.98);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1002;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.nav-item-dropdown-sub:hover .nav-dropdown-submenu,
.nav-item-dropdown-sub.active .nav-dropdown-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.nav-dropdown-submenu a {
    padding: var(--space-3) var(--space-5);
    font-size: var(--font-size-sm);
}

/* Mobil menü butonu (desktop’ta gizli) */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text-primary);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========== MOBİL OVERLAY ========== */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-menu-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ========== MOBİL DRAWER (mobilde görünür) ========== */
.mobile-menu-drawer {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: min(288px, 88vw);
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        background: #1e293b;
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.35);
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        overflow: hidden;
    }

    .mobile-menu-drawer.active {
        transform: translateX(0);
    }

    .mobile-menu-drawer__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        height: 56px;
        padding: 0 16px 0 20px;
        border-bottom: 1px solid rgba(148, 163, 184, 0.15);
        background: #1e293b;
    }

    .mobile-menu-drawer__title {
        font-size: 1.125rem;
        font-weight: 600;
        color: var(--color-text-primary);
    }

    .mobile-menu-drawer__close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin: 0 -8px 0 0;
        padding: 0;
        border: none;
        background: transparent;
        color: var(--color-text-secondary);
        font-size: 1.25rem;
        cursor: pointer;
        border-radius: 8px;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .mobile-menu-drawer__close:hover {
        background: rgba(148, 163, 184, 0.12);
        color: var(--color-text-primary);
    }

    .mobile-menu-drawer__body {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 12px 0 24px;
    }

    /* Menü linkleri drawer içinde */
    .mobile-menu-drawer .nav-menu {
        position: static;
        display: block;
        width: 100%;
        height: auto;
        margin: 0;
        padding: 0;
        flex-direction: column;
        align-items: stretch;
        transform: none;
        background: transparent;
        box-shadow: none;
        border: none;
    }

    .mobile-menu-drawer .nav-menu > li {
        width: 100%;
        margin: 0;
        padding: 0;
        display: block;
    }

    .mobile-menu-drawer .nav-menu > li:last-child {
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid rgba(148, 163, 184, 0.12);
    }

    .mobile-menu-drawer .nav-link {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 12px 20px;
        font-size: 1rem;
        font-weight: 500;
        color: var(--color-text-primary);
        text-decoration: none;
        box-sizing: border-box;
        transition: background 0.15s ease;
        border-radius: 0 8px 8px 0;
        margin: 0 12px 0 0;
    }

    .mobile-menu-drawer .nav-link::after {
        display: none;
    }

    .mobile-menu-drawer .nav-link:hover {
        background: rgba(148, 163, 184, 0.1);
    }

    .mobile-menu-drawer .nav-item-dropdown {
        display: block;
        width: 100%;
        position: static;
    }

    .mobile-menu-drawer .nav-item-dropdown > .nav-link {
        justify-content: space-between;
    }

    .mobile-menu-drawer .nav-item-dropdown > .nav-link .fa-chevron-down {
        margin-left: auto;
        font-size: 0.65rem;
        opacity: 0.8;
        transition: transform 0.2s ease;
    }

    .mobile-menu-drawer .nav-item-dropdown.active > .nav-link .fa-chevron-down {
        transform: rotate(180deg);
    }

    /* Alt menü paneli - parent’ın hemen altında, tek sütun */
    .nav-item-dropdown .nav-dropdown,
    .nav-item-dropdown > ul {
        position: static !important;
        display: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 0 12px !important;
        padding: 0 0 8px 0 !important;
        background: transparent !important;
        border: none !important;
        border-left: 2px solid rgba(148, 163, 184, 0.2) !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        min-width: 0 !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
    }

    .nav-item-dropdown.active .nav-dropdown,
    .nav-item-dropdown.active > ul {
        display: block !important;
    }

    .nav-dropdown a,
    .nav-item-dropdown > ul > li > a {
        display: block;
        width: 100%;
        padding: 10px 12px;
        font-size: 0.9375rem;
        color: var(--color-text-secondary);
        text-decoration: none;
        transition: background 0.15s ease, color 0.15s ease;
        box-sizing: border-box;
        border-radius: 8px;
    }

    .nav-dropdown a:hover,
    .nav-item-dropdown > ul a:hover {
        background: rgba(148, 163, 184, 0.1);
        color: var(--color-text-primary);
    }

    .nav-dropdown li,
    .nav-item-dropdown > ul > li {
        margin: 0;
        padding: 0;
        list-style: none;
        width: 100%;
        display: block;
    }

    .nav-menu .btn {
        margin: 0 20px;
        padding: 14px 20px;
        font-size: 1rem;
        font-weight: 600;
        justify-content: center;
        width: calc(100% - 40px);
        box-sizing: border-box;
        border-radius: 10px;
    }

    /* 3. seviye mobil */
    .nav-item-dropdown-sub {
        display: block;
        width: 100%;
        position: static;
    }

    .nav-dropdown-link {
        padding: 10px 12px;
        font-size: 0.9375rem;
        border-radius: 8px;
    }

    .nav-dropdown-submenu {
        position: static !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        display: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 0 12px !important;
        padding: 0 0 6px 0 !important;
        min-width: 0 !important;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        transform: none !important;
        background: transparent !important;
        border: none !important;
        border-left: 2px solid rgba(148, 163, 184, 0.15) !important;
        box-shadow: none !important;
        transition: max-height 0.2s ease;
    }

    .nav-item-dropdown-sub.active .nav-dropdown-submenu {
        display: block !important;
        max-height: 400px;
    }

    .nav-dropdown-submenu a {
        padding: 8px 12px;
        font-size: 0.875rem;
        border-radius: 6px;
    }

    /* Hamburger (mobilde göster); header’daki menü mobilde gizli */
    .mobile-menu-toggle {
        display: flex !important;
    }

    .nav-wrapper .nav-menu {
        display: none;
    }

    .logo {
        z-index: 1002;
    }
}

@media (min-width: 769px) {
    .nav-wrapper .nav-menu {
        display: flex !important;
    }
}
