/* ── WP Translate — Frontend ─────────────────────────────────────── */

/* Toolbar */
#wpt-toolbar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999990;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1d2327;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,.45);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
}

#wpt-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.5;
    transition: background .15s, border-color .15s;
}

#wpt-toggle:hover {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.7);
}

#wpt-toolbar.wpt-active #wpt-toggle {
    background: #2271b1;
    border-color: #2271b1;
}

#wpt-lang-indicator {
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .05em;
    opacity: .7;
}

/* Translate-mode: force all elements to receive pointer events so
   Bricks' pointer-events:none on headings/blocks doesn't block clicks. */
body.wpt-translate-active * {
    pointer-events: auto !important;
}

/* Translate-mode highlights */
body.wpt-translate-active [data-wpt-source] {
    outline: 2px dashed #f0c000 !important;
    outline-offset: 2px;
    cursor: crosshair !important;
    transition: outline-color .1s;
}

body.wpt-translate-active [data-wpt-source]:hover {
    outline-color: #e65c00 !important;
    background-color: rgba(240,192,0,.07) !important;
}

body.wpt-translate-active [data-wpt-source]:hover {
    outline-color: #e65c00;
    background: rgba(240,192,0,.08);
}

/* Translation panel */
#wpt-panel {
    position: fixed;
    z-index: 999995;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,.22);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    color: #1d2327;
    overflow: hidden;
}

#wpt-panel-inner {
    display: flex;
    flex-direction: column;
}

#wpt-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #1d2327;
    color: #fff;
}

#wpt-panel-title {
    font-size: 12px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: .85;
}

#wpt-panel-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: .7;
    transition: opacity .1s;
}

#wpt-panel-close:hover { opacity: 1; }

#wpt-panel-fields {
    padding: 12px 14px;
    max-height: 55vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wpt-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wpt-field-group label {
    font-size: 11px;
    font-weight: 600;
    color: #50575e;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.wpt-field-group textarea {
    width: 100%;
    min-height: 54px;
    resize: vertical;
    padding: 6px 8px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.45;
    box-sizing: border-box;
    transition: border-color .1s;
}

.wpt-field-group textarea:focus {
    border-color: #2271b1;
    outline: 2px solid rgba(34,113,177,.25);
}

.wpt-field-group.wpt-is-default textarea {
    background: #f6f7f7;
    color: #50575e;
}

#wpt-panel-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid #e2e4e7;
    background: #f6f7f7;
}

#wpt-save-all {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s;
}

#wpt-save-all:hover { background: #135e96; }
#wpt-save-all:disabled { background: #a7aaad; cursor: not-allowed; }

#wpt-save-status {
    font-size: 12px;
    color: #00a32a;
    font-weight: 600;
}

/* Language Switcher — inline / Bricks element */

/* Shrink the Bricks element wrapper to its content so it doesn't
   expand to full column width/height and cause alignment issues. */
[class*="brxe-wpt-language-switcher"],
.brxe-wpt-language-switcher {
    display: inline-flex !important;
    align-items: center;
    width: auto !important;
    height: auto !important;
    line-height: 1;
}

/* Ensure links are always clickable — overrides any Bricks pointer-events:none */
.wpt-lang-switcher a,
.wpt-lang-item a,
.wpt-dropdown-trigger {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.wpt-lang-switcher {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wpt-lang-switcher.wpt-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.wpt-lang-switcher .wpt-lang-item a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s;
}

.wpt-lang-switcher .wpt-lang-item.wpt-current a {
    font-weight: 700;
    border-color: currentColor;
}

/* Flags side by side */
.wpt-lang-switcher.wpt-flags {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wpt-flag-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    padding: 3px 7px;
    border-radius: 4px;
    line-height: 1;
    opacity: .65;
    transition: opacity .15s, background .15s;
    border: 1px solid transparent;
}

.wpt-flag-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,.06);
}

.wpt-flag-btn.wpt-current {
    opacity: 1;
    border-color: currentColor;
    font-weight: 600;
}

/* Dropdown style */
.wpt-dropdown {
    position: relative;
    display: inline-block;
}

.wpt-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 4px 10px;
    font: inherit;
}

.wpt-dropdown-arrow {
    font-size: 10px;
    opacity: .6;
}

.wpt-dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 160px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    z-index: 9999;
    list-style: none;
    padding: 4px 0;
}

.wpt-dropdown.is-open .wpt-dropdown-list { display: block; }
.wpt-dropdown.is-open .wpt-dropdown-trigger { border-radius: 4px 4px 0 0; }

.wpt-dropdown-list .wpt-lang-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    text-decoration: none;
    transition: background .1s;
}

.wpt-dropdown-list .wpt-lang-item a:hover { background: #f0f0f1; }
.wpt-dropdown-list .wpt-lang-item.wpt-current a { font-weight: 700; background: #f0f0f1; }
