<style>
/* ================= Header ümumi ================= */
.top-header-area {
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 999;
    padding: 10px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Header container */
.main-menu-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    position: relative;
}

/* Logo dairəsi */
.site-logo {
    width: 80px;
    height: auto;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}
.site-logo img {
    max-width: 100%;
    max-height: 100%;
}
.site-logo:hover {
    transform: scale(1.05);
}

/* Menü */
.main-menu ul {
    display: flex;
    gap: 25px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.main-menu ul li a {
    text-decoration: none;
    color: #242527;
    font-weight: 600;
    font-size: 15px;
    transition: color 0.3s;
}
.main-menu ul li.current-list-item a,
.main-menu ul li a:hover {
    color: #cd134f;
}

/* Dil seçimi desktop */
#localeSelect {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #cd134f;
    font-size: 14px;
    background: #fff;
    color: #242527;
    cursor: pointer;
}
.align-items-center {
    align-items: unset !important;
}

/* Mobil menyu */
.mobile-menu {
    display: none;
}

/* Mobil dil seçimi */
.lang-mobile {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 10px;
    position: relative; /* position əlavə edirik */
    z-index: 9999;      /* digər overlay-lərin üzərinə çıxması üçün */
}


/* Responsiv */
@media (max-width: 991px) {
    .main-menu { display: none; }
    .mobile-menu { display: block; }
    .main-menu-wrap {
        justify-content: space-between;
        align-items: center;
    }

    /* Mərkəzləşdirilmiş mobil dil seçimi */
    .lang-mobile {
        display: block;
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }
    .lang-mobile select {
        width: 50%;
        font-size: 14px;
        padding: 5px;
        border-radius: 5px;
        border: 1px solid #cd134f;
        background: #fff;
        color: #242527;
        cursor: pointer;
    }

    /* Desktopdakı sağdakı dil seçimini gizlədirik */
    .col-12.col-lg-3.text-right { display: none; }
}
</style>

<div class="top-header-area" id="sticker">
    <div class="container position-relative">
        <div class="row align-items-center">
            <!-- Logo -->
            <div class="col-6 col-lg-3 text-left">
                <div class="site-logo">
                    <a href="{{ route('home') }}">
                        <img src="{{ asset('/assets/web/image/durremlogo.png') }}" alt="Dürrəm Ailəvi Restoran">
                    </a>
                </div>
            </div>

            <!-- Menu -->
            <div class="col-6 col-lg-6 text-center">
                <nav class="main-menu">
                    <ul>
                        <li class="current-list-item"><a href="{{ route('home') }}">@lang('ANA SƏHİFƏ')</a></li>
                        <li><a href="{{ route('galleries') }}">@lang('QALEREYA')</a></li>
                        <li><a href="{{ route('contacts') }}">@lang('ƏLAQƏ')</a></li>
                    </ul>
                </nav>
                <div class="mobile-menu"></div>

                <!-- Mobil dil seçimi -->
                <div class="lang-mobile">
                    <form id="langFormMobile" action="{{ route('change-language') }}" method="POST">
                        @csrf
                        <input type="hidden" name="locale" id="localeMobile">
                        <select name="locale" id="localeSelectMobile" onchange="submitLanguageFormMobile()">
                            <option value="az" {{ app()->getLocale() == 'az' ? 'selected' : '' }}>Az</option>
                            <option value="ru" {{ app()->getLocale() == 'ru' ? 'selected' : '' }}>Ru</option>
                            <option value="en" {{ app()->getLocale() == 'en' ? 'selected' : '' }}>En</option>
                        </select>
                    </form>
                </div>
            </div>

            <!-- Desktop dil seçimi -->
            <div class="col-12 col-lg-3 text-right mt-2 mt-lg-0">
                <form id="langForm" action="{{ route('change-language') }}" method="POST">
                    @csrf
                    <input type="hidden" name="locale" id="locale">
                    <select name="locale" id="localeSelect" onchange="submitLanguageForm()">
                        <option value="az" {{ app()->getLocale() == 'az' ? 'selected' : '' }}>Az</option>
                        <option value="ru" {{ app()->getLocale() == 'ru' ? 'selected' : '' }}>Ru</option>
                        <option value="en" {{ app()->getLocale() == 'en' ? 'selected' : '' }}>En</option>
                    </select>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
function submitLanguageForm() {
    var selectedLocale = document.getElementById('localeSelect').value;
    document.getElementById('locale').value = selectedLocale;  
    document.getElementById('langForm').submit(); 
}

function submitLanguageFormMobile() {
    var selectedLocale = document.getElementById('localeSelectMobile').value;
    document.getElementById('localeMobile').value = selectedLocale;  
    document.getElementById('langFormMobile').submit(); 
}
</script>
