/* ==========================================================================
   assets/css/lang.css
   Gozimsoft Multilingual Dropdown & Switcher Styles
   ========================================================================== */

.lang-switch {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1100;
}

/* Position based on document direction */
[dir="rtl"] .lang-switch {
    left: auto;
    right: 20px;
}

[dir="ltr"] .lang-switch {
    right: 20px;
    left: auto;
}

/* Language toggle button */
.lang-switch .lang-btn {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 6px 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none !important;
}

.lang-switch .lang-btn::after {
    display: none !important; /* Hide default Bootstrap caret */
}

.lang-switch .lang-btn:hover,
.lang-switch .lang-btn:focus,
.lang-switch.show .lang-btn {
    background: rgba(255, 255, 255, 0.32);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(0);
}

.lang-switch .lang-btn-flag {
    width: 22px;
    height: 15px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
    display: block;
}

.lang-switch .lang-btn-label {
    letter-spacing: 0.2px;
}

.lang-switch .lang-btn-chevron {
    font-size: 0.72rem;
    opacity: 0.85;
    transition: transform 0.25s ease;
}

.lang-switch.show .lang-btn-chevron {
    transform: rotate(180deg);
}

/* Dropdown Menu Container */
.lang-switch .lang-dropdown-menu {
    width: 320px;
    min-width: 320px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #ffffff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.06);
    margin-top: 10px;
    animation: langDropdownIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[dir="rtl"] .lang-switch .lang-dropdown-menu {
    text-align: right;
    right: 0;
    left: auto;
}

[dir="ltr"] .lang-switch .lang-dropdown-menu {
    text-align: left;
    right: 0;
    left: auto;
}

@keyframes langDropdownIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header inside dropdown */
.lang-dropdown-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #64748b;
}

.lang-dropdown-header i {
    color: #2563eb;
    font-size: 0.88rem;
}

/* 2-Column Grid of Languages */
.lang-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

/* Individual language grid item */
.lang-grid-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    text-decoration: none !important;
    color: #1e293b !important;
    transition: all 0.18s ease;
    cursor: pointer;
    position: relative;
}

.lang-grid-item:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8 !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.08);
}

/* Flag wrapper */
.lang-item-flag-wrap {
    width: 24px;
    height: 17px;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
}

.lang-item-flag {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Meta texts */
.lang-item-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.15;
}

.lang-item-name {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lang-item-code {
    font-size: 0.63rem;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-top: 1px;
}

/* Active language item */
.lang-grid-item.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.lang-grid-item.active .lang-item-name {
    color: #ffffff !important;
}

.lang-grid-item.active .lang-item-code {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Active checkmark */
.lang-item-check {
    font-size: 0.72rem;
    color: #ffffff;
    flex-shrink: 0;
}

[dir="rtl"] .lang-item-check {
    margin-right: auto;
    margin-left: 0;
}

[dir="ltr"] .lang-item-check {
    margin-left: auto;
    margin-right: 0;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 991.98px) {
    .site-header nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        max-width: calc(100% - 150px);
    }

    .site-header a {
        margin: 0 8px;
        font-size: 0.88rem;
    }
}

@media (max-width: 767.98px) {
    [dir="rtl"] .lang-switch {
        right: 10px;
    }

    [dir="ltr"] .lang-switch {
        right: 10px;
    }

    .lang-switch .lang-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
        gap: 6px;
    }

    .lang-switch .lang-btn-flag {
        width: 19px;
        height: 13px;
    }

    .lang-switch .lang-dropdown-menu {
        width: 290px;
        min-width: 290px;
        right: -10px !important;
        left: auto !important;
    }

    .lang-grid {
        gap: 5px;
    }

    .lang-grid-item {
        padding: 7px 8px;
        gap: 6px;
    }

    .lang-item-name {
        font-size: 0.78rem;
    }

    .site-header {
        height: auto;
        min-height: 55px;
        padding: 8px 10px;
    }

    .site-header nav {
        max-width: calc(100% - 120px);
        gap: 4px;
    }

    .site-header a {
        margin: 2px 6px;
        font-size: 0.8rem;
    }
}

@media (max-width: 420px) {
    .lang-switch .lang-btn-label {
        display: none; /* Show only flag + chevron on extremely small screens */
    }

    .lang-switch .lang-dropdown-menu {
        width: 270px;
        min-width: 270px;
    }

    .lang-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
