/* Protein Crave Pops Hover Animation - Live Server Fix */

/* Container for hover effect */
.crave-pop-image-container {
    position: relative;
    width: 150px;
    height: 150px;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    /* Force hardware acceleration */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Front and back image positioning */
.crave-pop-front,
.crave-pop-back {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    -webkit-transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    object-fit: cover;
}

/* Front image (packaging) - visible by default */
.crave-pop-front {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

/* Back image (nutrition facts) - hidden by default */
.crave-pop-back {
    opacity: 0;
    transform: scale(1.1);
    z-index: 1;
}

/* Hover effects */
.crave-pop-image-container:hover .crave-pop-front {
    opacity: 0;
    transform: scale(0.9);
}

.crave-pop-image-container:hover .crave-pop-back {
    opacity: 1;
    transform: scale(1);
}

/* Placeholder styling */
.crave-pop-image-placeholder {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    -webkit-transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.crave-pop-front.crave-pop-image-placeholder {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

.crave-pop-back.crave-pop-image-placeholder {
    opacity: 0;
    transform: scale(1.1);
    z-index: 1;
}

/* Tooltip */
.crave-pop-image-container::after {
    content: "Hover to see nutrition facts";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

.crave-pop-image-container:hover::after {
    opacity: 1;
}

/* Single image fallback */
.crave-pop-image-container.single-image::after {
    display: none;
}

.crave-pop-image-container.single-image:hover .crave-pop-front,
.crave-pop-image-container.single-image:hover .crave-pop-back {
    opacity: 1;
    transform: scale(1);
}

/* Modal specific styles */
.modal-donut .crave-pop-image-container {
    width: 150px;
    height: 150px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .crave-pop-image-container {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 576px) {
    .crave-pop-image-container {
        width: 100px;
        height: 100px;
    }
}

/* Customer-side specific styles for schedule page - Protein Crave Pops only */
.protein-crave-pop-section .crave-pop-image-container {
    width: auto;
    height: auto;
    max-width: 100%;
    position: relative;
    display: inline-block;
}

.protein-crave-pop-section .crave-pop-image-container .crave-pop-front,
.protein-crave-pop-section .crave-pop-image-container .crave-pop-back {
    position: relative !important;
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    display: block;
}

.protein-crave-pop-section .crave-pop-image-container .crave-pop-back {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* Customer-side tooltip positioning - Protein Crave Pops only */
.protein-crave-pop-section .crave-pop-image-container::after {
    bottom: -30px;
    font-size: 10px;
    padding: 3px 6px;
}

/* Customer-side responsive adjustments - Protein Crave Pops only */
@media (max-width: 768px) {
    .protein-crave-pop-section .crave-pop-image-container::after {
        bottom: -25px;
        font-size: 9px;
        padding: 2px 4px;
    }
}

/* Ensure regular meal images are not affected */
.meal-image-container img:not(.crave-pop-image) {
    /* Keep existing styling for regular meal images */
    max-width: 100%;
    height: auto;
    display: block;
}

/* Ensure meal-photo class is not affected */
.meal-photo:not(.crave-pop-image) {
    /* Keep existing styling for meal photos */
    max-width: 100%;
    height: auto;
    display: block;
}

/* Modal-specific styles for Protein Crave Pops */
.modal-donut .crave-pop-image-container {
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.modal-donut .crave-pop-image-container .crave-pop-front,
.modal-donut .crave-pop-image-container .crave-pop-back {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* Disable hover for single images or placeholders */
.crave-pop-image-container.single-image:hover .crave-pop-front {
    opacity: 1 !important;
    transform: scale(1) !important;
}

.crave-pop-image-container.single-image:hover .crave-pop-back {
    opacity: 0 !important;
    transform: scale(1.1) !important;
}

.crave-pop-image-container.single-image::after {
    display: none !important;
}
