/* CASCADE-LAYER: intentionally-unlayered — page composition. See .planning/phases/01-foundation-activation/01-CONTEXT.md D-01. */
/* stylelint-disable media-feature-name-disallowed-list -- Phase 6: max-width media queries retained; mobile-first conversion deferred (D-08). Strict-value/!important/order cleaned. */

/*
 * Search Form Template Styles
 *
 * Styles for the search form component including input fields,
 * submit button, accessibility features, and responsive design.
 * Includes dark theme variant and loading states.
 *
 * @package RhuarcsPetSupplies
 * @since 1.0.0
 */

.search-form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.search-wrapper {
    display: flex;
    background: white;
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-base);
    overflow: hidden;
}

.search-wrapper:focus-within {
    border-color: var(--purple-700);
    /* stylelint-disable-next-line scale-unlimited/declaration-strict-value -- bespoke 3px focus-within ring halo; no byte-exact --shadow-* token */
    box-shadow: 0 0 0 3px var(--purple-100);
}

.search-field {
    flex: 1;
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
}

.search-field::placeholder {
    color: var(--text-muted);
}

.search-submit {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    font-weight: var(--font-semibold);
    color: var(--text-on-purple);
    background: var(--purple-700);
    border: none;
    transition: all var(--transition-base);
    cursor: pointer;
}

.search-submit:hover {
    background: var(--purple-600);
}

/* Focus ring intentionally NOT redeclared here (CONS-05/D-11):
   the divergent 2px purple-500 outline was removed so the canonical
   base.css :focus-visible (3px solid var(--purple-500)) wins. */

.search-submit:active {
    transform: scale(0.98);
}

.search-icon {
    /* stylelint-disable-next-line scale-unlimited/declaration-strict-value -- type-scale extension; 1.1rem has no canonical --text-* token */
    font-size: 1.1rem;
}

.search-text {
    font-size: var(--text-sm);
}

/* Visually-hidden helper. The canonical sr-only rule lives in utilities.css
   and accessibility.css (both `position: absolute !important` on every prop);
   those grandfathered utilities force absolute positioning regardless of source
   order, so the !important here was redundant — dropped per D-07 (zero-diff:
   the utility !important rules still win). Block kept byte-exact to match. */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    /* stylelint-disable-next-line scale-unlimited/declaration-strict-value -- sr-only 1px-rect nudge; off-grid by the WCAG visually-hidden idiom, no --space-* token */
    margin: -1px;
    overflow: hidden;
    /* stylelint-disable-next-line property-no-deprecated -- legacy clip rect() retained byte-exact to match the canonical sr-only utility (utilities.css / accessibility.css); clip-path migration is a separate site-wide a11y pass */
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive Design */
@media (width <= 480px) {
    .search-text {
        display: none;
    }

    .search-submit {
        padding: var(--space-4);
    }

    .search-field {
        padding: var(--space-4);
    }
}

/* Dark background variant */
.search-form.dark {
    color: var(--text-on-purple);
}

.search-form.dark .search-wrapper {
    background: rgb(255 255 255 / 10%);
    backdrop-filter: blur(10px);
}

.search-form.dark .search-field {
    color: var(--text-on-purple);
}

.search-form.dark .search-field::placeholder {
    color: rgb(255 255 255 / 70%);
}

.search-form.dark .search-submit {
    background: rgb(255 255 255 / 20%);
}

.search-form.dark .search-submit:hover {
    background: rgb(255 255 255 / 30%);
}

/* Animation for loading state */
.search-form.loading .search-submit {
    pointer-events: none;
}

.search-form.loading .search-icon {
    animation: spin 1s linear infinite;
}

/* Animation moved to utilities.css for consistency */
