/* Item list on the hybrid page, the same design as elon.pro/catalog/hybrid/
   (elon static/css/catalog/main.css, its colour variables written out). */

/* White and blue page, as the home page; only /hybrid/ loads this file */
body {
    background-color: #EEF4FB;
}

/* Product List */
/* Every column step divides the page size (24), so a row is short only when
   the items run out. */
.product-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 5px;
    font-family: 'Roboto', sans-serif;
}

@media (min-width: 480px) {
    .product-list { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
    .product-list { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1030px) {
    .product-list { grid-template-columns: repeat(6, 1fr); }
}

@media (min-width: 1270px) {
    .product-list { grid-template-columns: repeat(8, 1fr); }
}

/* Product Item */
.product-item {
    display: flex;
    flex-direction: column; /* Stack children vertically */
    height: 100%; /* Ensure the container takes full height */
    position: relative;
    border: 2px solid #D5E3F3;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
}

/* Product Link */
.product-link {
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure the link takes full height */
    text-decoration: none;
    color: inherit; /* Inherit text color from parent */
}

/* Image Container */
.image-container {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    text-align: center; /* Center the image */
    flex-shrink: 0; /* Prevent image from shrinking */
    border-radius: 6px;
}

.image-container img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.3s ease-in-out;
    object-fit: contain;
}

.product-link:hover .image-container img {
    transform: scale(1.05);
}

/* Product Card */
.product-card {
    display: flex;
    flex-direction: column;
    flex: 1; /* Allow product-card to take remaining space */
    padding: 20px 2px;
}

/* Description */
.description {
    font-size: 0.9em;
    color: #666;
    overflow-wrap: break-word;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-height: calc(1.4em * 4);
    flex: 1;
}

/* Price Container */
.price-container {
    background-color: #EAF2FC;
    padding: 5px 10px; /* Adjust padding as needed */
    display: flex;
    flex-wrap: wrap; /* Allow prices to wrap to the next line */
    gap: 0.8rem; /* Space between price items */
    align-items: baseline; /* Align items at their baseline */
    margin-top: auto; /* Push price container to the bottom */
}

/* Current Price */
.current-price {
    font-size: 1.1em;
    font-weight: bold;
    color: #0B4F9C;
}

/* Old Price */
.old-price {
    font-size: 0.875rem;
    color: #6B7F99;
    text-decoration: line-through;
}

/* A discount is the main accent: red border, red badge on the picture,
   red price, the old price crossed out in red */
.product-item.discount {
    border-color: #D62828;
}

.discount-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 1;
    font-size: 1rem;
    font-weight: bold;
    color: #FFFFFF;
    background-color: #D62828;
    padding: 3px 8px;
    border-radius: 4px;
}

.product-item.discount .price-container {
    background-color: #FDECEC;
}

.product-item.discount .current-price {
    color: #D62828;
}

.product-item.discount .old-price {
    font-weight: bold;
    color: #10243E;
    text-decoration-color: #D62828;
    text-decoration-thickness: 2px;
}

.hr-category-gradient {
    border: none;
    height: 3px;
    background: linear-gradient(to right, transparent, #0B4F9C, transparent);
    margin: 5px 0;
}

.hr-category-double {
    border: none;
    height: 4px;
    background: linear-gradient(to right,
        transparent 0%,
        #0B4F9C 50%,
        transparent 100%
    );
    position: relative;
    margin: 5px 0;
}

.no-results {
    text-align: center;
}

.no-results img {
    display: block;
    margin: 1rem auto;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .description {
        -webkit-line-clamp: 3;
        line-clamp: 3;
        max-height: 4.5em;
    }

    .price-container {
        flex-direction: column;
        align-items: flex-start;
        padding: 5px;
    }
}
