/* Language popup modal */
#lang-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

#lang-popup-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 640px;
    max-height: 80vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    padding: 20px;
    font-family: Arial, Helvetica, sans-serif;
}

#lang-popup-overlay.open,
#lang-popup-modal.open {
    display: block;
}

.lang-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

#lang-popup-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.lang-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}

.lang-popup-close:hover {
    color: #000;
}
.lang-popup-close:focus-visible {
    outline: 2px solid #1a6fc4;
    outline-offset: 2px;
    color: #000;
}

.lang-popup-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

@media (min-width: 480px) {
    .lang-popup-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 600px) {
    .lang-popup-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.lang-popup-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: background 0.15s;
    border: 1px solid transparent;
}

.lang-popup-item:hover {
    background: #f2f2f2;
    border-color: #ddd;
}
.lang-popup-item:focus-visible {
    outline: 2px solid #1a6fc4;
    outline-offset: -2px;
    background: #f2f2f2;
    border-color: #ddd;
}

.lang-popup-item.active {
    background: #e8f0fe;
    border-color: #aecbfa;
    font-weight: bold;
}

.lang-popup-flag {
    width: 24px;
    height: 16px;
    object-fit: cover;
    margin-bottom: 6px;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0,0,0,0.2);
}

.lang-popup-native {
    font-size: 13px;
    text-align: center;
    word-break: keep-all;
}

.lang-popup-name {
    font-size: 11px;
    color: #777;
    text-align: center;
}

/* Header language button */
.lang-popup-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    font-size: 12px;
    cursor: pointer;
}

.lang-popup-trigger:hover {
    background: rgba(0,0,0,0.05);
}
.lang-popup-trigger:focus-visible {
    outline: 2px solid #1a6fc4;
    outline-offset: 2px;
    background: rgba(0,0,0,0.05);
}

.lang-popup-trigger .globe {
    font-size: 14px;
}
