/* ============================================================
   WP Universal Translator v7.3 — Vertical Equal Layout
   ============================================================ */

#wut-widget,
#wut-widget *,
#wut-widget *::before,
#wut-widget *::after {
    box-sizing: border-box;
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ── Widget Root ─────────────────────────────────────────── */
#wut-widget {
    position: fixed;
    z-index: 999999;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#wut-widget.pos-bottom-right { bottom: 24px; right: 24px; }
#wut-widget.pos-bottom-left  { bottom: 24px; left:  24px; }
#wut-widget.pos-top-right    { top:    24px; right: 24px; }
#wut-widget.pos-top-left     { top:    24px; left:  24px; }

/* ═══════════════════════════════════════════════════════════
   TRIGGER BUTTON
   ═══════════════════════════════════════════════════════════ */
#wut-btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             8px;
    cursor:          pointer;
    border:          none;
    outline:         none;
    font-weight:     700;
    font-size:       14px;
    white-space:     nowrap;
    overflow:        hidden;
    position:        relative;
    transition:      transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow:      0 4px 18px rgba(0,0,0,0.22), 0 1px 4px rgba(0,0,0,0.10);
}
#wut-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 55%);
    pointer-events: none;
}

#wut-widget.size-small  #wut-btn { height: 38px; padding: 0 14px; font-size: 12px; gap: 6px; }
#wut-widget.size-medium #wut-btn { height: 46px; padding: 0 20px; font-size: 14px; }
#wut-widget.size-large  #wut-btn { height: 56px; padding: 0 26px; font-size: 16px; }

#wut-widget.shape-round  #wut-btn { border-radius: 999px; }
#wut-widget.shape-pill   #wut-btn { border-radius: 30px; }
#wut-widget.shape-square #wut-btn { border-radius: 10px; }

#wut-btn:hover  { transform: translateY(-3px); box-shadow: 0 8px 26px rgba(0,0,0,0.25); filter: brightness(1.07); }
#wut-btn:active { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,0.18); }

#wut-btn-icon {
    font-size: 1.2em;
    line-height: 1;
    display: inline-block;
    transition: transform 0.3s ease;
}
#wut-widget.is-open #wut-btn-icon { transform: rotate(15deg); }

/* ═══════════════════════════════════════════════════════════
   DROPDOWN PANEL
   ═══════════════════════════════════════════════════════════ */
#wut-panel {
    position:      absolute;
    width:         240px;
    background:    #ffffff;
    border-radius: 18px;
    box-shadow:    0 20px 50px rgba(0,0,0,0.16),
                   0  4px 14px rgba(0,0,0,0.08),
                   0  0   0 1px rgba(0,0,0,0.05);
    overflow:      hidden;
    display:       none;
}

.pos-bottom-right #wut-panel,
.pos-bottom-left  #wut-panel { bottom: calc(100% + 12px); }
.pos-top-right    #wut-panel,
.pos-top-left     #wut-panel { top: calc(100% + 12px); }
.pos-bottom-right #wut-panel,
.pos-top-right    #wut-panel { right: 0; }
.pos-bottom-left  #wut-panel,
.pos-top-left     #wut-panel { left: 0; }

/* Animations */
#wut-widget.anim-fade  #wut-panel {
    opacity: 0;
    transform: scale(0.95) translateY(6px);
    transition: opacity 0.2s ease, transform 0.22s cubic-bezier(.34,1.56,.64,1);
}
#wut-widget.anim-slide #wut-panel {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(.34,1.56,.64,1);
}
#wut-widget.anim-none #wut-panel { transition: none; }

#wut-widget.pos-top-right #wut-panel,
#wut-widget.pos-top-left  #wut-panel { transform: translateY(-12px) scale(0.97); }

#wut-widget.is-open.anim-fade  #wut-panel,
#wut-widget.is-open.anim-slide #wut-panel {
    opacity: 1;
    transform: scale(1) translateY(0) !important;
}

/* Panel Header */
#wut-panel-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         14px 14px 12px;
    background:      linear-gradient(135deg, #f8f9ff 0%, #f0f2fe 100%);
    border-bottom:   1px solid #eaecf5;
}
#wut-panel-title {
    font-size:      10px;
    font-weight:    800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color:          #9095b0;
}
#wut-close-btn {
    width:  26px; height: 26px;
    border: none; border-radius: 50%;
    background:      rgba(0,0,0,0.07);
    color:           #777;
    font-size:       12px;
    cursor:          pointer;
    display:         flex;
    align-items:     center;
    justify-content: center;
    transition:      background 0.15s, color 0.15s, transform 0.2s;
    line-height:     1;
    flex-shrink:     0;
}
#wut-close-btn:hover {
    background: rgba(0,0,0,0.13);
    color: #111;
    transform: rotate(90deg);
}

/* ═══════════════════════════════════════════════════════════
   LANGUAGE LIST — VERTICAL, ALL EQUAL WIDTH & HEIGHT
   ═══════════════════════════════════════════════════════════ */
#wut-lang-list {
    list-style:  none;
    padding:     8px;
    margin:      0;
    max-height:  360px;
    overflow-y:  auto;
    scrollbar-width: thin;
    scrollbar-color: #dde1f0 transparent;

    /* Single column — full width each */
    display:        flex;
    flex-direction: column;
    gap:            4px;           /* small, clean gap */
}
#wut-lang-list::-webkit-scrollbar       { width: 3px; }
#wut-lang-list::-webkit-scrollbar-thumb { background: #dde1f0; border-radius: 3px; }

#wut-lang-list li {
    display: block;
    margin:  0;
    padding: 0;
    width:   100%;
}

/* ── Language Button — full width, fixed height ──────────── */
.wut-lang-btn {
    display:         flex;
    align-items:     center;
    gap:             10px;
    width:           100%;          /* full panel width */
    height:          42px;          /* fixed equal height */
    padding:         0 12px;
    background:      #f5f6fc;
    border:          1.5px solid transparent;
    border-radius:   10px;
    cursor:          pointer;
    font-size:       13px;
    font-weight:     500;
    font-family:     inherit;
    color:           #2d3047;
    transition:      background 0.15s ease, border-color 0.15s ease,
                     color 0.15s ease, transform 0.15s ease,
                     box-shadow 0.15s ease;
    overflow:        hidden;
    white-space:     nowrap;
    flex-shrink:     0;
}

.wut-lang-btn:hover {
    background:   #eaecfb;
    border-color: rgba(99,102,241,0.28);
    color:        #3730a3;
    transform:    translateX(3px);
    box-shadow:   0 2px 10px rgba(99,102,241,0.12);
}
.wut-lang-btn:active { transform: translateX(1px); }

.wut-lang-btn.active {
    background:  linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: #4338ca;
    color:        #ffffff;
    font-weight:  700;
    box-shadow:   0 3px 14px rgba(99,102,241,0.35);
    transform:    translateX(3px);
}
.wut-lang-btn.active:hover { filter: brightness(1.08); }

.wut-lang-flag {
    font-size:   17px;
    line-height: 1;
    flex-shrink: 0;
    width:       22px;
    text-align:  center;
}
.wut-lang-name {
    flex:           1;
    overflow:       hidden;
    text-overflow:  ellipsis;
    white-space:    nowrap;
    font-size:      13px;
}
.wut-lang-tick {
    font-size:   11px;
    font-weight: 900;
    opacity:     0;
    transform:   scale(0);
    transition:  all 0.18s ease;
    flex-shrink: 0;
    margin-left: auto;
    color:       rgba(255,255,255,0.9);
}
.wut-lang-btn.active .wut-lang-tick {
    opacity:   1;
    transform: scale(1);
}

/* ── Show Original ───────────────────────────────────────── */
#wut-original-btn {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             7px;
    width:           calc(100% - 16px);
    height:          38px;
    margin:          2px 8px 8px;
    padding:         0 12px;
    background:      transparent;
    border:          1.5px dashed #dde1f0;
    border-radius:   10px;
    cursor:          pointer;
    font-size:       12px;
    font-weight:     600;
    font-family:     inherit;
    color:           #9095b0;
    transition:      all 0.15s ease;
    letter-spacing:  0.02em;
    white-space:     nowrap;
}
#wut-original-btn:hover {
    background:   #fff5f5;
    border-color: #fca5a5;
    color:        #ef4444;
}
#wut-original-btn.is-active {
    background:   #fff5f5;
    border-color: #f87171;
    color:        #dc2626;
    font-weight:  700;
}

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */
#wut-toast-wrap {
    position:       fixed;
    z-index:        9999999;
    bottom:         90px;
    left:           50%;
    transform:      translateX(-50%);
    pointer-events: none;
    width:          max-content;
    max-width:      calc(100vw - 32px);
}
#wut-toast {
    display:       none;
    align-items:   center;
    gap:           9px;
    padding:       11px 20px;
    border-radius: 50px;
    font-size:     13px;
    font-weight:   600;
    font-family:   inherit;
    box-shadow:    0 6px 24px rgba(0,0,0,0.18);
    animation:     wut-toast-in 0.22s ease;
    white-space:   nowrap;
}
#wut-toast.show           { display: flex; background: rgba(26,36,110,0.93); color: #fff; }
#wut-toast.show.is-error  { background: rgba(185,28,28,0.93); }
#wut-toast.show.is-warning{ background: rgba(120,80,10,0.93); }

.wut-spinner {
    width:  15px; height: 15px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wut-spin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes wut-spin     { to { transform: rotate(360deg); } }
@keyframes wut-toast-in { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }

/* ═══════════════════════════════════════════════════════════
   MOBILE — bottom sheet, same vertical layout
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 520px) {

    #wut-widget.pos-bottom-right { bottom: 16px; right: 16px; }
    #wut-widget.pos-bottom-left  { bottom: 16px; left:  16px; }
    #wut-widget.pos-top-right    { top:    16px; right: 16px; }
    #wut-widget.pos-top-left     { top:    16px; left:  16px; }

    #wut-panel {
        position:      fixed !important;
        bottom:        0 !important;
        left:          0 !important;
        right:         0 !important;
        top:           auto !important;
        width:         100% !important;
        border-radius: 22px 22px 0 0 !important;
        box-shadow:    0 -6px 40px rgba(0,0,0,0.16) !important;
        transform:     translateY(100%) !important;
        transition:    transform 0.3s cubic-bezier(0.32,0.72,0,1) !important;
        opacity:       1 !important;
    }
    #wut-widget.is-open.anim-fade  #wut-panel,
    #wut-widget.is-open.anim-slide #wut-panel,
    #wut-widget.is-open.anim-none  #wut-panel {
        transform: translateY(0) !important;
        opacity:   1 !important;
    }

    /* Pull indicator */
    #wut-panel-header {
        position:    relative;
        padding-top: 22px;
    }
    #wut-panel-header::before {
        content:       '';
        position:      absolute;
        top:           10px;
        left:          50%;
        transform:     translateX(-50%);
        width:         36px; height: 4px;
        background:    rgba(0,0,0,0.13);
        border-radius: 2px;
    }

    /* Same vertical list on mobile */
    #wut-lang-list {
        max-height:  58vh;
        gap:         4px;
        padding:     8px;
    }

    /* Slightly taller for touch */
    .wut-lang-btn { height: 46px; }

    /* Backdrop */
    #wut-widget.is-open::before {
        content:    '';
        position:   fixed;
        inset:      0;
        background: rgba(0,0,0,0.36);
        z-index:    -1;
        animation:  wut-bd-in 0.2s ease forwards;
    }
    @keyframes wut-bd-in { from { opacity:0; } to { opacity:1; } }

    #wut-toast-wrap { bottom: auto; top: 18px; }
}

/* ═══════════════════════════════════════════════════════════
   SHORTCODE BUTTON
   ═══════════════════════════════════════════════════════════ */
.wut-inline-btn {
    display:     inline-flex;
    align-items: center;
    gap:         8px;
    padding:     10px 20px;
    background:  linear-gradient(135deg, #6366f1, #4f46e5);
    color:       #fff;
    border:      none;
    border-radius: 50px;
    font-size:   14px;
    font-weight: 700;
    font-family: inherit;
    cursor:      pointer;
    box-shadow:  0 4px 14px rgba(99,102,241,0.35);
    transition:  transform 0.18s ease, box-shadow 0.18s ease;
}
.wut-inline-btn:hover {
    transform:  translateY(-2px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.45);
}

/* ═══════════════════════════════════════════════════════════
   RTL
   ═══════════════════════════════════════════════════════════ */
[dir="rtl"] #wut-widget.pos-bottom-right { right: auto; left:  24px; }
[dir="rtl"] #wut-widget.pos-bottom-left  { left:  auto; right: 24px; }
[dir="rtl"] #wut-widget.pos-top-right    { right: auto; left:  24px; }
[dir="rtl"] #wut-widget.pos-top-left     { left:  auto; right: 24px; }
[dir="rtl"] .wut-lang-btn:hover,
[dir="rtl"] .wut-lang-btn.active { transform: translateX(-3px); }
