/**
 * Delicias Clari Products - Frontend Styles
 * Version: 1.0.0
 */

/* Products Grid Layout */
.dcp-products-grid {       
    display: grid;
    gap: 30px;
    margin: 30px 0;
}

.dcp-products-grid.dcp-columns-1 {
    grid-template-columns: 1fr;
}

.dcp-products-grid.dcp-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.dcp-products-grid.dcp-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.dcp-products-grid.dcp-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .dcp-products-grid.dcp-columns-3,
    .dcp-products-grid.dcp-columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .dcp-products-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
}

/* Product Item Card */
.dcp-product-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative; /* For absolute positioning of blur background */
}

.dcp-product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Blurred Background Effect - Covers entire card */
.dcp-blur-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
}

/* Product Image */
.dcp-product-image {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 aspect ratio - perfect square */
    overflow: hidden;
    background: transparent;
    z-index: 1; /* Above blur background */
}

.dcp-product-image img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* Crops image to fit square */
    object-position: center; /* Centers the image */
    z-index: 2;
}

/* Product Content */
.dcp-product-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1; /* Above blur background */
    background: #fff; /* Solid white background */
}

/* Product Header (Title + Price) */
.dcp-product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

/* Product Title */
.dcp-product-title {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0;
    color: #333;
    line-height: 1.3;
    flex: 1 1 auto;
    min-width: 0;
}

/* Product Price */
.dcp-product-price {
    font-size: 1.4em;
    font-weight: bold;
    color: black;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

/* For 4+ columns: allow wrapping */
.dcp-columns-4 .dcp-product-header,
.dcp-columns-5 .dcp-product-header,
.dcp-columns-6 .dcp-product-header {
    flex-wrap: wrap;
}

/* Product Description */
.dcp-product-description {
    font-size: 0.95em;
    line-height: 1.6;
    color: #666;
    margin-bottom: 15px;
}

.dcp-product-description p {
    margin: 0 0 10px;
}

.dcp-product-description p:last-child {
    margin-bottom: 0;
}

/* Product Ingredients */
.dcp-product-ingredients {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.dcp-product-ingredients h4 {
    font-size: 0.9em;
    font-weight: 700;
    margin: 0 0 8px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dcp-product-ingredients p {
    font-size: 0.85em;
    line-height: 1.5;
    color: #555;
    margin: 0;
}

/* Package Content */
.dcp-product-package {
    font-size: 0.9em;
    color: #666;
    padding-top: 10px;
    margin-top: auto;
    border-top: 1px solid #eee;
}

.dcp-product-package strong {
    color: #333;
}

/* Empty State */
.dcp-products-grid + p {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
}

/* Sortiment Header Styling (Optional - if you want to add a header) */
.dcp-sortiment-header {
    text-align: center;
    margin-bottom: 40px;
}

.dcp-sortiment-header h2 {
    font-size: 2.5em;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

/* Loading State (Optional) */
.dcp-products-loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.dcp-products-loading::after {
    content: "Loading...";
    font-style: italic;
}

/* Image Modal/Lightbox */
.dcp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 40px;
    box-sizing: border-box;
}

.dcp-modal-content {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: default;
    animation: dcp-zoom-in 0.2s ease;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

@keyframes dcp-zoom-in {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.dcp-modal-close {
    position: absolute;
    top: 10px;
    right: 25px;
    color: #fff;
    font-size: 60px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10000;
    line-height: 1;
    user-select: none;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 1);
    padding: 10px;
}

.dcp-modal-close:hover,
.dcp-modal-close:focus {
    color: #ff0000;
    transform: scale(1.1);
}

/* Responsive modal adjustments */
@media (max-width: 768px) {
    .dcp-modal-overlay {
        padding: 20px;
    }
    
    .dcp-modal-close {
        top: 5px;
        right: 15px;
        font-size: 45px;
    }
}

/* Print Styles */
@media print {
    .dcp-product-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .dcp-product-item:hover {
        transform: none;
    }
}
