/*@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap');*/

@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-Regular.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-Medium.ttf") format("truetype");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-Bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}
/* ========================================================= VARIABLES ========================================================= */
:root {
    --primary-color: #00897b;
    --primary-hover: #00695c;
    --primary-soft: #e0f2f1;
    --primary-softer: #f1fbfa;
    --page-start: #43cea2;
    --page-end: #185a9d;
    --card-bg: rgba(255, 255, 255, 0.96);
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text-main: #2c3e50;
    --text-muted: #607d8b;
    --text-light: #90a4ae;
    --border-color: #cfd8dc;
    --border-soft: #e6ecef;
    --error-color: #e53935;
    --error-bg: #ffebee;
    --success-color: #43a047;
    --focus-ring: rgba(0, 137, 123, 0.25);
    --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.18);
    --shadow-dropdown: 0 12px 28px rgba(31, 48, 61, 0.16);
    --radius-card: 18px;
    --radius-control: 9px;
}
/* ========================================================= RESET ========================================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    min-height: 100%;
    scroll-behavior: smooth;
}
body {
    min-height: 100vh;
    font-family: "Vazirmatn", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif,
    "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji";
    color: var(--text-main);
    background: linear-gradient( 135deg, var(--page-start) 0%, var(--page-end) 100% );
    line-height: 1.5;
}
button, input, select {
    font: inherit;
}
button {
    -webkit-tap-highlight-color: transparent;
}
/* ========================================================= HEADER ========================================================= */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.8rem 2rem;
    background: rgba(24, 90, 157, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.header-inner {
    width: min(100%, 1200px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff;
}
.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--primary-color);
    background: #fff;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.brand-name {
    font-size: 0.95rem;
    font-weight: 700;
}
.lang-btn {
    min-width: 122px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.55);
}
/* ========================================================= PAGE ========================================================= */
.page-container {
    width: min(100% - 2rem, 1200px);
    margin: 0 auto;
    padding: 2rem 0 3rem;
}
.search-card {
    padding: 2.25rem;
    border-radius: var(--radius-card);
    background: var(--card-bg);
    box-shadow: var(--shadow-card);
}
/* ========================================================= PAGE HEADING ========================================================= */
.page-heading {
    margin-bottom: 1.5rem;
}
.section-eyebrow {
    display: inline-block;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.16em;
}
.page-heading h1 {
    font-size: 1.75rem;
    font-weight: 800;
}
.page-heading p {
    max-width: 720px;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.86rem;
}
/* Centered heading variant (used once the SEARCH eyebrow line was removed) */
.page-heading-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.page-heading-centered h1 {
    width: 100%;
}
.page-heading-centered p {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
/* ========================================================= ALERT ========================================================= */
.alert {
    display: none;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 9px;
    font-size: 0.78rem;
}
.alert.error {
    display: block;
    color: var(--error-color);
    background: var(--error-bg);
    border: 1px solid #e8b4b4;
}
.alert.success {
    display: block;
    color: var(--success-color);
    background: #e8f5e9;
    border: 1px solid #c3e6cb;
}
/* ========================================================= BASIC OPTIONS ========================================================= */
.search-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.search-section {
    position: relative;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 2.8rem 1.5rem 1.25rem;
    margin: 0 0 1rem;
    background: rgba(248, 250, 252, 0.45);
}
.search-section > legend {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    width: auto;
    margin: 0;
    padding: 0 0.55rem;
    transform: translateX(-50%);
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    background: var(--card-bg);
}
.search-options-grid .search-section {
    min-height: 150px;
    margin-bottom: 0;
}
/* ========================================================= LANGUAGE / BASIS ========================================================= */
.language-options, .basis-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}
.radio-option, .basis-option {
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.75rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-control);
    background: var(--surface-muted);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.radio-option:hover, .basis-option:hover {
    border-color: #9fc8c2;
    background: #fbfefe;
    transform: translateY(-1px);
}
.radio-option:has(input:checked), .basis-option.active {
    border-color: var(--primary-color);
    background: var(--primary-softer);
    box-shadow: 0 0 0 2px rgba(0, 137, 123, 0.06);
}
.radio-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.radio-mark {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    border: 2px solid #9aaab2;
    border-radius: 50%;
}
.radio-mark::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-color);
    transform: scale(0);
    transition: transform 0.18s ease;
}
.radio-option:has(input:checked) .radio-mark {
    border-color: var(--primary-color);
}
.radio-option:has(input:checked) .radio-mark::after {
    transform: scale(1);
}
.radio-copy, .basis-option > span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.radio-copy strong, .basis-option strong {
    font-size: 0.9rem;
}
.radio-copy small, .basis-option small {
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.73rem;
    line-height: 1.4;
}
.basis-icon {
    flex: 0 0 auto;
    min-width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--primary-color);
    background: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
/* ========================================================= BASIC SEARCH FIELDS ========================================================= */
.fields-section {
    padding-bottom: 1.35rem;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem;
    margin-bottom: 0.15rem;
}
.cv-row {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 0.2rem;
}
.cv-row .form-group {
    width: min(100%, 72%);
}
.form-group {
    position: relative;
    min-width: 0;
    margin-bottom: 1rem;
}
.cv-group {
    margin-top: 0.05rem;
    padding: 1rem 1.15rem 0.35rem;
    border: 1px solid rgba(0, 137, 123, 0.12);
    border-radius: 13px;
    background: linear-gradient( 135deg, rgba(241, 251, 250, 0.65), rgba(248, 250, 252, 0.8) );
}
.form-group label, .advanced-form-group label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 600;
    text-align: center;
}
/* ========================================================= AUTOCOMPLETE INPUTS ========================================================= */
.autocomplete {
    position: relative;
}
.autocomplete-input {
    width: 100%;
    height: 52px;
    padding: 0.75rem 2.7rem 0.75rem 1rem;
    color: var(--text-main);
    background: var(--surface-muted);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-control);
    font-size: 1rem;
    /* Direction/alignment for basic-search inputs is dynamic:
       LTR by default, switched to RTL via [dir="rtl"] below when
       Persian is selected as the search language. */
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, padding 0.15s ease;
}
/* Advanced-search inputs always stay LTR (forced in markup/JS too) */
.advanced-autocomplete-input {
    direction: ltr !important;
    text-align: left !important;
}
.autocomplete-input::placeholder {
    color: #9aaab2;
}
.advanced-autocomplete-input::placeholder {
    color: #9aaab2;
    direction: ltr !important;
    text-align: left !important;
}
.autocomplete-input:hover:not(:disabled), .advanced-autocomplete-input:hover {
    border-color: #aebec5;
}
.autocomplete-input:focus, .advanced-autocomplete-input:focus, .advanced-select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.autocomplete-input.selected, .advanced-autocomplete-input.selected {
    border-color: var(--primary-color);
    background: var(--primary-softer);
}
.advanced-autocomplete-input.selected {
    direction: ltr !important;
    text-align: left !important;
}
.autocomplete-input.invalid-selection, .advanced-autocomplete-input.invalid-selection {
    border-color: var(--error-color);
    background: var(--error-bg);
}
.autocomplete-input:disabled {
    color: #9aaab2;
    background: #eef2f4;
    border-color: #dce3e6;
    cursor: not-allowed;
}
/* ---- RTL mode (Persian search language) for basic-search fields ---- */
.autocomplete-input[dir="rtl"] {
    padding: 0.75rem 1rem 0.75rem 2.7rem;
    text-align: right;
}
.autocomplete-input[dir="rtl"]::placeholder {
    text-align: right;
}
.suggestions-panel[dir="rtl"] {
    direction: rtl;
    text-align: right;
}
.suggestions-panel[dir="rtl"] .suggestion-item {
    text-align: right !important;
    direction: rtl !important;
}
/* ========================================================= CLEAR FIELD BUTTONS ========================================================= */
.clear-field-btn, .advanced-clear-btn {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: 0.65rem;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease, left 0.15s ease, right 0.15s ease;
}
/* When the basic field is RTL (Persian), move the clear (×) button
   to the LEFT end of the field instead of the right. */
.autocomplete:has(.autocomplete-input[dir="rtl"]) .clear-field-btn {
    right: auto;
    left: 0.65rem;
}
.autocomplete:hover .clear-field-btn, .autocomplete:focus-within .clear-field-btn, .advanced-autocomplete:hover .advanced-clear-btn, .advanced-autocomplete:focus-within .advanced-clear-btn {
    opacity: 1;
    pointer-events: auto;
}
.clear-field-btn:hover, .advanced-clear-btn:hover {
    color: var(--text-main);
    background: #e7edef;
}
/* ========================================================= SUGGESTIONS ========================================================= */
.suggestions-panel {
    position: absolute;
    z-index: 100;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    display: none;
    max-height: 230px;
    overflow-y: auto;
    padding: 0.3rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    box-shadow: var(--shadow-dropdown);
    direction: ltr;
}
.suggestions-panel.active {
    display: block;
}
.suggestion-item {
    width: 100%;
    display: block;
    padding: 0.62rem 0.7rem;
    border: 0;
    border-radius: 6px;
    color: var(--text-main);
    background: transparent;
    text-align: left;
    direction: ltr;
    cursor: pointer;
    font-size: 0.84rem;
    line-height: 1.4;
}
/* Advanced-search suggestion panels always stay LTR */
.advanced-suggestions {
    direction: ltr !important;
    text-align: left !important;
}
.advanced-suggestions .suggestion-item {
    text-align: left !important;
    direction: ltr !important;
}
.suggestion-item:hover, .suggestion-item.highlighted {
    color: var(--primary-color);
    background: var(--primary-soft);
    font-weight: 600;
}
.suggestions-empty, .suggestions-loading {
    padding: 0.7rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
}
/* ========================================================= STATUS / NOTES ========================================================= */
.field-status, .advanced-field-status {
    min-height: 1.1rem;
    margin-top: 0.25rem;
    color: var(--error-color);
    font-size: 0.72rem;
}
.selection-note, .advanced-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d8ece9;
    border-radius: 8px;
    color: var(--text-muted);
    background: var(--primary-softer);
    font-size: 0.72rem;
}
.note-icon {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--primary-color);
    font-size: 0.62rem;
    font-weight: 800;
}
/* ========================================================= ADVANCED SEARCH ========================================================= */
.advanced-search-section {
    position: relative;
    margin-top: 1.25rem;
    padding: 1.5rem;
    border: 2px solid rgba(0, 137, 123, 0.22);
    border-radius: 14px;
    background: linear-gradient( 180deg, rgba(241, 251, 250, 0.92), rgba(248, 250, 252, 0.72) );
}
.advanced-search-section[hidden] {
    display: none;
}
.advanced-section-heading {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    margin-bottom: 1.35rem;
    padding: 0.25rem 3rem 1rem;
    border-bottom: 1px solid rgba(0, 137, 123, 0.16);
}
.advanced-heading-content {
    text-align: center;
}
.advanced-section-heading h2 {
    color: var(--primary-color);
    font-size: 1.3rem;
    font-weight: 800;
}
.advanced-section-heading p {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.advanced-collapse-btn {
    position: absolute;
    right: 0;
    top: 50%;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    transform: translateY(-50%);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    background: #fff;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    transition: all 0.2s ease;
}
.advanced-collapse-btn:hover {
    color: var(--error-color);
    border-color: #e8b4b4;
    background: var(--error-bg);
}
/* ========================================================= ADVANCED GRID ========================================================= */
.advanced-fields-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem 1.15rem;
}
.advanced-form-group {
    min-width: 0;
}
.advanced-form-group label {
    font-size: 0.84rem;
}
.advanced-autocomplete {
    position: relative;
}
.advanced-autocomplete-input {
    width: 100%;
    height: 46px;
    padding: 0.65rem 2.4rem 0.65rem 0.8rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-control);
    color: var(--text-main);
    background: #fff;
    font-size: 0.86rem;
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: plaintext;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
/* Force LTR even if JS previously added dir="rtl" */
.advanced-autocomplete-input[dir="rtl"], .advanced-autocomplete-input[dir="ltr"] {
    direction: ltr !important;
    text-align: left !important;
    padding-left: 0.8rem;
    padding-right: 2.4rem;
}
.advanced-select {
    width: 100%;
    height: 46px;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-control);
    color: var(--text-main);
    background: #fff;
    cursor: pointer;
    font-size: 0.86rem;
    direction: ltr !important;
    text-align: left !important;
}
.advanced-select option {
    direction: ltr;
    text-align: left;
}
/* ========================================================= ADVANCED CLEAR ALL ========================================================= */
.advanced-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}
.clear-advanced-fields-btn {
    min-width: 220px;
    min-height: 42px;
    padding: 0.65rem 1.2rem;
    border: 1.5px solid #c9d5d9;
    border-radius: 8px;
    color: var(--text-muted);
    background: #fff;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.clear-advanced-fields-btn:hover {
    color: var(--error-color);
    border-color: #e2b6b6;
    background: #fffafa;
    transform: translateY(-1px);
}
.advanced-note {
    margin-top: 1rem;
}
/* ========================================================= BUTTONS ========================================================= */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin-top: 1.2rem;
}
.btn-primary, .btn-secondary {
    width: min(24rem, 46%);
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease, color 0.25s ease;
}
.btn-primary {
    border: none;
    color: #fff;
    background: var(--primary-color);
}
.btn-primary:not(:disabled):hover {
    background: var(--primary-hover);
    box-shadow: 0 5px 14px rgba(0, 137, 123, 0.35);
    transform: translateY(-1px);
}
.btn-primary.btn-disabled, .btn-primary:disabled {
    background: #90a4ae;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.btn-secondary {
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-softer);
}
.btn-secondary:hover {
    color: #fff;
    background: var(--primary-color);
    box-shadow: 0 5px 14px rgba(0, 137, 123, 0.25);
    transform: translateY(-1px);
}
.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.btn-primary.loading .btn-spinner {
    display: inline-block;
}
.btn-primary.loading .btn-text {
    opacity: 0.9;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
/* ========================================================= LOGIN MODAL ========================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(21, 35, 45, 0.58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.modal-overlay[hidden] {
    display: none;
}
.login-modal {
    position: relative;
    width: min(100%, 430px);
    padding: 2rem 2rem 1.75rem;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    text-align: center;
    animation: modalAppear 0.2s ease-out;
}
@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.modal-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    background: #fff;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}
.modal-close-btn:hover {
    color: var(--error-color);
    background: var(--error-bg);
}
.modal-icon {
    margin-bottom: 0.75rem;
    font-size: 2rem;
}
.login-modal h2 {
    font-size: 1.2rem;
}
.login-modal p {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin-top: 1.25rem;
}
.modal-actions a {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    transition: all 0.2s ease;
}
.modal-login-btn {
    color: #fff;
    background: var(--primary-color);
}
.modal-login-btn:hover {
    background: var(--primary-hover);
}
.modal-signup-btn {
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    background: var(--primary-softer);
}
.modal-signup-btn:hover {
    color: #fff;
    background: var(--primary-color);
}
/* ========================================================= RESULTS ========================================================= */
.temporary-results {
    margin-top: 1rem;
    padding: 1.25rem;
    border-radius: var(--radius-card);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-card);
}
.results-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}
.results-header h2 {
    color: var(--text-main);
    font-size: 1.15rem;
    font-weight: 800;
    text-align: center;
}
.sr-only-status {
    display: none !important;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 0.7rem;
    font-weight: 700;
}
.response-output {
    max-height: 420px;
    overflow: auto;
    padding: 0.9rem;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: #f7f9fa;
    color: #263238;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.75rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    direction: ltr;
    text-align: left;
}
/* ========================================================= DISABLED CV ========================================================= */
.cv-group.is-disabled {
    opacity: 0.78;
}
.cv-group.is-disabled label {
    color: var(--text-light);
}
/* ========================================================= RESPONSIVE ========================================================= */
@media (max-width: 1000px) {
    .advanced-fields-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 900px) {
    .page-container {
        width: min(100% - 1.5rem, 900px);
    }
    .search-card {
        padding: 1.75rem 2rem;
    }
}
@media (max-width: 700px) {
    .header {
        padding: 0.7rem 1rem;
    }
    .header-inner {
        max-width: none;
    }
    .brand-name {
        display: none;
    }
    .lang-btn {
        min-width: 112px;
        font-size: 0.78rem;
    }
    .page-container {
        width: min(100% - 1rem, 900px);
        padding-top: 0.25rem;
    }
    .search-card {
        padding: 1.35rem 1rem;
        border-radius: 14px;
    }
    .page-heading {
        margin-bottom: 1.35rem;
    }
    .page-heading h1 {
        font-size: 1.55rem;
    }
    .page-heading p {
        font-size: 0.84rem;
    }
    .search-options-grid {
        grid-template-columns: 1fr;
    }
    .search-section {
        padding: 2.4rem 0.85rem 0.9rem;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .cv-row .form-group {
        width: 100%;
    }
    .advanced-search-section {
        padding: 1rem;
    }
    .advanced-fields-grid {
        grid-template-columns: 1fr;
    }
    .form-actions {
        flex-direction: column;
    }
    .btn-primary, .btn-secondary {
        width: min(100%, 360px);
    }
    .temporary-results {
        border-radius: 14px;
        padding: 1rem;
    }
}
@media (max-width: 520px) {
    .language-options, .basis-switch, .modal-actions {
        grid-template-columns: 1fr;
    }
    .search-section > legend {
        font-size: 0.88rem;
    }
    .lang-btn {
        min-width: 106px;
    }
    .login-modal {
        padding: 1.7rem 1.25rem 1.4rem;
    }
}
@media (max-width: 420px) {
    .search-card {
        padding: 1.15rem 0.85rem;
    }
    .page-heading h1 {
        font-size: 1.4rem;
    }
    .search-section > legend {
        font-size: 0.84rem;
    }
    .autocomplete-input {
        height: 46px;
    }
    .advanced-section-heading {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* =========================================================
   SPECIAL CHARACTERS KEYBOARD
========================================================= */
.has-char-keyboard .advanced-autocomplete-input {
    padding-right: 4.9rem;               /* make room for the extra button */
}

.char-keyboard-btn {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: 2.6rem;                       /* sits to the LEFT of the clear (×) button */
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
}
.char-keyboard-btn:hover,
.char-keyboard-btn:focus,
.char-keyboard-btn[aria-expanded="true"] {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--primary-softer);
}

.char-keyboard {
    position: absolute;
    z-index: 300;                        /* above .suggestions-panel (z-index 100) */
    top: auto;
    bottom: calc(100% + 6px);               /* opens below the input */
    left: 0;
    right: 0;
    display: none;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.85rem 0.45rem 0.45rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-dropdown);
    direction: ltr;
}
.char-keyboard.active {
    display: flex;
}

.char-keyboard-close {
    position: absolute;
    top: 0.28rem;
    right: 0.3rem;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
}
.char-keyboard-close:hover,
.char-keyboard-close:focus {
    color: var(--error-color);
    background: #fdecea;
}

.char-key {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fafcfd;
    color: var(--text-main);
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.char-key:hover,
.char-key:focus {
    border-color: var(--primary-color);
    background: var(--primary-softer);
    color: var(--primary-hover);
}
.char-glyph {
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 600;
}
.char-hint {
    font-size: 0.66rem;
    line-height: 1.1;
    color: var(--text-muted);
    pointer-events: none;   /* hint is visible but never clickable */
    user-select: none;
}

/* =========================================================
   RESULTS TABLE (NEW)
========================================================= */
.results-header-right {
    position: absolute;
    right: 0;
    top: 50%;
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateY(-50%);
}
.per-page-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.per-page-control label {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}
.per-page-control select {
    height: 32px;
    padding: 0.2rem 0.5rem;
    border: 1.5px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    color: var(--text-main);
    font-size: 0.8rem;
    cursor: pointer;
}
.per-page-control select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.results-table-wrapper {
    margin-top: 0.5rem;
}
/* The scroll container starts with no horizontal scroll (table fits
   its container on first load). Once the user drags a column wider
   than the container can hold, JS adds .is-overflowing here, which
   is what actually turns scrolling on. */
.table-scroll {
    overflow-x: hidden;
    overflow-y: visible;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.table-scroll.is-overflowing {
    overflow-x: auto;
}
.results-table {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.8rem;
}
/* When columns have been widened past the container, the table
   itself grows past 100% instead of squeezing back down, which is
   what makes the scrollbar meaningful. */
.table-scroll.is-overflowing .results-table {
    width: max-content;
    min-width: 100%;
}
.results-table thead th {
    position: relative;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.7rem 0.9rem 0.7rem 0.75rem;
    color: #fff;
    background: var(--primary-color);
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.74rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.01em;
    /* Column widths are sized wide enough (via JS) to fit the full
       header label on one line, so headers no longer need to
       truncate/wrap. */
    white-space: nowrap;
    overflow: visible;
}
.results-table thead th:last-child {
    border-right: none;
}
/* Two-row grouped header: row 1 shows group labels (Verb / PreVerb /
   Compound Verb) with no abbreviation-hover tooltip of their own;
   row 2 shows the actual sub-column abbreviations and keeps the
   existing hover-tooltip behavior untouched. */
.results-table thead tr.th-group-row th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.results-table thead tr.th-group-row th.th-group {
    text-align: center;
}
.results-table thead tr.th-group-row th[rowspan] {
    vertical-align: middle;
}
.results-table thead tr.th-group-row th[rowspan="2"] {
    top: 0;
}
/* .results-table thead tr.th-sub-row th { top: ... } is set inline by
   JS (syncGroupHeaderStickyOffset), since the group row's rendered
   height varies across breakpoints/zoom and must be measured. */
.results-table thead th > .th-label-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    max-width: 100%;
}
.results-table thead th > .th-label-wrap > .th-label {
    display: inline-block;
    overflow: visible;
    white-space: nowrap;
}
/* Instant custom tooltip for column headers (full field name).
   Now anchored directly on the header cell (th) itself instead of
   a dedicated help-icon element, so hovering/focusing anywhere on
   the header reveals the full column name without adding any
   extra width to the header row. */
.results-table thead th[data-tooltip] {
    cursor: help;
}
.results-table thead th[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: #263238;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: normal;
    white-space: nowrap;
    text-transform: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 20;
}
.results-table thead th[data-tooltip]:hover::after,
.results-table thead th[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Column resize handle — one lives in every header cell only, and
   is confined to that cell's own height. Dragging is only possible
   from the header row's borders; body-row borders are not
   resizable/draggable at all. */
.col-resize-handle {
    position: absolute;
    top: 0;
    right: -5px;
    width: 11px;
    height: 100%;
    cursor: col-resize;
    z-index: 6;
    touch-action: none;
    user-select: none;
}
.col-resize-handle::after {
    content: "";
    position: absolute;
    top: 15%;
    bottom: 15%;
    left: 5px;
    width: 2px;
    background: rgba(255, 255, 255, 0.35);
    transition: background 0.15s ease, width 0.15s ease, left 0.15s ease;
}
.col-resize-handle:hover::after,
.col-resize-handle.is-resizing::after {
    left: 4px;
    width: 3px;
    background: #fff;
}
.results-table.is-resizing-cols {
    cursor: col-resize;
    user-select: none;
}
.results-table.is-resizing-cols thead th,
.results-table.is-resizing-cols tbody td {
    user-select: none;
}
.results-table tbody td {
    position: relative;
    padding: 0.65rem 0.75rem;
    border-right: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-main);
    vertical-align: top;
    line-height: 1.5;
    overflow-wrap: normal;
    word-break: normal;
    /* Individual words must never split across lines; wrapping onto
       a new line is fine at word boundaries only. */
    hyphens: none;
}
/* Briefly applied by JS while measuring each column's natural
   content width, so multi-word cells report their true single-line
   width instead of a width distorted by the table's current
   (possibly narrow) layout. */
.results-table.is-measuring td,
.results-table.is-measuring th {
    white-space: nowrap;
}
.results-table tbody td:last-child {
    border-right: none;
}
.results-table tbody tr.data-row:nth-child(4n+1) {
    background: var(--surface-muted);
}
.results-table tbody tr.data-row:hover {
    background: var(--primary-softer);
}
.results-table tbody tr.data-row.expanded {
    background: var(--primary-soft);
}
.results-table .row-index {
    color: var(--text-muted);
    font-weight: 700;
    text-align: center;
}
.results-table .cell-empty {
    color: var(--text-light);
    font-style: italic;
}
.cell-multi-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.cell-multi-list li {
    position: relative;
    padding-left: 0.7rem;
}
.cell-multi-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}
.cell-multi-badge {
    display: inline-block;
    margin-top: 0.2rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 0.62rem;
    font-weight: 700;
}

/* Details button */
.details-btn {
    min-width: 108px;
    padding: 0.4rem 0.7rem;
    border: 1.5px solid var(--primary-color);
    border-radius: 7px;
    color: var(--primary-color);
    background: var(--primary-softer);
    cursor: pointer;
    font-size: 0.73rem;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}
.details-btn:hover {
    color: #fff;
    background: var(--primary-color);
}
.details-btn.is-open {
    color: #fff;
    background: var(--text-muted);
    border-color: var(--text-muted);
}
.details-btn.is-open:hover {
    background: #47606b;
}

/* Detail row / card */
.detail-row td {
    padding: 0;
    background: #fbfefe;
    border-right: none;
}
.detail-row.is-hidden {
    display: none;
}
.detail-card {
    padding: 0 1.4rem 1.3rem;
    border-top: 2px dashed var(--border-color);
    border-bottom: 1px solid var(--border-soft);
}
.detail-card-heading {
    margin: 0 -1.4rem 1rem;
    padding: 0.55rem 1.4rem;
    color: var(--primary-color);
    background: var(--primary-soft);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem 0.9rem;
}
.detail-item {
    min-width: 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.55);
}
.detail-item .detail-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.detail-help-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1px solid var(--text-light);
    color: var(--text-light);
    background: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    text-transform: none;
    letter-spacing: 0;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.detail-help-icon:hover,
.detail-help-icon:focus-visible {
    border-color: var(--primary-color);
    color: #fff;
    background: var(--primary-color);
}
/* Custom instant tooltip (native title tooltips are slow / don't
   work on touch). Positioned above the icon, appears immediately
   on hover or keyboard focus. */
.detail-help-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 7px);
    transform: translateX(-50%) translateY(4px);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: #263238;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: normal;
    white-space: nowrap;
    text-transform: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 20;
}
.detail-help-icon::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #263238;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 20;
}
.detail-help-icon:hover::after,
.detail-help-icon:hover::before,
.detail-help-icon:focus-visible::after,
.detail-help-icon:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.detail-item .detail-value {
    color: var(--text-main);
    font-size: 0.82rem;
    line-height: 1.55;
    word-break: break-word;
}
.detail-item.detail-example {
    background: var(--surface-muted);
    border-color: var(--border-color);
}
.detail-item.detail-example .detail-value {
    padding: 0.6rem 0.75rem;
    border-left: 3px solid var(--primary-color);
    background: #fff;
    border-radius: 0 6px 6px 0;
    white-space: pre-wrap;
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
}
.detail-item.full-width {
    grid-column: 1 / -1;
}

/* Results summary */
.results-summary {
    margin: 0.8rem 0.1rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-align: center;
}

/* Pagination */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.4rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-soft);
}
.page-nav-btn {
    min-height: 34px;
    padding: 0.4rem 0.8rem;
    border: 1.5px solid var(--border-color);
    border-radius: 7px;
    color: var(--text-main);
    background: #fff;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 700;
    transition: all 0.18s ease;
}
.page-nav-btn:hover:not(:disabled) {
    color: #fff;
    border-color: var(--primary-color);
    background: var(--primary-color);
}
.page-nav-btn:disabled {
    color: var(--text-light);
    background: #f2f5f6;
    cursor: not-allowed;
}
.page-numbers {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0 0.3rem;
}
.page-number-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 0.4rem;
    border: 1.5px solid var(--border-color);
    border-radius: 7px;
    color: var(--text-main);
    background: #fff;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 700;
    transition: all 0.18s ease;
}
.page-number-btn:hover:not(.is-current) {
    border-color: var(--primary-color);
    background: var(--primary-softer);
}
.page-number-btn.is-current {
    color: #fff;
    border-color: var(--primary-color);
    background: var(--primary-color);
    cursor: default;
}
.page-ellipsis {
    padding: 0 0.2rem;
    color: var(--text-light);
    font-size: 0.8rem;
    user-select: none;
}

@media (max-width: 700px) {
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
    .results-header-right {
        width: 100%;
        justify-content: space-between;
    }
    .detail-card {
        padding: 1rem;
    }
    .pagination-bar {
        gap: 0.3rem;
    }
    .page-nav-btn {
        padding: 0.35rem 0.55rem;
        font-size: 0.7rem;
    }
}

/* ========================================================= RESULTS TABLE — RESPONSIVE ========================================================= */
/* On phones/tablets, columns wide enough to hold full words and full
   header labels can no longer all fit on screen at once — squeezing
   them back down would recreate the exact word-splitting problem we
   just fixed. So below this breakpoint the table simply scrolls
   horizontally inside its rounded container (which itself stays
   full-width and readable), instead of trying to cram every column
   into a narrow viewport. */
@media (max-width: 900px) {
    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .results-table {
        width: max-content;
        min-width: 100%;
    }
}
@media (max-width: 700px) {
    .results-table-wrapper {
        margin-top: 0.35rem;
    }
    .table-scroll {
        border-radius: 8px;
    }
    .results-table {
        font-size: 0.74rem;
    }
    .results-table thead th {
        padding: 0.6rem 0.7rem 0.6rem 0.6rem;
        font-size: 0.68rem;
    }
    .results-table tbody td {
        padding: 0.55rem 0.6rem;
    }
    .details-btn {
        min-width: 88px;
        padding: 0.35rem 0.55rem;
        font-size: 0.68rem;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .detail-card-heading {
        margin: 0 -1rem 0.85rem;
        padding: 0.5rem 1rem;
    }
    .per-page-control label {
        font-size: 0.7rem;
    }
    .results-summary {
        font-size: 0.72rem;
    }
}
@media (max-width: 480px) {
    .results-table {
        font-size: 0.7rem;
    }
    .results-table thead th {
        padding: 0.55rem 0.6rem;
        font-size: 0.64rem;
    }
    .results-table tbody td {
        padding: 0.5rem 0.55rem;
    }
    .pagination-bar {
        justify-content: center;
    }
    .page-numbers {
        order: 1;
        width: 100%;
        justify-content: center;
        margin: 0.3rem 0 0;
    }
}
