/* Modal stili */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;    width: 100%;
    height: 100%;
    background-color: var(--shadow-extra);
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background-color: var(--secondary-background);
    margin: 10% auto;
    padding: 20px;
    width: 80%;
    max-width: 600px;    border-radius: 8px;
    box-shadow: 0 0 20px var(--highlight-transparent-medium);
    border: 1px solid var(--highlight-color);
}

.modal-body {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
}

.product-image-container {
    flex: 0 0 auto;
    max-width: 150px;
    overflow: hidden;
}

.product-info {
    flex: 1;
}

.product-info h3 {
    color: var(--heading-color);
    margin-top: 0;
    margin-bottom: 10px;
}

@media screen and (max-width: 480px) {
    .product-info {
        width: 100%;
        text-align: center;
    }
}

/* Mobile modal adjustments */
@media screen and (max-width: 480px) {
    .modal-content {
        margin: 15% auto;
        width: 90%;
        padding: 15px;
        overflow: hidden;
    }

    .modal-body {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .product-image-container {
        text-align: center;
        margin-bottom: 10px;
        width: 100%;
        max-width: 100%;
        display: flex;
        justify-content: center;
    }
      #modalProductImage {
        width: 120px;
        height: 120px;
        object-fit: cover;
        border: 2px solid var(--highlight-color);
        border-radius: 5px;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .close-modal {
        font-size: 24px;
    }
}

.close-modal {
    color: var(--highlight-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--button-hover);
}

.modal h2 {
    color: var(--heading-color);
    margin-top: 0;
    border-bottom: 1px solid var(--highlight-color);
    padding-bottom: 10px;
}

.modal-product-details {
    display: flex;
    flex-direction: column;
}

.modal-product-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    margin-bottom: 15px;
    border: 2px solid var(--highlight-color);
    border-radius: 8px;
    align-self: center;
    max-width: 100%;
}

.modal-product-description {
    margin-bottom: 15px;
    color: var(--text-color);
    line-height: 1.6;
}

.modal-product-price {
    font-weight: bold;
    color: var(--highlight-color);
    font-size: 18px;
    margin-bottom: 15px;
}

.modal button {
    background-color: var(--button-color);
    color: var(--button-text);
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal button:hover {
    background-color: var(--button-hover);
}

/* Ensure all images are properly contained within the modal */
.modal img {
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
}

/* Fix for Safari and iOS devices */
@supports (-webkit-touch-callout: none) {
    .product-image-container {
        width: fit-content;
        max-width: 100%;
    }
    
    #modalProductImage {
        max-width: 100%;
        width: auto;
    }
}
