:root {
    --primary: #0064D2;
    --primary-hover: #0050a8;
    --bg-color: #f4f6f8;
    --text-main: #333;
    --card-bg: #ffffff;
    --border-radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
}

header {
    background-color: var(--primary);
    color: white;
    padding: 20px;
    text-align: center;
}

#header-logo {
    max-height: 100px; /* Adjust this number to make the logo bigger or smaller! */
    width: auto;
    margin-bottom: 10px;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

header p {
    font-size: 0.9rem;
    opacity: 0.8;
}

main {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.search-container {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

input[type="text"], select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.filters {
    display: flex;
    gap: 10px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.checkbox-container input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
}

button {
    width: 100%;
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 15px;
    font-size: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    background-color: var(--primary-hover);
}

.average-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
    margin-bottom: 20px;
}

/* --- UPDATED AVERAGE CARD DISPLAY --- */
.average-card h2 {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 15px;
}

.price-display-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafd;
    padding: 15px 10px;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    margin-bottom: 15px;
}

.price-box {
    text-align: center;
    flex: 1; /* Makes all three boxes take up equal width */
}

.main-average {
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
}

.price-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 5px;
}

.price-box h4 {
    font-size: 1.2rem;
    color: #333;
}

.price-box h3 {
    font-size: 1.8rem;
    color: var(--primary);
    margin: 0;
}

/* --- UPDATED LISTING ITEMS --- */
.listing-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    display: flex; /* Aligns image and text side-by-side */
    align-items: center;
    gap: 15px; /* Space between image and text */
    border: 1px solid #eee;
    text-decoration: none; /* Removes the ugly blue link underline */
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s; /* Smooth hover animation */
}

.listing-item:hover {
    transform: translateY(-2px); /* Makes the card "lift" when tapped/hovered */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.listing-image {
    width: 80px;
    height: 80px;
    object-fit: cover; /* Prevents the image from stretching weirdly */
    border-radius: 6px;
    flex-shrink: 0;
}

.listing-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.listing-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limits long titles to 2 lines so the UI doesn't break */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listing-price {
    font-weight: bold;
    color: #00853E;
    font-size: 1.1rem;
}

.hidden {
    display: none !important;
}

/* Loading Spinner */
#loading {
    text-align: center;
    margin-top: 40px;
}

.spinner {
    border: 4px solid rgba(0,0,0,0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--primary);
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}