/* ============================================
   Auto Malayalam transliteration controls
   Used on the "Register as Prasudenthi" modal
   (en/prasudenthimar.php, ml/prasudenthimar.php)
   ============================================ */

.ml-translit-hint {
    font-size: 0.7rem;
    color: #6c757d;
    margin: -0.25rem 0 0.5rem;
}

.ml-translit-controls {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.ml-translit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1f4c8a;
    background: #eef3fb;
    border: 1px solid #d5e2f5;
    border-radius: 20px;
    padding: 0.2rem 0.55rem;
    line-height: 1.4;
    cursor: pointer;
    min-height: 26px;
}

.ml-translit-btn:hover,
.ml-translit-btn:active {
    background: var(--sj-blue, #2b5a9e);
    color: #fff;
}

.ml-translit-btn i {
    font-size: 0.75rem;
}

/* Malayalam input + its overlaid "Auto Malayalam" toggle switch */
.ml-input-wrap {
    position: relative;
}

.ml-input-wrap input.form-control-xs {
    padding-right: 2.5rem;
}

.ml-auto-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    z-index: 2;
}

.ml-auto-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    margin: 0;
}

.ml-auto-toggle-track {
    display: inline-block;
    width: 30px;
    height: 16px;
    background: #ccd3de;
    border-radius: 999px;
    position: relative;
    transition: background-color 0.2s ease;
}

.ml-auto-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.ml-auto-toggle input:checked+.ml-auto-toggle-track {
    background: var(--sj-blue, #2b5a9e);
}

.ml-auto-toggle input:checked+.ml-auto-toggle-track .ml-auto-toggle-thumb {
    transform: translateX(14px);
}

.ml-auto-toggle input:focus-visible+.ml-auto-toggle-track {
    outline: 2px solid var(--sj-blue, #2b5a9e);
    outline-offset: 2px;
}

.ml-translit-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    margin-top: 2px;
    background: #fff;
    border: 1px solid #d5e2f5;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    max-height: 160px;
    overflow-y: auto;
}

.ml-translit-suggestion-item {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ml-translit-suggestion-item:hover,
.ml-translit-suggestion-item.active {
    background: #eef3fb;
    color: var(--sj-blue, #2b5a9e);
}

/* Fixed text colour: the item used to inherit the page text colour, which in
   dark mode is light grey on this white box (3 Dec 2026) */
.ml-translit-suggestion-item {
    color: #1e293b;
}

/* Dark mode: same colours as the other dark form boxes (css/mobile.css) */
[data-theme="dark"] .ml-translit-suggestions {
    background: #1F2430;
    border-color: #3a4152;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .ml-translit-suggestion-item {
    color: #e6e8ec;
}

[data-theme="dark"] .ml-translit-suggestion-item:hover,
[data-theme="dark"] .ml-translit-suggestion-item.active {
    background: #2a3550;
    color: #9ec5fe;
}

@media (max-width: 575.98px) {
    .ml-translit-controls {
        gap: 0.4rem;
    }

    .ml-translit-btn {
        min-height: 32px;
    }

    /* Larger invisible hit-area around the switch for comfortable tapping,
       without growing the visible track/thumb itself. */
    .ml-auto-toggle {
        padding: 8px;
        right: 0;
    }
}
