/* Farm3Design Products CSS - Stili combinati con sistema comunicazione Pizza Lorenzo */

/* Colore primario dinamico - iniettato da WordPress via PHP */
:root {
    --f3dp-primary-color: #7f54b3; /* Fallback WooCommerce, sovrascritto da PHP con il colore del tema */
    --f3dp-primary-hover: color-mix(in srgb, var(--f3dp-primary-color) 85%, black);
    --f3dp-primary-light: color-mix(in srgb, var(--f3dp-primary-color) 15%, white);
    --f3dp-primary-lighter: color-mix(in srgb, var(--f3dp-primary-color) 8%, white);
}

.farm3-products-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f8f8;
    color: #333;
    display: flex;
    flex-direction: column;
    max-width: 80rem;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1rem;
}

@media (min-width: 768px) {
    .farm3-products-container {
        flex-direction: row;
        padding: 2rem 1.5rem;
    }
}

@media (min-width: 1024px) {
    .farm3-products-container {
        padding: 2rem 2rem;
    }
}

/* === SIDEBAR DESKTOP === */
.farm3-sidebar {
    display: none;
    background-color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    margin-right: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

@media (min-width: 768px) {
    .farm3-sidebar {
        display: block;
        width: 20%;
        padding: 1.5rem;
        margin-right: 2rem;
        margin-bottom: 0;
    }
}

@media (min-width: 1024px) {
    .farm3-sidebar {
        width: 25%;
    }
}

.farm3-sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1f2937;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.farm3-sidebar-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.farm3-sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    border-radius: 0.375rem;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
    border: 1px solid transparent;
}

.farm3-sidebar-item i {
    margin: 0 0 0.5rem 0;
    font-size: 20px;
    text-align: center;
    flex-shrink: 0;
    color: #6b7280;
}

.farm3-sidebar-item span {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

/* Counter rimosso - non più utilizzato */

.farm3-sidebar-item:hover:not(.active) {
    background-color: #f3f4f6;
    color: #111827;
    border-color: #e5e7eb;
    transform: translateX(2px);
}

.farm3-sidebar-item:hover:not(.active) i {
    color: #374151;
    transform: scale(1.1);
}

.farm3-sidebar-item.active {
    background-color: var(--f3dp-primary-color);
    color: white;
    font-weight: 600;
    border-color: var(--f3dp-primary-hover);
    box-shadow: 0 2px 4px color-mix(in srgb, var(--f3dp-primary-color) 20%, transparent);
}

.farm3-sidebar-item.active i {
    color: white;
}

/* Counter active state rimosso - non più utilizzato */

/* === MOBILE TABS WRAPPER === */
.farm3-mobile-tabs-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Sticky header */
.farm3-mobile-tabs-wrapper.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    margin: 0;
    border-radius: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Spacer per quando la barra diventa sticky */
.farm3-mobile-tabs-spacer {
    display: none;
}

.farm3-mobile-tabs-spacer.active {
    display: block;
    height: 80px;
}

@media (min-width: 768px) {
    .farm3-mobile-tabs-wrapper {
        display: none;
    }
}

/* === MOBILE TABS === */
.farm3-mobile-tabs {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    flex: 1;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.farm3-mobile-tabs::-webkit-scrollbar {
    display: none;
}

.farm3-topic-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #374151;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    flex-shrink: 0;
}

.farm3-topic-tab i {
    font-size: 14px;
    color: #6b7280;
}

.farm3-topic-tab:hover:not(.active) {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.farm3-topic-tab.active {
    background-color: var(--f3dp-primary-color);
    border-color: var(--f3dp-primary-hover);
    color: white;
    box-shadow: 0 2px 4px color-mix(in srgb, var(--f3dp-primary-color) 20%, transparent);
}

.farm3-topic-tab.active i {
    color: white;
}

/* === MAIN CONTENT === */
.farm3-main-content {
    flex: 1;
    min-width: 0;
}

/* === LOADING === */
.farm3-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.farm3-loading.hidden {
    display: none;
}

.farm3-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid var(--f3dp-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === PRODUCTS GRID === */
.farm3-products-wrapper h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.farm3-products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
}

@media (min-width: 640px) {
    .farm3-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .farm3-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.farm3-product-card {
    background-color: #fff;
    border: 1px solid #eceef1;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.farm3-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px -10px rgba(16, 24, 40, 0.18);
    border-color: transparent;
}

/* Immagine a tutta larghezza (bleed sui bordi della card) */
.farm3-product-card img {
    width: calc(100% + 2rem);
    margin: -1rem -1rem 0.9rem;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 0;
    border-radius: 16px 16px 0 0;
    background: #f3f4f6;
    display: block;
}

.farm3-product-card h3 {
    font-size: 1.06rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.35rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.farm3-product-card p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.farm3-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: #059669;
    margin: 0 0 1rem;
}

.farm3-price.on-sale {
    color: #dc2626;
}

.farm3-product-card button {
    margin-top: auto;
    width: 100%;
    padding: 0.7rem 1rem;
    background-color: var(--f3dp-primary-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.farm3-product-card button::after {
    content: "\2192";
    font-size: 1.05em;
    transition: transform 0.18s ease;
}

.farm3-product-card button:hover {
    background-color: var(--f3dp-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px -4px color-mix(in srgb, var(--f3dp-primary-color) 45%, transparent);
}

.farm3-product-card button:hover::after {
    transform: translateX(3px);
}

/* === ERROR STATE === */
.farm3-products-error {
    text-align: center;
    padding: 3rem 1rem;
    color: #dc2626;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
}

.farm3-no-products {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
    background-color: white;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

/* === MODAL === */
.farm3-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.farm3-modal.show {
    display: flex;
}

.farm3-modal-content {
    background-color: white;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 48px -12px rgba(16, 24, 40, 0.35);
    animation: f3dpModalIn 0.22s ease;
}

@keyframes f3dpModalIn {
    from { transform: translateY(12px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.farm3-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.farm3-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.farm3-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.farm3-modal-close:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.farm3-modal-body {
    padding: 1.5rem;
}

.farm3-modal-loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.farm3-modal-loading .farm3-spinner {
    margin-bottom: 1rem;
}

/* === MODAL CONTENT === */
.farm3-modal-image {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    background: #f3f4f6;
    border: 1px solid #eceef1;
}

.farm3-modal-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #059669;
    margin-bottom: 1.5rem;
}

.farm3-modal-price.on-sale {
    color: #dc2626;
}

.farm3-modal-description,
.farm3-modal-full-description {
    color: #374151;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.farm3-modal-section {
    margin-bottom: 1.5rem;
}

.farm3-modal-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.farm3-specs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .farm3-specs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.farm3-spec-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: #f9fafb;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
}

.farm3-spec-item i {
    color: var(--f3dp-primary-color);
    width: 20px;
    text-align: center;
}

.farm3-variants-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.farm3-variant-tag {
    background-color: var(--f3dp-primary-lighter);
    color: var(--f3dp-primary-color);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    border: 1px solid var(--f3dp-primary-light);
}

/* === MODAL ACTIONS === */
.farm3-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.farm3-modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    border: none;
    font-size: 0.875rem;
}

.farm3-modal-btn-primary {
    background-color: var(--f3dp-primary-color);
    color: white;
    flex: 1;
    min-width: 200px;
    justify-content: center;
}

.farm3-modal-btn-primary:hover {
    background-color: var(--f3dp-primary-hover);
    transform: translateY(-1px);
}

.farm3-modal-btn-whatsapp {
    background-color: #25d366;
    color: white;
    width: 48px;
    height: 48px;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.25rem;
}

.farm3-modal-btn-whatsapp:hover {
    background-color: #20ba5a;
    transform: scale(1.05);
}

/* === CSS GALLERY (per più immagini) === */
.farm3-css-gallery {
    position: relative;
    margin-bottom: 1.5rem;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.farm3-gallery-radio {
    display: none;
}

.farm3-gallery-img {
    display: none;
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.farm3-gallery-radio:checked + .farm3-gallery-img {
    display: block;
}

.farm3-css-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
}

.farm3-css-dots {
    display: flex;
    gap: 0.5rem;
}

.farm3-css-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.farm3-css-dot:hover {
    background-color: rgba(255, 255, 255, 0.8);
}

.farm3-gallery-radio:checked + .farm3-gallery-img ~ .farm3-css-controls .farm3-css-dot[for] {
    background-color: white;
    transform: scale(1.2);
}

/* === BODY MODAL OPEN === */
body.modal-open {
    overflow: hidden;
}

/* === BURGER MENU === */
.farm3-burger-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    background-color: var(--f3dp-primary-color);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.farm3-burger-btn:hover {
    background-color: var(--f3dp-primary-hover);
    transform: scale(1.05);
}

.farm3-burger-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.farm3-burger-btn.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.farm3-burger-btn.active span:nth-child(2) {
    opacity: 0;
}

.farm3-burger-btn.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media (min-width: 768px) {
    .farm3-burger-btn {
        display: none;
    }
}

/* === CATEGORIES CARD (OVERLAY) === */
.farm3-categories-card {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.farm3-categories-card.show {
    display: flex;
    opacity: 1;
}

.farm3-categories-card-content {
    background-color: white;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}

.farm3-categories-card.show .farm3-categories-card-content {
    transform: scale(1);
    opacity: 1;
}

.farm3-categories-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid #e5e7eb;
    background-color: #f9fafb;
}

.farm3-categories-card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.farm3-categories-card-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.farm3-categories-card-close:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.farm3-categories-card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.farm3-category-card-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    border: 1px solid #e5e7eb;
    background-color: white;
    gap: 1rem;
}

.farm3-category-card-item i {
    font-size: 24px;
    color: #6b7280;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.farm3-category-card-item span {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
    flex: 1;
}

.farm3-category-card-item:hover:not(.active) {
    background-color: #f3f4f6;
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.farm3-category-card-item:hover:not(.active) i {
    color: #374151;
    transform: scale(1.15);
}

.farm3-category-card-item.active {
    background-color: var(--f3dp-primary-color);
    color: white;
    font-weight: 600;
    border-color: var(--f3dp-primary-hover);
    box-shadow: 0 4px 6px color-mix(in srgb, var(--f3dp-primary-color) 30%, transparent);
}

.farm3-category-card-item.active i {
    color: white;
}

@media (min-width: 768px) {
    .farm3-categories-card {
        display: none !important;
    }
}

/* Blocca scroll quando la card è aperta */
body.categories-card-open {
    overflow: hidden;
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 640px) {
    .farm3-modal-content {
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        height: 100%;
    }

    .farm3-modal-actions {
        flex-direction: column;
    }

    .farm3-modal-btn-primary {
        min-width: auto;
    }

    .farm3-specs-grid {
        grid-template-columns: 1fr;
    }
}
