body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #f5f6f8;
}

container {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
}

aside {
    width: 20rem;
    background: #fff;
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.06);
}

h2 {
    margin-top: 0;
    font-size: 1rem;
    font-weight: 600;
}

.category-item {
    margin: 0.125rem 0;
}

.category-children {
    margin-left: 1.125rem;
    padding-left: 0.625rem;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.category-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
}

.category-summary::-webkit-details-marker {
    display: none;
}

.category-summary::before {
    content: "-";
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    color: #666;
}

.category-item[open]>.category-summary::before {
    transform: rotate(90deg);
}

.category-leaf {
    padding: 0.375rem 0.5rem 0.375rem 1.375rem;
    border-radius: 0.375rem;
}

.category-link {
    text-decoration: none;
    color: #222;
    font-size: 0.875rem;
    transition: background 0.2s ease;
    transition: padding 0.2s ease;
}

.category-link:hover {
    text-decoration: underline;
}

.category-link.active {
    font-weight: 600;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 0.25rem;
    padding: 0 0.375rem 0 0.5rem;
}

.product-count {
    font-size: 0.55rem;
    color: #777;
}

.category-summary:hover,
.category-leaf:hover {
    background: rgba(0, 0, 0, 0.04);
}

.category-item[open]>.category-summary {
    font-weight: 600;
}

/** Product list styles*/
main {
    flex: 1;
    background: #fff;
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.06);
}

#product-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
    gap: 1rem;
    transition: all 0.3s ease;
}

#product-list-container.loading {
    position: relative;
    opacity: 0.2;
    transform: scale(0.3);
    backdrop-filter: blur(4px);
}


.product-card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.product-title {
    font-size: 0.875rem;
    margin: 0.5rem 0;
    text-align: center;
}

.product-image {
    max-width: 100%;
    border-radius: 0.25rem;
}

.product-button {
    opacity: 0;
    margin-top: auto;
    padding: 0.5rem 1rem;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: opacity 0.5s ease;
}

.product-button:hover {
    background-color: #0056b3;
}

.product-card:hover .product-button {
    opacity: 1;
}

#sort-select {
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    border: 1px solid #ccc;
}

/** Pagination styles */
#pagination-container {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

#pagination-container button {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    background-color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/**Product popup */

.product-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: popupSlideIn 0.1s;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, 50%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.product-popup-backdrop {
    animation: fadeIn 0.1s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.product-popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    z-index: 999;
    backdrop-filter: blur(4px);
}