/* Legislation search component
 *
 * Shared styles for the CELEX/legislation search box used on the home page,
 * error pages, and the Semantic Studio landing. Pairs with autocomplete.css
 * (the results dropdown). Loaded globally from layouts/base.html so every page
 * carrying the `includes/legislation_search.html` partial renders identically.
 */

.celex-input-container {
    max-width: 500px;
    margin: 2rem auto;
    padding: 0 1rem;
    position: relative;
    min-height: 60px;  /* Reserve space to prevent layout shift */
    margin-bottom: 0;
    scroll-margin-top: 90px;  /* clear fixed header on focus-scroll (#753) */
}

.celex-input-container .input-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 0 auto;  /* Center the input group */
    border-radius: 0.25rem;
    transition: box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.celex-input-container:focus-within .input-group {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.celex-input-container input {
    border-radius: 0.25rem;
    border: 1px solid var(--lx-border-strong);
    padding: 0.5rem 1rem;
    font-size: 1rem;
    transition: all 0.2s ease-in-out;
}

.celex-input-container input.is-invalid {
    border-color: var(--color-red);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.celex-input-container input.is-valid {
    border-color: var(--color-green);
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.validation-message {
    position: absolute;
    left: 50%;  /* Center relative to container */
    transform: translateX(-50%);  /* Center the element itself */
    width: auto;  /* Let content determine width */
    min-width: 200px;  /* Minimum width */
    max-width: calc(100% - 2rem);  /* Maximum width matching input */
    padding: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    text-align: center;
}

.validation-message.show {
    opacity: 1;
}

.validation-message.valid {
    color: var(--color-green);
}

.validation-message.invalid {
    color: var(--color-red);
}
