/* ============================================================
   Mega Menu Styles
   ============================================================ */

/* Üst seviye li öğesi — static kalır; konumlanma .navbar'a bırakılır */
.mega-menu-item {
    position: static !important;
}

/* Navbar: positioned ancestor — gölge kesilmeden görünsün */
.col-md-9 .navbar.navbar-default {
    position: relative;
    overflow: visible;
}

/* ============================================================
   1. SOFT TRANSITION — Yumuşak Açılış/Kapanış
   ============================================================ */
.mega-menu-content {
    position: absolute;
    left: 50%;                         /* Menü çubuğuna ortala */
    transform: translateX(-50%) translateY(10px);
    width: 100%;                       /* Hesaplama tabanı */
    max-width: 1140px;                 /* Site container genişliği */
    background: #fff;
    border-top: 3px solid var(--site-ana-renk);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    /* Başlangıç durumu: gizli */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out, transform 0.3s ease-in-out;
    z-index: 999;
    padding: 25px 0 30px 0;
    pointer-events: none;
    overflow: visible;
    box-sizing: border-box;
}

/* Hover durumunda: görünür */
@media (min-width: 992px) {
    .mega-menu-item:hover .mega-menu-content {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);   /* Hizalamayı koru */
        pointer-events: auto;
    }
}

/* ============================================================
   Mega Menu İç Yapı
   ============================================================ */
.mega-menu-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

/* Sol sidebar */
.mega-menu-sidebar {
    background: #f9f9f9;
    padding: 20px;
    border-right: 1px solid #eee;
    min-height: 220px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.mega-menu-sidebar i {
    font-size: 48px;
    color: var(--site-ana-renk);
    margin-bottom: 15px;
}

.mega-menu-sidebar h3 {
    font-size: 24px;
    margin: 0 0 10px 0;
    color: #333;
    font-weight: 700;
}

.mega-menu-sidebar p {
    font-size: 13px;
    color: #888;
    margin: 0;
    line-height: 1.5;
}

/* Sağ link alanı */
.mega-menu-links {
    padding: 0 20px;
}

.mega-menu-links h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--site-ana-renk);
    border-bottom: 2px solid var(--site-ana-renk);
    padding-bottom: 8px;
    margin-bottom: 12px;
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mega-menu-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu-links ul li {
    margin-bottom: 4px;
}

/* Sub-menu linkleri — ana navbar ile birebir aynı sistem */
.mega-menu-links ul li a {
    color: #333;                   /* Ana menüyle aynı renk */
    text-decoration: none;
    font-size: 14px;               /* Ana menüyle aynı font boyutu */
    font-weight: 400;              /* Ana menüyle aynı ağırlık */
    transition: color 0.25s ease;
    display: inline-block;
    padding: 4px 0;
    line-height: 1.5;
    position: relative;
    background: none;
    border: none;
    box-shadow: none;
}

/* Ortadan açılan çizgi — ana menüdeki ::after ile aynı teknik */
.mega-menu-links ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    transform-origin: center;
    width: 100%;
    height: 2px;
    background-color: var(--site-ana-renk);
    border-radius: 2px;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hover: renk + çizgi — ana menüyle birebir aynı */
.mega-menu-links ul li a:hover {
    color: var(--site-ana-renk);
    text-decoration: none;
    background: none;
}

.mega-menu-links ul li a:hover::after {
    transform: translateX(-50%) scaleX(1);
    opacity: 1;
}

/* ============================================================
   Tek Kolon (col-md-12) Düzeni
   ============================================================ */
.mega-menu-single-col {
    padding: 0 10px;
}

.mega-menu-single-col h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--site-ana-renk);
    border-bottom: 2px solid var(--site-ana-renk);
    padding-bottom: 8px;
    margin-bottom: 16px;
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   Flex tabanlı 3'lü sütun düzeni — Bootstrap col kısıtı yok
   ============================================================ */

/* Kapsayıcı: flex wrap, dar gap, negatif margin yok */
.mega-menu-list-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    max-width: 100%;
    box-sizing: border-box;
}

/* Bootstrap col float/width kurallarını sıfırla */
.mega-menu-col-item,
.mega-menu-col-item[class*="col-"] {
    float: none !important;
    width: auto !important;
    /* Flex: büyür/küçülür, ~3'te 1 genişlik — panel dışına taşmaz */
    flex: 0 0 32%;
    min-width: 140px;
    max-width: 33.333%;     /* Asla 1/3'ten geniş olmaz */
    padding: 5px 5px;
    box-sizing: border-box;
    overflow: hidden;       /* Link içeriği sütun dışına çıkmaz */
}

/* Sade metin linki — uzun başlıklar kendi sütununda alt satıra geçer */
.mega-menu-col-item a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    display: inline-block;
    padding: 4px 0;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    position: relative;
    transition: color 0.25s ease;
    white-space: normal;        /* Uzun başlık sağa taşmaz, alt satıra geçer */
    word-break: break-word;
    max-width: 100%;
    line-height: 1.5;
}

/* Ortadan açılan alt çizgi animasyonu */
.mega-menu-col-item a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    transform-origin: center;
    width: 100%;
    height: 2px;
    background-color: var(--site-ana-renk);
    border-radius: 2px;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hover: renk + çizgi */
.mega-menu-col-item a:hover {
    color: var(--site-ana-renk);
    text-decoration: none;
    background: none;
}

.mega-menu-col-item a:hover::after {
    transform: translateX(-50%) scaleX(1);
    opacity: 1;
}

/* Tablet: 2 sütun */
@media (min-width: 768px) and (max-width: 991px) {
    .mega-menu-col-item,
    .mega-menu-col-item[class*="col-"] {
        flex: 0 1 calc(50% - 20px);
        max-width: calc(50% - 20px);
        min-width: 120px;
    }
}

/* Mobil: tam genişlik, tek sütun, ::after yok */
@media (max-width: 767px) {
    .mega-menu-list-inline {
        gap: 0;
    }
    .mega-menu-col-item,
    .mega-menu-col-item[class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100% !important;
        padding: 0 15px;
    }
    .mega-menu-col-item a {
        padding: 10px 0;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
        white-space: normal;
        max-width: 100%;
    }
    .mega-menu-col-item a::after {
        display: none;
    }
}

/* ============================================================
   3. HOVER EFFECT (Masaüstü) — Ana Navbar Linkleri
   ============================================================ */

/* Tüm navbar linkleri için position gerekli */
.navbar-nav > li > a {
    position: relative;
    color: #333;
    transition: color 0.25s ease;
}

/* ::after pseudo-element — hover çizgisi (başlangıç: gizli) */
.navbar-nav > li > a::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    transform-origin: center;
    width: 70%;
    height: 2px;
    background-color: var(--site-ana-renk);
    border-radius: 2px;
    opacity: 0;
    /* Alttan gelme animasyonu */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hover: renk değişimi + çizgi belirir */
@media (min-width: 992px) {
    .navbar-nav > li > a:hover {
        color: var(--site-ana-renk) !important;
        background: transparent !important;
        text-decoration: none;
    }

    .navbar-nav > li > a:hover::after {
        transform: translateX(-50%) scaleX(1);
        opacity: 1;
    }
}

/* ============================================================
   4. ACTIVE STATE — Aktif Sayfa Vurgusu
   (Hover çizgisiyle tam aynı stil — Icon Synergy)
   ============================================================ */

/* Aktif li */
.navbar-nav > li.active > a,
.navbar-nav > li.active > a:hover,
.navbar-nav > li.active > a:focus {
    color: var(--site-ana-renk) !important;
    background: transparent !important;
    position: relative;
}

/* Aktif linkin altında kalıcı çizgi — hover ::after ile birebir aynı */
@media (min-width: 992px) {
    .navbar-nav > li.active > a::after {
        transform: translateX(-50%) scaleX(1) !important;
        opacity: 1 !important;
    }
}

/* Mega menü içinde aktif link */
.mega-menu-links ul li a.active-link {
    color: var(--site-ana-renk) !important;
    font-weight: 700;
    padding-left: 6px;
}

/* ============================================================
   2. MOBİL UYUMLULUK — max-width: 991px
   ============================================================ */
@media (max-width: 991px) {

    /* Pozisyon düzeltmesi */
    .mega-menu-item {
        position: relative !important;
    }

    /* Mega menü içerik: statik, akordeon gibi */
    .mega-menu-content {
        position: static;
        width: 100%;
        box-shadow: none;
        border-top: 2px solid var(--site-ana-renk);
        border-bottom: 1px solid #eee;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        padding: 10px 0 15px 0;
        transition: none;
    }

    /* Bootstrap dropdown .open sınıfıyla uyumlu */
    .mega-menu-item.open .mega-menu-content {
        display: block;
    }

    /* Sidebar gizle */
    .mega-menu-sidebar {
        display: none;
    }

    /* Tüm kolonlar alt alta */
    .mega-menu-links {
        padding: 5px 15px;
        width: 100%;
    }

    .mega-menu-links .col-md-4,
    .mega-menu-links .col-md-6,
    .mega-menu-links .col-md-12 {
        width: 100%;
        margin-bottom: 15px;
        float: none;
    }

    .mega-menu-links h4,
    .mega-menu-single-col h4 {
        font-size: 13px;
        margin-bottom: 8px;
        padding-bottom: 5px;
    }

    .mega-menu-links ul li a {
        padding: 5px 0;
        font-size: 13px;
    }

    /* Hover ::after çizgisini mobilde kaldır */
    .navbar-nav > li > a::after {
        display: none;
    }

    /* Touch-friendly: mobil menü linkleri büyük tıklanabilir alan */
    .navbar-nav > li > a {
        padding-top: 14px !important;
        padding-bottom: 14px !important;
        font-size: 14px;
    }

    /* Aktif li — sol dikey çizgi + hafif arka plan (hover ile synergy) */
    .navbar-nav > li.active > a {
        color: var(--site-ana-renk) !important;
        background-color: rgba(244, 130, 31, 0.07) !important;
        border-left: 3px solid var(--site-ana-renk) !important;
        padding-left: 14px !important;
    }

    /* Accordion açık mega-menü li — sol çizgi + arka plan */
    .navbar-nav > li.open > a,
    .navbar-nav > li.mega-menu-item.open > a {
        color: var(--site-ana-renk) !important;
        background-color: rgba(244, 130, 31, 0.07) !important;
        border-left: 3px solid var(--site-ana-renk) !important;
        padding-left: 14px !important;
    }

    /* Mobil alt menü linkleri — sade, touch-friendly */
    .mega-menu-links ul li {
        border: none;
        background: none;
    }

    .mega-menu-links ul li a {
        min-height: 44px;
        display: flex !important;
        align-items: center;
        padding: 10px 0 !important;
        font-size: 14px;
        color: #333;
        background: none;
        border: none;
        box-shadow: none;
    }

    .mega-menu-links ul li a:hover {
        color: var(--site-ana-renk);
        background: none;
    }

    /* Mobilde ::after çizgisi yok */
    .mega-menu-links ul li a::after {
        display: none !important;
    }

    /* Mega menü wrapper flex yerine block */
    .mega-menu-wrapper {
        display: block;
    }

    /* col-md-9 tam genişlik */
    .mega-menu-links.col-md-9 {
        width: 100%;
        float: none;
    }
}

/* ============================================================
   KURUMSAL Menü Özel Stilleri
   ============================================================ */

/* Kurumsal menü paneli — compact, linklerin altından açılır */
.mega-menu-kurumsal {
    left: auto !important;              /* Merkez hizalama iptal */
    right: auto !important;
    transform: translateX(0) translateY(10px) !important;  /* Yatay kayma yok */
    width: auto !important;             /* İçeriğe göre genişle */
    min-width: 220px !important;
    max-width: 280px !important;
    padding: 0 !important;              /* İç padding yok, linklere verilecek */
}

/* Hover durumu */
@media (min-width: 992px) {
    .mega-menu-item:hover .mega-menu-kurumsal {
        transform: translateX(0) translateY(0) !important;
    }
}

/* Link listesi — margin/padding sıfır */
.kurumsal-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.kurumsal-menu-list li {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #f0f0f0;   /* Linkleri ayır */
}

.kurumsal-menu-list li:last-child {
    border-bottom: none;                /* Son link alt çizgi yok */
}

/* Link stilleri — ana menü ile birebir aynı font, hover efekti */
.kurumsal-menu-list li a {
    display: block !important;          /* Tıklama alanı tam genişlik */
    padding: 12px 20px !important;      /* İstenen boşluk */
    color: #333 !important;             /* Ana menü link rengi */
    text-decoration: none;
    font-size: 14px !important;         /* Ana menü font boyutu */
    font-weight: 400 !important;        /* Ana menü font ağırlığı */
    font-family: var(--site-font) !important;  /* Ana menü font ailesi */
    transition: color 0.25s ease, background-color 0.2s ease;
    position: relative;
    line-height: 1.5;
    background: none;
    border: none;
    box-shadow: none;
}

/* Ortadan açılan alt çizgi — ana menü ::after efekti */
.kurumsal-menu-list li a::after {
    content: '';
    position: absolute;
    bottom: 8px;                        /* Alt boşluktan yukarı */
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    transform-origin: center;
    width: calc(100% - 40px);           /* Padding dahil değil */
    height: 2px;
    background-color: var(--site-ana-renk);
    border-radius: 2px;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hover efekti — ana menü ile aynı */
@media (min-width: 992px) {
    .kurumsal-menu-list li a:hover {
        color: var(--site-ana-renk) !important;
        background-color: rgba(244, 130, 31, 0.04);  /* Hafif arka plan */
        text-decoration: none;
    }

    .kurumsal-menu-list li a:hover::after {
        transform: translateX(-50%) scaleX(1);
        opacity: 1;
    }
}

/* Mobil uyumluluk */
@media (max-width: 991px) {
    .mega-menu-kurumsal {
        min-width: 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .kurumsal-menu-list li a {
        padding: 14px 15px !important;
        font-size: 14px !important;
        min-height: 44px;               /* Touch-friendly */
        display: flex !important;
        align-items: center;
    }

    /* Mobilde ::after çizgisi yok */
    .kurumsal-menu-list li a::after {
        display: none !important;
    }

    .kurumsal-menu-list li a:hover {
        background-color: rgba(244, 130, 31, 0.07);
    }
}

/* Küçük ekranlar (xs) için ek düzenleme */
@media (max-width: 767px) {
    .mega-menu-content .container {
        width: 100%;
        padding: 0;
    }

    /* xs ekranlarda touch padding daha büyük */
    .navbar-nav > li > a {
        padding-top: 16px !important;
        padding-bottom: 16px !important;
    }
}
