/* ChatSearchBar form styles */

/* Scoped reset — isolates from host site CSS (Bootstrap textarea box-shadow, button styles) */
.mr-chat-searchbar-form *,
.mr-chat-searchbar-form *::before,
.mr-chat-searchbar-form *::after {
    box-sizing: border-box;
}

.mr-chat-searchbar-form button {
    font-family: inherit;
    appearance: none;
}

.mr-chat-searchbar-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

/* Visually hidden, accessible to screen readers */
.mr-chat-searchbar-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Inner row: textarea + button */
.mr-chat-searchbar-inner {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid var(--hemmy-blush, #f4e3e3);
    border-radius: 20px;
    padding: 10px 10px 10px 20px;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.mr-chat-searchbar-inner:focus-within {
    border-color: var(--hemmy-red, #e30613);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.08);
}

/* Textarea */
.mr-chat-searchbar-input {
    flex: 1 1 auto;
    border: none;
    background: transparent;
    font-family: 'Lexend', sans-serif;
    font-size: max(16px, 1rem);
    font-weight: 400;
    color: var(--hemmy-dark, #280103);
    outline: none;
    min-width: 0;
    resize: none;
    overflow: hidden;
    line-height: 30px;
    min-height: 24px;
    max-height: 96px;
    padding: 3px 0;
}

.mr-chat-searchbar-input:focus {
    outline: none;
    box-shadow: none !important; /* neutralise Bootstrap textarea:focus glow */
}

.mr-chat-searchbar-input::placeholder {
    color: rgba(40, 1, 3, 0.38);
}

/* When textarea hits max-height, allow scroll */
.mr-chat-searchbar-input[style*='160px'] {
    overflow-y: auto;
}

@media (max-width: 768px) {
    .mr-chat-searchbar-input {
        max-height: 72px;
    }
}

/* Redirect mode: native <input type=search> */
.mr-chat-searchbar-input--native {
    resize: none;
    height: 28px;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
}

.mr-chat-searchbar-input--native::-webkit-search-cancel-button {
    display: none;
}

.mr-chat-searchbar-input--native::-webkit-search-decoration {
    display: none;
}

/* Submit button */
.mr-chat-searchbar-submit {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--hemmy-blush, #f4e3e3);
    border-radius: 50%;
    background: var(--hemmy-light, #fdf5f6);
    color: var(--hemmy-dark, #280103);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 200ms ease,
    color 200ms ease,
    border-color 200ms ease,
    transform 100ms ease;
}

.mr-chat-searchbar-submit:hover {
    background: var(--hemmy-dark, #280103);
    color: #fff;
    border-color: var(--hemmy-dark, #280103);
}

.mr-chat-searchbar-submit:active {
    transform: scale(0.92);
}

.mr-chat-searchbar-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Redirect mode loading state */
.mr-chat-searchbar-form.is-loading .mr-chat-searchbar-inner {
    opacity: 0.55;
    pointer-events: none;
}

.mr-chat-searchbar-form.is-loading .mr-chat-searchbar-submit {
    animation: searchbar-spin 0.8s linear infinite;
}

@keyframes searchbar-spin {
    to { transform: rotate(360deg); }
}
