/* ONE SERVICE GROUP - BRANDED THEME */
:root {
    --primary-color: #111111;
    /* Nero OSG */
    --accent-color: #d60000;
    /* Arancione OSG */
    --bg-body: #f4f6f8;
    --bg-white: #ffffff;
    --text-dark: #333333;
    --text-gray: #666666;
    --border-light: #e0e0e0;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-dark);
    line-height: 1.5;
}

/* HEADER SUPERIORE (Logo e Ricerca) */
header {
    background-color: var(--bg-white);
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.logo-container img {
    height: 140px;
    /* Logo più grande */
    object-fit: contain;
}

/* BARRA DI RICERCA ZONA STYLE */
.search-wrapper {
    flex: 1;
    max-width: 800px;
    min-width: 400px;
    /* Force minimum width */
    position: relative;
}

.search-container {
    display: flex;
    align-items: center;
    background: #f0f0f0;
    border-radius: 6px;
    padding: 4px 12px;
    border: 1px solid #ddd;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-container input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 8px;
    font-size: 15px;
    color: #333;
    outline: none;
    min-width: 0;
}

.search-container button {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0 15px;
}

/* NAVBAR NERA */
.nav-strip {
    background-color: var(--primary-color);
    color: white;
    padding: 0;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 50px;
    justify-content: center !important;
}

.btn-assortimento {
    background-color: #333;
    /* Grigio scuro per stacco */
    color: white;
    border: none;
    height: 50px;
    padding: 0 25px;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.nav-links {
    display: flex;
    gap: 40px !important;
    margin-left: 0 !important;
    list-style: none;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 10px;
}

.nav-links a:hover {
    color: var(--accent-color);
}

/* CART ICON */
.cart-icon-container {
    position: relative;
    cursor: pointer;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--primary-color);
}

.cart-icon-container svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent-color);
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* PRODUCTS GRID */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.products-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    justify-content: flex-start;
    /* Ensure items start from left */
}

/* PRODUCT CARD - AMAZON STYLE */
.product-card {
    /* Fixed width for flex layout - Clean Style */
    width: 240px;
    flex: 0 0 auto;
    border: none;
    background: transparent;
    padding: 10px;
}

.product-card:hover .product-image {
    transform: scale(1.02);
}

.btn-pdf {
    font-size: 18px;
    padding: 0 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-pdf:hover {
    opacity: 1;
}

/* Clean Product Image */
.product-image {
    height: 200px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-bottom: 10px;
}

.product-image img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.product-info {
    padding: 10px 15px 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-code {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
}

.product-name {
    font-size: 16px;
    font-weight: 400;
    /* Regular weight like Amazon */
    color: #0F1111;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: auto;
}

.product-category {
    font-size: 11px;
    color: #565959;
    margin-bottom: 10px;
}

/* PRICE BLOCK */
.product-price {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-top: auto;
}

.price-main {
    font-size: 26px;
    /* Larger price */
    font-weight: 600;
    color: #0F1111;
    display: flex;
    align-items: flex-start;
}

/* Simulate superscript if needed, but simple flex is ok */

.price-iva {
    font-size: 12px;
    color: #565959;
}

.product-price-total {
    font-size: 12px;
    color: #565959;
    margin-bottom: 5px;
}

.product-stock {
    font-size: 12px;
    color: #007600;
    /* Amazon Green */
    font-weight: 600;
    margin-bottom: 12px;
}

/* ACTIONS */
.product-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.qty-input {
    width: 60px;
    padding: 8px;
    border: 1px solid #D5D9D9;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
    font-size: 14px;
}

.btn-add-cart {
    flex: 1;
    background-color: #FFD814 !important;
    /* Amazon Yellow */
    border: 1px solid #FCD200 !important;
    border-radius: 20px !important;
    color: #0F1111 !important;
    padding: 10px;
    font-weight: 500 !important;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(213, 217, 217, .5);
    transition: background 0.2s;
}

.btn-add-cart:hover {
    background-color: #F7CA00 !important;
}

/* CATEGORY MENU - MODERN GRID (Wordpress Style) */
.menu-nav-container {
    background: transparent;
    padding: 0;
    box-shadow: none;
    margin-bottom: 40px;
}

.menu-section-title {
    color: var(--primary-color) !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 25px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.flex-wrap-gap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    justify-content: center;
}

.btn-macro {
    background: white !important;
    border: none !important;
    border-radius: 12px;
    color: var(--text-dark) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    min-height: 160px;
    position: relative;
    overflow: hidden;
}

.btn-macro::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    transition: height 0.3s;
}

.btn-macro:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1) !important;
}

.btn-macro.attivo {
    background: white !important;
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15) !important;
}

/* Icon Styles */
.macro-icon {
    font-size: 40px;
    margin-bottom: 15px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.03);
    transition: background 0.3s;
}

.btn-macro:hover .macro-icon {
    background: rgba(0, 0, 0, 0.06);
}

.macro-name {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
    color: #333;
    text-align: center;
}

.macro-count {
    font-size: 11px;
    color: #888;
    background: #f4f4f4;
    padding: 2px 8px;
    border-radius: 10px;
}

/* CARRELLO MODALE */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    justify-content: flex-end;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    height: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.cart-items-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.cart-item {
    background: white;
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    /* Add gap between elements */
}

.cart-item-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cart-item-info {
    flex: 1;
    /* Allow info to take remaining space */
}

.cart-footer {
    background: white;
    padding: 20px;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.cart-total {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: right;
}

.btn-checkout {
    width: 100%;
    background: var(--accent-color);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}

.toast {
    background: white;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* MOBILE OPTIMIZATION */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .logo-container img {
        height: 50px;
    }

    .search-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .user-actions {
        width: 100%;
        justify-content: space-between;
        /* Cliente a sinistra, Carrello a destra */
    }

    .nav-strip .nav-container {
        padding: 0 10px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
    }

    .nav-strip .nav-container::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .nav-links {
        display: none;
        /* Nascondi i link secondari su mobile per pulizia, o mettili in un menu hamburger se richiesto */
    }

    /* Se voglio mantenere i link ma scorrevoli: */
    /* .nav-links { display: flex; } */

    .btn-assortimento {
        padding: 0 15px;
        font-size: 13px;
        flex-shrink: 0;
    }

    .products-container {
        grid-template-columns: repeat(2, 1fr);
        /* 2 colonne su mobile */
        gap: 10px;
    }

    .product-card {
        border-radius: 6px;
    }

    .product-image {
        height: 140px;
        padding: 5px;
    }

    .product-info {
        padding: 10px;
    }

    .product-name {
        font-size: 14px;
        height: 40px;
        /* Limita altezza */
        overflow: hidden;
    }

    .price-main {
        font-size: 18px;
    }

    .btn-add-cart {
        font-size: 12px;
        padding: 8px 0;
    }

    /* Menu Categorie Mobile */
    .menu-nav-container {
        padding: 10px;
    }

    /* Quando su mobile, forza la griglia a scorrere o stare in 2 colonne */
    .flex-wrap-gap {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .btn-macro {
        /* flex: 0 0 auto;  Removed for grid system */
        min-height: 140px;
        padding: 10px;
    }

    .macro-icon {
        font-size: 30px;
        width: 50px;
        height: 50px;
    }

    .macro-name {
        font-size: 12px;
    }
}

/* AUTH MODAL STYLES */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.auth-modal {
    background: white;
    width: 90%;
    max-width: 700px;
    /* Widened from 400px */
    border-radius: 12px;
    max-height: 90vh;
    /* Ensure it fits on screen */
    overflow-y: auto;
    /* Scroll if needed */
}



.auth-header {
    background: #f4f6f8;
    padding: 0;
    display: flex;
    border-bottom: 1px solid #ddd;
}

.auth-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 15px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.auth-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.auth-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
}

.form-control:focus {
    border-color: var(--accent-color);
    outline: none;
}

.btn-full {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

.btn-full:hover {
    background: #b00000;
}

.user-type-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 6px;
}

.type-option {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}