/**
 * Nyelvi Bővítmény – frontend styles.
 */

/* Language switcher - no frame, transparent background, the box only as
   wide as the language code (HU) with the caret right after the letters. */
.nyelvi-switcher {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 14px;
    line-height: 1;
    vertical-align: middle;
}

/* "Nyelv:" stays in the markup for screen readers only. */
.nyelvi-switcher-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect( 0 0 0 0 );
    clip-path: inset( 50% );
    white-space: nowrap;
    border: 0;
}

.nyelvi-switcher select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: auto;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font: inherit;
    font-size: inherit;
    color: inherit;
    line-height: 1;
    cursor: pointer;
}

/* Keep the popup list readable even though the control is transparent. */
.nyelvi-switcher select option {
    color: #1d2327;
    background: #fff;
}

/* Downward caret, placed immediately after the language letters. */
.nyelvi-switcher::after {
    content: "";
    display: block;
    flex: 0 0 auto;
    width: 0;
    height: 0;
    margin-top: 1px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
}

/* Frontend edit mode */
body.nyelvi-edit-mode .nyelvi-editable {
    outline: 2px dashed #0073aa;
    background: #f9f9f9;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: text;
}

body.nyelvi-edit-mode .nyelvi-edit-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    padding: 10px 16px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

body.nyelvi-edit-mode .nyelvi-edit-btn:hover {
    background: #005177;
}

/* Admin meta box */
.nyelvi-meta-box {
    font-size: 13px;
}

.nyelvi-meta-box p {
    margin: 8px 0;
}

.nyelvi-lang-group {
    border-top: 1px solid #eee;
    padding-top: 8px;
    margin-top: 8px;
}

.nyelvi-lang-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
}

.nyelvi-lang-group textarea {
    width: 100%;
    min-height: 60px;
    font-family: monospace;
    font-size: 12px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
}

.nyelvi-checkboxes label {
    font-weight: normal;
    margin-right: 12px;
}

/* The switcher only exists where the settings page snippet was pasted, so it
   is laid out in the normal document flow - no fixed positioning here. */

/* ============ Visual translator ============ */

/* Admin bar toggle button */
#wp-admin-bar-nyelvi-translate .nyelvi-ab-icon {
    margin-right: 4px;
}

#wp-admin-bar-nyelvi-translate .nyelvi-ab-globe {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: -3px;
}

/* Blue globe while the translator is off, green while it is on */
#wp-admin-bar-nyelvi-translate .nyelvi-ab-globe-green {
    display: none;
}

body.nyelvi-translate-active #wp-admin-bar-nyelvi-translate .nyelvi-ab-globe-blue {
    display: none;
}

body.nyelvi-translate-active #wp-admin-bar-nyelvi-translate .nyelvi-ab-globe-green {
    display: inline-block;
}

#wp-admin-bar-nyelvi-translate > a {
    cursor: pointer;
}

body.nyelvi-translate-active #wp-admin-bar-nyelvi-translate > a {
    background: #2271b1;
    color: #fff;
}

body.nyelvi-translate-active #wp-admin-bar-nyelvi-translate > a:hover {
    background: #135e96;
    color: #fff;
}

/* Pointer becomes a translator while the mode is on.
   Custom two-tone cursors (black core + white outline) are used instead of the
   system ones so the pointer always contrasts: black on the white popup,
   white outline on dark backgrounds. */
body.nyelvi-translate-active,
body.nyelvi-translate-active * {
    cursor: url( '../img/cursor-crosshair.png' ) 16 16, crosshair !important;
}

body.nyelvi-translate-active #wpadminbar,
body.nyelvi-translate-active #wpadminbar * {
    cursor: default !important;
}

/* Highlight of the hovered text */
.nyelvi-hover {
    background: rgba( 34, 113, 177, 0.10 );
    outline: 1px dashed rgba( 34, 113, 177, 0.75 );
    outline-offset: 2px;
    border-radius: 2px;
}

/* Hovering a segment switches to the black pointer */
body.nyelvi-translate-active .nyelvi-hover,
body.nyelvi-translate-active .nyelvi-target {
    cursor: url( '../img/cursor-arrow.png' ) 2 2, pointer !important;
}

/* Highlight of the text the editor is open for */
.nyelvi-target {
    background: rgba( 34, 113, 177, 0.14 ) !important;
    outline: 2px dashed #2271b1;
    outline-offset: 2px;
    border-radius: 2px;
    transition: background 0.12s ease;
}

/* The popup */
.nyelvi-popup {
    position: absolute;
    z-index: 100000;
    width: 320px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba( 0, 0, 0, 0.18 );
    font-size: 13px;
    line-height: 1.45;
    color: #1d2327;
    cursor: default;
}

/* The popup is white: the pointer turns black over it so it stays visible */
body.nyelvi-translate-active .nyelvi-popup,
body.nyelvi-translate-active .nyelvi-popup * {
    cursor: url( '../img/cursor-arrow.png' ) 2 2, default !important;
}

/* Text fields keep a text cursor, also black with a white outline */
body.nyelvi-translate-active .nyelvi-popup textarea,
body.nyelvi-translate-active .nyelvi-popup select,
body.nyelvi-translate-active .nyelvi-popup input {
    cursor: url( '../img/cursor-text.png' ) 16 16, text !important;
}

.nyelvi-popup[hidden] {
    display: none !important;
}

.nyelvi-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: #f6f7f7;
    border-bottom: 1px solid #c3c4c7;
    border-radius: 6px 6px 0 0;
}

.nyelvi-popup-title {
    font-weight: 600;
}

.nyelvi-popup-close {
    border: 0;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    color: #50575e;
    cursor: pointer;
    padding: 0 4px;
}

.nyelvi-popup-close:hover {
    color: #d63638;
}

.nyelvi-popup-body {
    padding: 10px;
}

.nyelvi-popup-label {
    display: block;
    margin: 8px 0 3px;
    font-weight: 600;
}

.nyelvi-popup-label:first-child {
    margin-top: 0;
}

.nyelvi-popup select,
.nyelvi-popup textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    padding: 5px 7px;
    font-family: inherit;
}

.nyelvi-popup textarea {
    resize: vertical;
    min-height: 66px;
}

.nyelvi-popup textarea:focus,
.nyelvi-popup select:focus {
    border-color: #2271b1;
    outline: 1px solid #2271b1;
    box-shadow: none;
}

.nyelvi-popup-source {
    padding: 6px 7px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    color: #50575e;
    max-height: 84px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.nyelvi-popup-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.nyelvi-btn {
    flex: 1 1 auto;
    border: 1px solid #2271b1;
    border-radius: 4px;
    background: #f6f7f7;
    color: #2271b1;
    font-size: 12px;
    padding: 6px 8px;
    cursor: pointer;
}

.nyelvi-btn:hover:not(:disabled) {
    background: #f0f0f1;
}

.nyelvi-btn-save,
.nyelvi-btn-ok {
    background: #2271b1;
    color: #fff;
}

.nyelvi-btn-save:hover:not(:disabled),
.nyelvi-btn-ok:hover:not(:disabled) {
    background: #135e96;
}

.nyelvi-btn:disabled {
    opacity: 0.55;
    cursor: progress;
}

.nyelvi-popup-status {
    min-height: 16px;
    margin-top: 6px;
    font-size: 12px;
    color: #50575e;
}

.nyelvi-status-ok {
    color: #00844a;
}

.nyelvi-status-error {
    color: #d63638;
}
