/**
 * WBW Language Switcher — Frontend Styles
 */

/* ── Shared ── */
.wbw-sw-item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; text-decoration: none;
    color: #333; font-size: 14px; line-height: 1.4;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.wbw-sw-item:hover { color: #111; background: rgba(0,0,0,0.04); }
.wbw-sw-active { font-weight: 600; }
.wbw-sw-flag { font-size: 18px; line-height: 1; }

/* ── Inline ── */
.wbw-sw-inline {
    display: flex; flex-wrap: wrap; gap: 2px;
    align-items: center;
}
.wbw-sw-inline .wbw-sw-item {
    border-radius: 4px;
}
.wbw-sw-inline .wbw-sw-active {
    background: rgba(0,0,0,0.06);
}

/* ── Dropdown ── */
.wbw-sw-dropdown {
    position: relative; display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.wbw-sw-trigger {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 0; margin: 0;
    background: none; border: 1px solid #ddd; border-radius: 6px;
    cursor: pointer; font: inherit; color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.wbw-sw-trigger:hover {
    border-color: #aaa;
}
.wbw-sw-trigger .wbw-sw-item {
    padding: 7px 8px 7px 12px;
}
.wbw-sw-arrow {
    font-size: 10px; color: #888; padding-right: 10px;
    transition: transform 0.2s;
}
.wbw-sw-dropdown.open .wbw-sw-arrow {
    transform: rotate(180deg);
}
.wbw-sw-panel {
    display: none; position: absolute; top: 100%; left: 0;
    margin-top: 4px; min-width: 100%;
    background: #fff; border: 1px solid #ddd; border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 99999; overflow: hidden;
}
.wbw-sw-dropdown.open .wbw-sw-panel {
    display: block;
}
.wbw-sw-panel .wbw-sw-item {
    display: flex; padding: 8px 14px;
    border-bottom: 1px solid #f0f0f0;
}
.wbw-sw-panel .wbw-sw-item:last-child {
    border-bottom: none;
}
.wbw-sw-panel .wbw-sw-item:hover {
    background: #f5f7fa;
}

/* ── Floating ── */
.wbw-sw-floating {
    position: fixed; z-index: 99998;
}
.wbw-sw-floating-bottom-right { bottom: 20px; right: 20px; }
.wbw-sw-floating-bottom-left  { bottom: 20px; left: 20px; }
.wbw-sw-floating-top-right    { top: 20px; right: 20px; }
.wbw-sw-floating-top-left     { top: 20px; left: 20px; }

.wbw-sw-floating .wbw-sw-trigger {
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    border-color: #e0e0e0;
}
.wbw-sw-floating .wbw-sw-trigger:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.16);
}
/* Float upward for bottom positions */
.wbw-sw-floating-bottom-right .wbw-sw-panel,
.wbw-sw-floating-bottom-left .wbw-sw-panel {
    top: auto; bottom: 100%; margin-top: 0; margin-bottom: 4px;
}
/* Align right for right positions */
.wbw-sw-floating-bottom-right .wbw-sw-panel,
.wbw-sw-floating-top-right .wbw-sw-panel {
    left: auto; right: 0;
}

/* ── JS: Toggle ── */
@media (max-width: 480px) {
    .wbw-sw-floating { bottom: 12px !important; right: 12px !important; left: auto !important; }
}

/* ── Popup / Modal ── */
.wbw-sw-popup-wrap { display: inline-block; }
.wbw-sw-popup-trigger {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; margin: 0;
    background: #fff; border: 1px solid #ddd; border-radius: 8px;
    cursor: pointer; font: inherit; font-size: 14px; color: #333;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.wbw-sw-popup-trigger:hover {
    border-color: #aaa; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Globe button (floating popup) */
.wbw-sw-globe-trigger {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; margin: 0; padding: 0;
    background: #fff; border: none; border-radius: 50%;
    cursor: pointer; font-size: 24px; line-height: 1;
    box-shadow: 0 3px 14px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}
.wbw-sw-globe-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 5px 22px rgba(0,0,0,0.2);
}

/* Overlay */
.wbw-sw-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    justify-content: center; align-items: center;
}
.wbw-sw-overlay.open {
    display: flex;
    animation: wbwFadeIn 0.2s ease;
}

/* Modal */
.wbw-sw-modal {
    position: relative;
    background: #fff; border-radius: 14px;
    padding: 28px 32px 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    max-width: 600px; width: 90%;
    animation: wbwSlideUp 0.25s ease;
}
.wbw-sw-modal-close {
    position: absolute; top: 10px; right: 14px;
    background: none; border: none; cursor: pointer;
    font-size: 22px; color: #999; line-height: 1;
    padding: 4px 8px; border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.wbw-sw-modal-close:hover { background: #f0f0f0; color: #333; }

/* Grid */
.wbw-sw-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}
.wbw-sw-modal-grid .wbw-sw-item {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 15px;
    transition: background 0.15s, border-color 0.15s;
}
.wbw-sw-modal-grid .wbw-sw-item:hover {
    background: #f5f7fa;
    border-color: #e0e0e0;
}
.wbw-sw-modal-grid .wbw-sw-active {
    background: #f0f4ff;
    border-color: #c0d0f0;
    font-weight: 600;
}
.wbw-sw-modal-grid .wbw-sw-flag {
    font-size: 22px;
}

@keyframes wbwFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes wbwSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 480px) {
    .wbw-sw-modal { padding: 20px 18px 16px; border-radius: 12px; }
    .wbw-sw-modal-grid { grid-template-columns: 1fr 1fr; }
}
