/* ===========================
   Base / Mobile-First Styles
   (< 768px)
   =========================== */

/* Global box-sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Base typography */
html {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
}

/* Body: light background, dark text – contrast ratio >= 4.5:1 WCAG AA */
body {
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333333;
    line-height: 1.5;
}

/* Header: distinguishable background */
header {
    background-color: #1a237e;
    color: #ffffff;
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header__title-group {
    display: flex;
    flex-direction: column;
}

header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.header__subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    font-weight: 400;
    color: #ffffff;
}

/* Main content area */
main {
    padding: 1rem;
}

/* Footer */
footer {
    background-color: #e8eaf6;
    color: #333333;
    text-align: center;
    padding: 1rem;
    margin-top: 1rem;
}

footer p {
    margin: 0;
    font-size: 0.875rem;
}

/* Error message styling */
.error-message {
    background-color: #ffebee;
    color: #b71c1c;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

/* ===========================
   Fixed Top Wrapper & Search Bar
   =========================== */

/* Fixed top wrapper */
.fixed-top-wrapper {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
}

/* Spacer no longer needed with sticky positioning */
.fixed-top-spacer {
    display: none;
}

/* Search bar */
.search-bar {
    background-color: #ffffff;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.search-bar__input-wrapper {
    position: relative;
    max-width: 100%;
}

.search-bar__input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.search-bar__input:focus {
    outline: 2px solid #1a237e;
    outline-offset: 1px;
}

/* Icons positioning */
.search-bar__icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
}

.search-bar__icon--magnifier {
    display: block;
}

.search-bar__icon--spinner {
    display: none;
}

/* Loading state */
.search-bar--loading .search-bar__icon--magnifier {
    display: none;
}

.search-bar--loading .search-bar__icon--spinner {
    display: block;
}

/* Spinner animation */
@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.search-bar__icon--spinner {
    animation: spin 0.8s linear infinite;
}

/* ===========================
   Desktop Breakpoint Styles
   (>= 768px)
   =========================== */

@media (min-width: 768px) {
    main {
        max-width: 1200px;
        margin: 0 auto;
        padding: 1.5rem 2rem;
    }
}
