/* ── N8N Translator Frontend Widget (Glassmorphism) ── */
.n8n-lang-switcher {
    position: fixed;
    bottom: 30px;
    left: 30px; /* Vị trí bottom left theo chuẩn modern UI */
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (max-width: 768px) {
    .n8n-lang-switcher {
        bottom: max(90px, env(safe-area-inset-bottom, 30px) + 20px);
        left: 16px;
    }
}

.n8n-lang-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 30px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1f2937;
    font-size: 15px;
    font-weight: 600;
}

@supports (backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px)) {
    .n8n-lang-btn {
        background: rgba(255, 255, 255, 0.7);
    }
}

@media (hover: hover) and (pointer: fine) {
    .n8n-lang-btn:hover {
        background: rgba(255, 255, 255, 0.9);
        transform: translateY(-2px);
        box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
    }
}

.n8n-lang-flag {
    font-size: 20px;
    line-height: 1;
}

.n8n-lang-name {
    margin-right: 4px;
}

.n8n-lang-chevron {
    transition: transform 0.3s ease;
}

.n8n-lang-btn[aria-expanded="true"] .n8n-lang-chevron {
    transform: rotate(180deg);
}

.n8n-lang-dropdown {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    min-width: 180px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.15);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

@supports (backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px)) {
    .n8n-lang-dropdown {
        background: rgba(255, 255, 255, 0.85);
    }
}

.n8n-lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.n8n-lang-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .n8n-lang-item:hover {
        background: rgba(128, 128, 128, 0.1);
        transform: translateX(2px);
    }
}

.n8n-lang-item.active {
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 700;
}

.n8n-lang-item.active .n8n-lang-name {
    position: relative;
}

/* ── Custom Dark Mode Support ── */
@media (prefers-color-scheme: dark) {
    .n8n-lang-btn {
        background: rgba(17, 24, 39, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #f3f4f6;
    }
    .n8n-lang-btn:hover {
        background: rgba(17, 24, 39, 0.9);
    }
    .n8n-lang-dropdown {
        background: rgba(17, 24, 39, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    .n8n-lang-item {
        color: #d1d5db;
    }
    .n8n-lang-item:hover {
        background: rgba(31, 41, 55, 0.9);
        color: #f9fafb;
    }
    .n8n-lang-item.active {
        background: rgba(79, 70, 229, 0.2);
        color: #818cf8;
    }
}
