/* Language Switcher - Compact Material Design */

/* List Style */
.fg-lang-switcher-list {
    display: inline-block;
}

.fg-lang-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.fg-lang-item {
    display: inline-block;
}

.fg-lang-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: #5f6368;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.2px;
    min-height: 32px;
}

.fg-lang-item a:hover {
    background: rgba(26, 115, 232, 0.08);
    color: #1a73e8;
}

.fg-lang-item.current-lang a {
    background: #e8f0fe;
    color: #1967d2;
}

.fg-lang-flag-svg {
    width: 28px;
    height: 20px;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

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

.fg-lang-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
}

/* Compact Material Dropdown */
.fg-lang-dropdown-wrapper {
    position: relative;
    display: inline-block;
    font-family: 'Roboto', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

.fg-lang-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 120px;
    user-select: none;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.1);
    height: 36px;
}

.fg-lang-dropdown-trigger:hover {
    background: #f8f9fa;
    border-color: #1a73e8;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
}

.fg-lang-dropdown-wrapper.active .fg-lang-dropdown-trigger {
    background: #ffffff;
    border-color: #1a73e8;
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.2);
}

.fg-lang-current-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #202124;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.fg-lang-dropdown-arrow {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #5f6368;
    flex-shrink: 0;
    width: 10px;
    height: 10px;
}

.fg-lang-dropdown-wrapper.active .fg-lang-dropdown-arrow {
    transform: rotate(180deg);
    color: #1a73e8;
}

/* Compact Dropdown Menu */
.fg-lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(-8px);
    transform-origin: top center;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
    min-width: 160px;
    padding: 4px 0;
}

.fg-lang-dropdown-wrapper.active .fg-lang-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.fg-lang-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    text-decoration: none;
    color: #202124;
    transition: background-color 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.2px;
    position: relative;
    cursor: pointer;
}

.fg-lang-dropdown-item:hover {
    background: #f1f3f4;
}

.fg-lang-dropdown-item.active {
    background: #e8f0fe;
    color: #1967d2;
    font-weight: 500;
}

.fg-lang-dropdown-item .fg-lang-name {
    flex: 1;
    font-weight: inherit;
}

.fg-lang-check {
    color: #1967d2;
    flex-shrink: 0;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    width: 16px;
    height: 16px;
}

.fg-lang-dropdown-item.active .fg-lang-check {
    opacity: 1;
    transform: scale(1);
}

/* Ripple Effect */
.fg-lang-dropdown-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(26, 115, 232, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.fg-lang-dropdown-item:active::before {
    width: 100%;
    height: 100%;
}

/* --- Region Mode Styles --- */

.fg-region-mode .fg-lang-dropdown-trigger {
    height: 48px;
    /* Taller for 2 lines */
    padding: 4px 12px;
    border-radius: 12px;
}

.fg-lang-text-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    line-height: 1.2;
}

.fg-region-label {
    font-size: 10px;
    color: #5f6368;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.fg-region-mode .fg-lang-current-name {
    font-size: 13px;
    font-weight: 600;
    color: #202124;
}

.fg-dropdown-header {
    padding: 8px 12px;
    font-size: 11px;
    color: #5f6368;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid #f1f3f4;
    margin-bottom: 4px;
}

.fg-lang-item-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    line-height: 1.3;
}

.fg-lang-native {
    font-size: 11px;
    color: #5f6368;
    font-weight: 400;
}

.fg-region-mode .fg-lang-dropdown-menu {
    min-width: 200px;
}

/* Responsive */
@media (max-width: 768px) {
    .fg-lang-list {
        gap: 2px;
    }

    .fg-lang-item a {
        padding: 5px 10px;
        font-size: 12px;
        min-height: 30px;
    }

    .fg-lang-dropdown-trigger {
        min-width: 100px;
        padding: 5px 10px;
        height: 32px;
    }

    .fg-region-mode .fg-lang-dropdown-trigger {
        height: 42px;
    }
}

/* =========================================
   Modern Mega Menu Modal Styles (Shortcode)
   ========================================= */

/* Container */
.fg-lang-switcher-container {
    position: relative;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    z-index: 100;
    display: inline-block;
}

/* Trigger Button */
.fg-lang-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    padding: 6px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(16,24,40,0.06);
    min-width: 140px;
}

.fg-lang-trigger:hover {
    background: #f8fafc !important;
    border-color: #dfe3e8 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(16,24,40,0.08);
}

.fg-current-flag {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(16,24,40,0.06);
    border: 1px solid #e6e6e6;
    background: #fff;
}

.fg-current-flag svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fg-current-flag:empty {
    background: #f3f4f6;
    border-color: #dcdcdc;
    position: relative;
}

.fg-current-flag:empty::after {
    content: attr(data-lang);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
}

.fg-trigger-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    margin-right: auto;
}

.fg-trigger-lang {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    letter-spacing: 0.3px;
}

.fg-trigger-region {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}

.fg-trigger-arrow {
    color: #6b7280;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fg-lang-switcher-container.active .fg-trigger-arrow {
    transform: rotate(180deg);
    color: #111;
}

.fg-lang-switcher-container { position: relative; }
.fg-lang-switcher-container.active::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16,24,40,0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9998;
}

/* Dropdown/Modal */
.fg-lang-modal {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 520px !important;
    background: #ffffff !important;
    border-radius: 24px !important;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.25), 0 10px 20px -5px rgba(0,0,0,0.1) !important;
    padding: 0 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.18s;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    z-index: 9999 !important;
}

.fg-lang-switcher-container.active .fg-lang-modal {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition-delay: 0s;
}

/* Modal Content */
.fg-modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid #f3f4f6;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 0 rgba(16,24,40,0.04);
}

.fg-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.3px;
}

.fg-modal-close {
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    padding: 6px;
    border-radius: 8px;
}
.fg-modal-close:hover { color: #111; background: #f3f4f6; }

.fg-modal-body {
    display: flex;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
}
.fg-lang-modal.confirm-open .fg-modal-body { filter: none; pointer-events: none; }
.fg-modal-body::-webkit-scrollbar { width: 10px; height: 10px; }
.fg-modal-body::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 10px; }
.fg-modal-body::-webkit-scrollbar-thumb { background: #c7c9cc; border-radius: 10px; }
.fg-modal-body::-webkit-scrollbar-thumb:hover { background: #aeb2b7; }

.fg-column {
    flex: 1;
    padding: 22px;
}

.fg-column:first-child {
    border-right: 1px solid #f3f4f6;
    background: #fafafa;
}

.fg-column-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #6b7280;
    margin-bottom: 14px;
    font-weight: 700;
}

/* Lists */
.fg-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.fg-list.grid-2 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px 12px !important;
}

.fg-confirm {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 40px rgba(0,0,0,0.18);
    padding: 16px 18px;
    border-radius: 12px;
    display: none;
    z-index: 10001;
    width: min(420px, 90%);
}

.fg-confirm.show { display: block; }
.fg-confirm-inner { display: flex; align-items: center; gap: 12px; }
.fg-confirm-text { font-size: 13px; color: #111827; font-weight: 600; }
.fg-confirm-actions { margin-left: auto; display: flex; gap: 10px; }
.fg-btn { padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.fg-btn-primary { background: #111827; color: #fff; border-color: #111827; }
.fg-btn-primary:hover { background: #0b1220; border-color: #0b1220; }
.fg-btn-secondary { background: #fff; color: #111827; border-color: #d1d5db; }
.fg-btn-secondary:hover { background: #f3f4f6; }

/* Backdrop when confirm is open */
.fg-lang-modal.confirm-open::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(16,24,40,0.45);
    z-index: 1;
}

.fg-list.grid-2 .fg-list-item {
    width: 100% !important;
}

.fg-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: #2b2b2b;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #ececec;
    background: #fff;
    position: relative;
}

.fg-list-item:hover {
    background: #fafafa !important;
    border-color: #e6e6e6 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    color: #111 !important;
}

.fg-column:first-child .fg-list-item:hover {
    background: #e8e8e8;
    border-color: transparent;
}

.fg-list-item.active {
    background: #fff !important;
    color: #0f172a !important;
    border-color: #10b981 !important;
    border-width: 2px !important;
}

.fg-column:first-child .fg-list-item.active {
    background: #fff;
    border-color: #10b981;
    border-width: 2px;
}

.fg-list-item-flag {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.fg-list-item-flag svg {
    width: 100%;
    height: 100%;
    display: block;
}

.fg-check {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 18px;
    height: 18px;
    opacity: 0;
    transform: scale(0.85);
    transition: all 0.2s ease;
    pointer-events: none;
}

.fg-list-item.active .fg-check {
    opacity: 1;
    transform: scale(1);
}

/* Responsive */
@media (max-width: 600px) {
    .fg-lang-modal {
        width: 320px;
        right: -20px;
    }
    .fg-list.grid-2 {
        grid-template-columns: 1fr !important;
    }
    .fg-modal-body {
        flex-direction: column;
    }
    .fg-lang-modal.confirm-open .fg-modal-body { padding-bottom: 92px; }
    .fg-confirm-inner { flex-direction: column; align-items: flex-start; }
    .fg-confirm-actions { margin-left: 0; width: 100%; }
    .fg-column:first-child {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        padding: 16px;
    }
    .fg-column {
        padding: 16px;
    }
}

    .fg-lang-flag-svg {
        width: 24px;
        height: 16px;
    }

    .fg-lang-dropdown-menu {
        min-width: 140px;
    }

    .fg-lang-dropdown-item {
        padding: 7px 10px;
        font-size: 12px;
    }


/* Focus States for Accessibility */
.fg-lang-dropdown-trigger:focus,
.fg-lang-dropdown-item:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.fg-lang-item a:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}
