body {
    font-family: "Poppins", Arial, sans-serif;
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    background-color: #ffffff;
    color: #000000;
}

.section-container {
    max-width: 1200px;
    height: 100vh;
    margin: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.btn {
    padding: 0.75rem 1rem;
    outline: none;
    border: none;
    font-size: 0.9rem;
    color: #ffffff;
    white-space: nowrap;
    background-color: #000000;
    cursor: pointer;
}

.btn:hover {
    background-color: #a60b00;
}

.search-form {
    position: absolute;
    top: 100%;
    right: 0;
    background: #ffffff;
    padding: 0;
    display: none;
    z-index: 10;
    width: 100%;
    max-width: none;
}

.search-form.active {
    display: block;
}

.search-form form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-form input {
    padding: 0.5rem;
    font-size: 0.9rem;
    border: 1px solid #000000;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin-top: 0.5rem;
}

.search-form button {
    padding: 0.75rem;
    font-size: 0.9rem;
    background-color: #000000;
    color: #ffffff;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-form button:hover {
    background-color: #a60b00;
}

.search-form button .fas.fa-search {
    display: inline-block;
}

.search-form button .btn-text {
    display: none;
}

.search-bar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 0.5rem;
}

.search-bar input {
    padding: 0.5rem;
    font-size: 0.9rem;
    border: 1px solid #000000;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin-top: 0.5rem;
}

.search-bar input:focus {
    border-color: #a60b00;
    outline: none;
}

.search-bar button {
    padding: 0.75rem;
    font-size: 0.9rem;
    background-color: #000000;
    color: #ffffff;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-bar button:hover {
    background-color: #a60b00;
}

.search-bar button .fas.fa-search {
    display: inline-block;
}

.search-bar button .btn-text {
    display: none;
}

.spinner {
    display: none;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid #a60b00;
    border-top: 2px solid #000000;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

h2 {
    font-size: 1rem;
    color: #a60b00;
    margin-bottom: 1rem;
    text-align: center;
}

#search-term {
    font-style: italic;
}

.results-grid {
    display: grid;
    gap: 2rem 1rem;
    margin-bottom: 1.5rem;
    justify-items: center;
}

.search-result-item {
    flex: 0 0 auto;
    text-align: left;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 300px;
}

.product-details {
    align-self: flex-start;
    width: 100%;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.search-result-item:hover .image-wrapper img {
    transform: scale(1.05);
}

.search-result-item a {
    text-decoration: none;
    color: #000000;
}

.product-details h3 {
    font-size: 1rem;
    font-weight: 500;
    color: #000000;
    margin: 0.5rem 0;
}

.product-details p {
    font-size: 0.9rem;
    color: #000000;
    margin: 0.25rem 0;
}

.product-details .category {
    color: #000000;
}

.product-details .price {
    color: #a60b00;
    font-weight: bold;
}

.stock.low-stock {
    color: #a60b00;
}

.no-results, .error-message {
    font-size: 0.9rem;
    color: #000000;
    text-align: center;
    background: #ffffff;
    padding: 1rem;
}

.no-results a {
    color: #a60b00;
    text-decoration: none;
}

.no-results a:hover {
    text-decoration: underline;
}

.back-to-top {
    position: fixed;
    bottom: 15px;
    right: 15px;
    display: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    background-color: #000000;
    color: #ffffff;
    z-index: 10;
}

.back-to-top:hover {
    background-color: #a60b00;
}

@media (max-width: 768px) {
    .section-container {
        display: flex;
        flex-direction: column;
        align-items: center;     /* CENTER HORIZONTALLY */
        justify-content: flex-start;
        padding: 1rem 0.5rem;
        min-height: 100vh;
        margin: 0 auto;
        max-width: 100%;
    }

    .search-form {
        width: 100%;
        max-width: none;
        right: 0;
        left: 0;
    }

    .search-form input {
        width: 100%;
        max-width: none;
        font-size: 0.8rem;
        padding: 0.5rem;
        margin-top: 0.5rem;
    }

    .search-form button {
        width: 100%;
        font-size: 0.8rem;
        padding: 0.75rem;
    }

    .search-form button .fas.fa-search {
        display: none;
    }

    .search-form button .btn-text {
        display: inline-block;
    }

    .search-bar {
        width: 100%;
        max-width: 500px;           
        margin: 0 auto;
        padding: 0;
        box-sizing: border-box;           
    }

    .search-bar input {
        width: 100%;
        max-width: none;
        font-size: 0.8rem;
        padding: 0.5rem;
        margin-top: 0.5rem;
    }

    .search-bar button {
        width: 100%;
        font-size: 0.8rem;
        padding: 0.75rem;
        box-sizing: border-box;
        margin: 0;
    }

    .search-bar button .fas.fa-search {
        display: none;
    }

    .search-bar button .btn-text {
        display: inline-block;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem 0.5rem;
    }

    .search-result-item {
        max-width: 90%;
    }

    h2 {
        font-size: 0.9rem;
    }

    .product-details h3 {
        font-size: 0.9rem;
    }

    .product-details p {
        font-size: 0.8rem;
    }

    .no-results, .error-message {
        font-size: 0.8rem;
        padding: 0.75rem;
    }

    .back-to-top {
        bottom: 10px;
        right: 10px;
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }
}

@media (min-width: 540px) and (max-width: 767px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem 1rem;
    }
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .search-bar {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        min-height: 80px;
    }

    .search-input-wrapper {
        margin: 0;
        padding: 0;
        align-self: center;
    }

    .search-bar input {
        width: 100%;
        max-width: 400px;
        height: 40px;
        margin-top: 0;
    }

    .search-bar button {
        width: auto;
        min-width: 100px;
        height: 40px;
        align-self: center;
    }
}