/* ============================================
   CHEESE PRODUCT BOX - CUSTOM ELEMENTOR WIDGET
   ============================================ */

:root {
    --cheese-primary: #4a2c1a;
    --cheese-accent: #f4d59e;
    --cheese-bg-cream: #fdfaf5;
    --cheese-shadow: rgba(74, 44, 26, 0.15);
}

/* Product Box Container */
.cheese-product-box {
    background: transparent;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--cheese-shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 380px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.cheese-product-box:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(74, 44, 26, 0.25);
}

/* CONTAINER IMMAGINE SEPARATO */
.cheese-product-image-wrapper {
    width: 100%;
    background: linear-gradient(180deg, 
        rgba(232, 220, 196, 0.3) 0%, 
        rgba(232, 220, 196, 0.8) 50%,
        rgba(232, 220, 196, 1) 100%
    );
    padding: 30px 30px 20px;
    border-radius: 12px 12px 0 0;
}

.cheese-product-image-container {
    position: relative;
    width: 100%;
    background: transparent;
}

/* Product Image */
.cheese-product-image {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cheese-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 10px;
}

.cheese-product-box:hover .cheese-product-image img {
    transform: scale(1.05);
}

/* Image Overlay with Zoom Icon */
.cheese-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.cheese-product-image:hover .cheese-image-overlay {
    background: rgba(0, 0, 0, 0.3);
    opacity: 1;
}

.cheese-zoom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(74, 44, 26, 0.9);
    border-radius: 50%;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.cheese-product-image:hover .cheese-zoom-icon {
    transform: scale(1);
}

/* CONTAINER CONTENUTO SEPARATO */
.cheese-product-content {
    background: var(--cheese-bg-cream);
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 12px 12px;
}

/* Lightbox Modal - FUORI DAL BOX */
.cheese-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    display: none;
}

.cheese-lightbox.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.cheese-lightbox-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.92) !important;
    z-index: 1;
}

.cheese-lightbox-content {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 2;
    max-width: 90vw !important;
    max-height: 90vh !important;
}

.cheese-lightbox-content img {
    display: block;
    max-width: 90vw !important;
    max-height: 90vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.cheese-lightbox-close {
    position: absolute !important;
    top: -60px !important;
    right: 0 !important;
    background: rgba(74, 44, 26, 0.9);
    border: none;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cheese-lightbox-close:hover {
    background: rgba(74, 44, 26, 1);
    transform: rotate(90deg);
}

.cheese-lightbox-close svg {
    display: block;
}

/* Lightbox Animations */
@keyframes lightboxFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes lightboxZoomIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.cheese-lightbox.active .cheese-lightbox-backdrop {
    animation: lightboxFadeIn 0.3s ease;
}

.cheese-lightbox.active .cheese-lightbox-content {
    animation: lightboxZoomIn 0.4s ease;
}

/* Product Header */
.cheese-product-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 0 16px 0;
    animation: fadeInDown 0.6s ease-out;
}

.cheese-icon {
    flex-shrink: 0;
    animation: rotateIn 0.8s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cheese-icon img {
    display: block;
    width: 60px;
    height: 60px;
    object-fit: contain;
    transition: transform 0.3s ease;
    border-radius: 50%; /* Opzionale: rende l'immagine rotonda */
}

.cheese-icon svg {
    display: block;
    transition: transform 0.3s ease;
}

.cheese-product-box:hover .cheese-icon img,
.cheese-product-box:hover .cheese-icon svg {
    transform: rotate(15deg);
}

.cheese-product-title h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color, var(--cheese-primary));
    line-height: 1.2;
    font-family: 'Playfair Display', Georgia, serif;
}

.cheese-product-subtitle {
    margin: 4px 0 0;
    font-size: 14px;
    color: #7a5d44;
    font-weight: 400;
}

/* Product Description */
.cheese-product-description {
    padding: 0;
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #5a5a5a;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

/* Product Badges */
.cheese-product-badges {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    margin-bottom: 20px;
    animation: fadeIn 0.8s ease-out 0.3s both;
}

.cheese-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #5a5a5a;
}

.cheese-badge svg {
    flex-shrink: 0;
}

.cheese-badge strong {
    color: var(--primary-color, var(--cheese-primary));
}

/* Ingredients Section */
.cheese-ingredients {
    padding: 0;
    margin-bottom: 24px;
    font-size: 13px;
    color: #5a5a5a;
    line-height: 1.6;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.cheese-ingredients p {
    margin: 0 0 8px;
}

.cheese-ingredients strong {
    color: var(--primary-color, var(--cheese-primary));
    font-weight: 600;
}

.cheese-ingredients em {
    font-style: italic;
    color: #7a5d44;
}

/* Toggle Buttons */
.cheese-toggle-buttons {
    display: flex;
    gap: 0;
    padding: 0;
    margin-bottom: 16px;
    animation: slideInUp 0.6s ease-out 0.5s both;
}

.cheese-toggle-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--primary-color, var(--cheese-primary));
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cheese-toggle-btn:first-child {
    border-radius: 8px 0 0 0;
}

.cheese-toggle-btn:last-child {
    border-radius: 0 8px 0 0;
}

.cheese-toggle-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--accent-color, var(--cheese-accent));
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.cheese-toggle-btn.active::before {
    width: 80%;
}

.cheese-toggle-btn:not(.active) {
    background: rgba(74, 44, 26, 0.6);
}

.cheese-toggle-btn:hover:not(.active) {
    background: rgba(74, 44, 26, 0.8);
}

.cheese-toggle-btn.active {
    background: var(--primary-color, var(--cheese-primary));
}

/* Product Action Buttons (NUOVO) */
.cheese-action-buttons {
    display: flex;
    gap: 12px;
    padding: 0;
    margin-bottom: 20px;
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.cheese-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 2px solid transparent;
}

.cheese-action-btn svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.cheese-action-btn:hover svg {
    transform: translateY(-2px);
}

/* Datasheet Button */
.cheese-datasheet-btn {
    background: #fff;
    color: var(--primary-color, var(--cheese-primary));
    border-color: var(--primary-color, var(--cheese-primary));
}

.cheese-datasheet-btn:hover {
    background: var(--primary-color, var(--cheese-primary));
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 44, 26, 0.2);
}

/* Purchase Button */
.cheese-purchase-btn {
    background: var(--primary-color, var(--cheese-primary));
    color: #fff;
    border-color: var(--primary-color, var(--cheese-primary));
}

.cheese-purchase-btn:hover {
    background: #fff;
    color: var(--primary-color, var(--cheese-primary));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 44, 26, 0.2);
}

/* Single button takes full width */
.cheese-action-buttons .cheese-action-btn:only-child {
    flex: 1;
    max-width: 100%;
}

/* Responsive action buttons */
@media (max-width: 480px) {
    .cheese-action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .cheese-action-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}


/* Info Panels */
.cheese-info-panel {
    background: #fff;
    padding: 20px;
    border-radius: 0 0 12px 12px;
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

.cheese-info-panel.active {
    display: block;
}

/* Tables */
.cheese-nutritional-table,
.cheese-pezzatura-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cheese-nutritional-table tbody tr,
.cheese-pezzatura-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.cheese-nutritional-table tbody tr:last-child,
.cheese-pezzatura-table tbody tr:last-child {
    border-bottom: none;
}

.cheese-nutritional-table td,
.cheese-pezzatura-table td {
    padding: 10px 8px;
    color: #5a5a5a;
}

.cheese-nutritional-table td:first-child,
.cheese-pezzatura-table td:first-child {
    font-weight: 500;
    color: var(--primary-color, var(--cheese-primary));
}

.cheese-nutritional-table td.indent {
    padding-left: 20px;
    font-size: 12px;
    color: #7a5d44;
}

.cheese-nutritional-table td.text-center,
.cheese-pezzatura-table td.text-center {
    text-align: center;
    color: #999;
    font-size: 11px;
}

.cheese-nutritional-table td.text-right,
.cheese-pezzatura-table td.text-right {
    text-align: right;
    font-weight: 600;
}

.cheese-note {
    margin: 16px 0 0;
    font-size: 11px;
    color: #999;
    text-align: center;
    font-style: italic;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* Panel Transition Animation */
.cheese-info-panel-enter {
    animation: panelSlideIn 0.4s ease-out;
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .cheese-product-box {
        max-width: 100%;
    }

    .cheese-product-image {
        height: 240px;
    }

    .cheese-product-header {
        padding: 20px 20px 12px;
    }

    .cheese-product-title h3 {
        font-size: 20px;
    }

    .cheese-product-description,
    .cheese-product-badges,
    .cheese-ingredients,
    .cheese-toggle-buttons {
        padding: 0 20px;
    }

    .cheese-info-panel {
        padding: 16px 20px 20px;
    }

    .cheese-toggle-btn {
        font-size: 12px;
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .cheese-product-image {
        height: 200px;
    }

    .cheese-product-title h3 {
        font-size: 18px;
    }

    .cheese-toggle-btn {
        font-size: 11px;
        padding: 8px 10px;
    }

    .cheese-nutritional-table td,
    .cheese-pezzatura-table td {
        padding: 8px 4px;
        font-size: 12px;
    }
}

/* Elementor Editor Specific */
.elementor-editor-active .cheese-product-box {
    animation: none !important;
}

.elementor-editor-active .cheese-product-header,
.elementor-editor-active .cheese-product-description,
.elementor-editor-active .cheese-product-badges,
.elementor-editor-active .cheese-ingredients,
.elementor-editor-active .cheese-toggle-buttons {
    animation: none !important;
}
