/* ============================================================================
 * SAWYAN V3.0 — Smart Multilingual Autocomplete & Native Locale Combobox CSS
 * - Instant first-letter inline ghost autocomplete (RTL Arabic & LTR English)
 * - Strict language-native alphabetical letter dividers (أ ب ت ث ج / A B C D)
 * - Mobile-first (44px+ touch targets, 16px input font, zero horizontal overflow)
 * ============================================================================ */

.sw-ss-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    font-family: var(--font-family-arabic, 'Tajawal', 'Cairo', sans-serif);
}

.sw-ss-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    min-height: 0 !important;
}

.sw-ss-control {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: #ffffff;
    border: 2px solid var(--color-gray-200, #e2e8f0);
    border-radius: var(--border-radius-lg, 12px);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
    min-height: 48px;
}

.sw-ss-wrap.sw-ss-compact .sw-ss-control {
    min-height: 42px;
    border-width: 1.5px;
    border-radius: 10px;
}

.sw-ss-control:hover {
    border-color: #94a3b8;
}

.sw-ss-wrap.is-open .sw-ss-control,
.sw-ss-control:focus-within {
    border-color: var(--color-primary, #059669);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

.sw-ss-wrap.is-valid .sw-ss-control {
    border-color: #10b981;
}

.sw-ss-wrap.is-invalid .sw-ss-control {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.sw-ss-wrap.is-disabled .sw-ss-control {
    background: #f1f5f9;
    opacity: 0.72;
    pointer-events: none;
}

.sw-ss-prefix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline-start: 12px;
    padding-inline-end: 2px;
    font-size: 1.1rem;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
}

.sw-ss-input-stage {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.sw-ss-ghost {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    padding: 10px 10px;
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.sw-ss-ghost-typed {
    color: transparent;
}

.sw-ss-ghost-rest {
    color: #94a3b8;
    font-weight: 500;
}

.sw-ss-input {
    position: relative;
    z-index: 2;
    width: 100%;
    min-width: 0;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 10px 10px;
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text, #0f172a);
}

.sw-ss-wrap.sw-ss-compact .sw-ss-input,
.sw-ss-wrap.sw-ss-compact .sw-ss-ghost {
    padding: 7px 9px;
    font-size: 0.9rem;
}

.sw-ss-input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.sw-ss-tab-hint {
    display: none;
    align-items: center;
    padding: 2px 6px;
    margin-inline-end: 4px;
    border-radius: 6px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
}

.sw-ss-tab-hint.visible {
    display: inline-flex;
}

.sw-ss-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding-inline-end: 8px;
    flex-shrink: 0;
}

.sw-ss-clear-btn,
.sw-ss-toggle-btn {
    border: none;
    background: transparent;
    color: #64748b;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.18s ease;
    font-size: 0.9rem;
    padding: 0;
}

.sw-ss-clear-btn:hover,
.sw-ss-toggle-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.sw-ss-clear-btn {
    display: none;
    font-size: 0.82rem;
    font-weight: 800;
}

.sw-ss-wrap.has-value .sw-ss-clear-btn,
.sw-ss-wrap.has-query .sw-ss-clear-btn {
    display: inline-flex;
}

.sw-ss-wrap.is-open .sw-ss-toggle-btn svg {
    transform: rotate(180deg);
}

.sw-ss-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.18s ease;
}

/* Dropdown Panel */
.sw-ss-panel {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    z-index: 1200;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
    display: none;
    flex-direction: column;
    overflow: hidden;
    max-width: 100%;
}

.sw-ss-wrap.is-open .sw-ss-panel {
    display: flex;
}

.sw-ss-wrap.open-up .sw-ss-panel {
    top: auto;
    bottom: calc(100% + 6px);
}

.sw-ss-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.74rem;
    font-weight: 700;
    color: #475569;
    flex-wrap: wrap;
}

.sw-ss-meta-lang {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #047857;
}

.sw-ss-quick-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: #f0fdf4;
    border-bottom: 1px solid #dcfce7;
    overflow-x: auto;
    flex-wrap: wrap;
}

.sw-ss-quick-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: #065f46;
    white-space: nowrap;
}

.sw-ss-quick-chip {
    border: 1px solid #a7f3d0;
    background: #ffffff;
    color: #065f46;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.sw-ss-quick-chip:hover {
    background: #059669;
    border-color: #059669;
    color: #ffffff;
}

.sw-ss-quick-chip.is-suggested {
    border-color: #059669;
    background: #ecfdf5;
}

.sw-ss-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 270px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sw-ss-letter-hdr {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 4px 12px;
    background: #f1f5f9;
    color: #0f766e;
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.sw-ss-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    min-height: 42px;
    cursor: pointer;
    transition: background-color 0.12s ease;
    border-bottom: 1px solid #f8fafc;
}

.sw-ss-option:last-child {
    border-bottom: none;
}

.sw-ss-option:hover,
.sw-ss-option.is-active {
    background: #ecfdf5;
}

.sw-ss-option.is-selected {
    background: #d1fae5;
}

.sw-ss-opt-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.sw-ss-opt-flag {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
}

.sw-ss-opt-texts {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sw-ss-opt-primary {
    font-size: 0.93rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sw-ss-opt-secondary {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sw-ss-opt-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sw-ss-dial-pill {
    background: #f1f5f9;
    color: #334155;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.74rem;
    font-weight: 700;
    direction: ltr;
}

.sw-ss-badge-active {
    background: #dcfce7;
    color: #047857;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
}

.sw-ss-mark {
    background: #fef08a;
    color: #0f172a;
    border-radius: 3px;
    padding: 0 1px;
    font-weight: 900;
}

.sw-ss-empty {
    padding: 16px 14px;
    text-align: center;
    color: #64748b;
    font-size: 0.86rem;
    font-weight: 600;
}

.sw-ss-manual-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: #fffbeb;
    border-top: 1px solid #fde68a;
    color: #92400e;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
    border-inline: none;
    border-bottom: none;
    text-align: start;
    font-family: inherit;
}

.sw-ss-manual-action:hover {
    background: #fef3c7;
}

/* Registration UX Specialist Kit */
.reg-progress-card {
    background: linear-gradient(135deg, #f0fdf4, #eff6ff);
    border: 1.5px solid #a7f3d0;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.reg-progress-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 0.84rem;
    font-weight: 800;
    color: #065f46;
}

.reg-progress-track {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.reg-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #10b981, #047857);
    transition: width 0.25s ease;
}

.reg-draft-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 14px;
    font-size: 0.82rem;
    font-weight: 700;
}

.reg-draft-clear-btn {
    border: 1px solid #93c5fd;
    background: #ffffff;
    color: #1d4ed8;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
}

.reg-inline-suggest-box {
    display: none;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
    font-size: 0.8rem;
}

.reg-inline-suggest-box.visible {
    display: flex;
}

.reg-suggest-pill {
    border: 1px solid #93c5fd;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.reg-suggest-pill:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.reg-suggest-pill.is-fix {
    border-color: #f59e0b;
    background: #fffbeb;
    color: #92400e;
}

.reg-suggest-pill.is-fix:hover {
    background: #d97706;
    border-color: #d97706;
    color: #ffffff;
}

.password-field-wrap {
    position: relative;
    display: block;
    width: 100%;
}

.password-field-wrap input {
    width: 100% !important;
    padding-inline-end: 44px !important;
    box-sizing: border-box;
}

.pwd-toggle-btn {
    position: absolute;
    inset-inline-end: 6px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    color: #334155;
    border-radius: 8px;
    z-index: 2;
}

.pwd-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 10px;
    margin-top: 7px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 700;
    color: #475569;
    width: 100%;
    box-sizing: border-box;
}

.pwd-checklist-item.ok {
    color: #059669;
}

.pwd-tools-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
    width: 100%;
}

.pwd-gen-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    border-radius: 8px;
    padding: 6px 12px;
    min-height: 36px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.pwd-gen-btn:hover {
    border-color: #059669;
    color: #047857;
    background: #ecfdf5;
}

.pwd-capslock-warn {
    display: none;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.76rem;
    font-weight: 800;
}

.pwd-capslock-warn.visible {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.geo-auto-hint {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    padding: 5px 10px;
}

.geo-auto-hint.visible {
    display: flex;
}

@media (max-width: 640px) {
    .sw-ss-input,
    .sw-ss-ghost {
        font-size: 16px !important;
    }

    .sw-ss-option {
        min-height: 46px;
        padding: 10px 12px;
    }

    .pwd-checklist {
        grid-template-columns: 1fr;
    }
}
