body {
    font-family: sans-serif;
    margin: 0;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #333;
    color: white;
    padding: 1rem;
    text-align: center;
}

header h1 {
    margin: 0 0 0.5rem 0;
}

#searchForm {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

#searchInput {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 300px;
    max-width: 70%;
}

#searchForm button {
    padding: 0.5rem 1rem;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#searchForm button:hover {
    background-color: #4cae4c;
}

main {
    flex-grow: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

#resultsContainer {
    margin-top: 1rem;
}

/* Styling from your Cloudflare Function's output */
.search-message {
    text-align: center;
    padding: 1rem;
    background-color: #e9e9e9;
    border-radius: 4px;
}
.error-message {
    background-color: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}
.info-message {
    background-color: #d9edf7;
    color: #31708f;
    border: 1px solid #bce8f1;
}

.result-summary {
    font-size: 1.1em;
    margin-bottom: 0.5em;
    text-align: center;
}

.external-search-links {
    text-align: center;
    margin-bottom: 1em;
    padding: 0.5em 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.external-search-links a {
    margin: 0 10px;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
}

.amazon-link {
    background-color: #ff9900;
    color: #000;
}
.amazon-link:hover {
    background-color: #e68a00;
}

.zazzle-more-link {
    background-color: #66cdaa;
    color: #000;
}
.zazzle-more-link:hover {
    background-color: #57b395;
}


.zazzle-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* Responsive grid */
    gap: 1rem;
    margin-top: 1rem;
}

.zazzle-product {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.zazzle-product img {
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* Maintain square aspect ratio for images */
    object-fit: cover; /* Cover the area, might crop */
    border-bottom: 1px solid #eee;
    margin-bottom: 0.5rem;
}

.zazzle-product .product-title {
    font-size: 0.9em;
    margin: 0.5rem 0;
    color: #333;
    flex-grow: 1; /* Allows title to take available space */
    overflow-wrap: break-word; /* Prevent long titles from breaking layout */
    word-break: break-word;
    hyphens: auto;
}

.zazzle-product a {
    text-decoration: none;
    color: inherit;
    display: block; /* Make the whole link area clickable */
}

.share-icons {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
}

.share-icons img {
    width: 18px; /* ensure consistent sizing */
    height: 18px;
    margin: 0 5px;
    border: none; /* override img border if any */
}

#loadingIndicator {
    text-align: center;
    padding: 2rem;
    font-size: 1.2em;
}

footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 0.5rem;
    margin-top: auto; /* Pushes footer to the bottom */
}