/* ========================================
   Portale B2B Vallati - Stile
   ======================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f5f6fa;
    color: #333;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ---- Header B2B ---- */
.b2b-header {
    background: #1a1a2e;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.b2b-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.b2b-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-right: auto;
}

.cliente-nome {
    font-size: 0.9rem;
    color: #ccc;
}

.cliente-codice {
    font-size: 0.8rem;
    color: #888;
    margin-left: 6px;
}

.btn-carrello {
    background: #2c5aa0;
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-carrello:hover { background: #3a72cc; }

.cart-count {
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e0e0e0;
    background: #fff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #777;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab:hover { color: #333; }

.tab.active {
    color: #2c5aa0;
    border-bottom-color: #2c5aa0;
}

.b2b-main-tabs {
    position: sticky;
    top: 49px;
    z-index: 90;
}

.badge {
    display: inline-block;
    background: #e8edf3;
    color: #555;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.tab.active .badge {
    background: #2c5aa0;
    color: #fff;
}

/* ---- Tab content ---- */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Catalog layout ---- */
.catalog-layout {
    display: flex;
    min-height: calc(100vh - 100px);
}

.catalog-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e4e7ec;
    padding: 16px;
    position: sticky;
    top: 97px;
    max-height: calc(100vh - 97px);
    overflow-y: auto;
}

.catalog-sidebar.hidden { display: none; }

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sidebar-section {
    margin-bottom: 16px;
}

.sidebar-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.filtro-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    font-size: 0.875rem;
    font-family: inherit;
}

.filtro-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    font-size: 0.875rem;
    font-family: inherit;
    background: #fff;
}

.btn-applica-filtri {
    width: 100%;
    padding: 9px;
    background: #2c5aa0;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.btn-applica-filtri:hover { background: #3a72cc; }

.btn-reset-filtri {
    font-size: 0.8rem;
    color: #888;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

/* ---- Catalog main ---- */
.catalog-main {
    flex: 1;
    padding: 16px;
    min-width: 0;
}

.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.catalog-count {
    font-size: 0.9rem;
    color: #666;
}

.btn-toggle-sidebar {
    display: none;
    padding: 7px 14px;
    border: 1px solid #2c5aa0;
    background: #fff;
    color: #2c5aa0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.875rem;
}

/* ---- Product grid ---- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* ---- Product card ---- */
.product-card {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.1s;
}

.product-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.product-img {
    background: #f0f2f5;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.product-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 2rem;
    font-weight: 700;
    width: 100%;
    height: 100%;
}

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

.product-codice {
    font-size: 0.75rem;
    font-weight: 700;
    color: #2c5aa0;
    font-family: monospace;
}

.product-cod-forn {
    font-weight: 400;
    color: #999;
}

.product-desc {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.3;
}

.product-cat {
    font-size: 0.75rem;
    color: #888;
}

.product-produzione {
    font-size: 0.75rem;
    color: #aaa;
    font-style: italic;
}

.product-dispo {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.dispo-badge {
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.dispo-ok {
    background: #d4edda;
    color: #155724;
}

.dispo-zero {
    background: #f8d7da;
    color: #721c24;
}

.product-price {
    margin-top: 6px;
}

.price-listino {
    text-decoration: line-through;
    color: #999;
    font-size: 0.85rem;
    margin-right: 4px;
}

.price-netto {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
}

.price-sconto {
    font-size: 0.8rem;
    color: #27ae60;
    font-weight: 600;
}

.price-su-richiesta {
    font-size: 0.85rem;
    color: #aaa;
    font-style: italic;
}

/* ---- Product actions ---- */
.product-actions {
    padding: 10px 12px;
    border-top: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    overflow: hidden;
}

.qty-btn {
    background: #f5f6fa;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    color: #555;
    transition: background 0.15s;
}

.qty-btn:hover { background: #e0e5ef; }

.qty-input {
    width: 48px;
    border: none;
    text-align: center;
    font-size: 0.9rem;
    padding: 6px 4px;
    -moz-appearance: textfield;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.btn-add-cart {
    flex: 1;
    background: #2c5aa0;
    color: #fff;
    border: none;
    padding: 7px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-cart:hover { background: #3a72cc; }
.btn-add-cart.adding { opacity: 0.6; cursor: wait; }
.btn-add-cart.added { background: #27ae60; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 0;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid #2c5aa0;
    color: #2c5aa0;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.2s, color 0.2s;
}

.page-btn:hover {
    background: #2c5aa0;
    color: #fff;
}

.page-info {
    font-size: 0.875rem;
    color: #666;
}

/* ---- Cart panel ---- */
.cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
}

.cart-overlay.open { display: block; }

.cart-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    max-width: 95vw;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.cart-panel.open { right: 0; }

.cart-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e4e7ec;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-header h2 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-count-badge {
    background: #2c5aa0;
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
}

.cart-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
    line-height: 1;
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cart-empty {
    text-align: center;
    color: #999;
    padding: 40px 0;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.cart-table th {
    background: #f5f6fa;
    padding: 8px 6px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    color: #555;
    border-bottom: 2px solid #e4e7ec;
}

.cart-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

.cart-item-codice {
    font-size: 0.75rem;
    font-weight: 700;
    color: #2c5aa0;
    font-family: monospace;
}

.cart-item-desc {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.2;
}

.cart-qty-input {
    width: 56px;
    padding: 5px 6px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    text-align: center;
    font-size: 0.875rem;
    -moz-appearance: textfield;
}

.cart-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.cart-remove {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 4px;
}

.cart-footer {
    padding: 16px 20px;
    border-top: 1px solid #e4e7ec;
    background: #f9fafb;
}

.cart-total {
    font-size: 1rem;
    margin-bottom: 12px;
}

.cart-footer-actions {
    display: flex;
    gap: 10px;
}

.btn-cart-clear {
    padding: 9px 16px;
    border: 1px solid #ccc;
    background: #fff;
    color: #666;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.btn-cart-clear:hover { background: #f5f6fa; }

.btn-cart-checkout {
    flex: 1;
    padding: 9px;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cart-checkout:hover:not(:disabled) { background: #219150; }
.btn-cart-checkout:disabled { opacity: 0.5; cursor: default; }

/* ---- Order confirm modal ---- */
.order-confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
}

.order-confirm-overlay.open { display: block; }

.order-confirm-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    z-index: 301;
    flex-direction: column;
}

.order-confirm-modal.open {
    display: flex;
}

.order-confirm-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e4e7ec;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-confirm-header h2 {
    font-size: 1.1rem;
}

.order-confirm-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

.order-confirm-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.order-confirm-cliente {
    margin-bottom: 14px;
}

.order-confirm-total {
    margin-top: 14px;
    font-size: 1.05rem;
    text-align: right;
}

.order-confirm-note {
    margin-top: 16px;
}

.order-confirm-note label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.order-confirm-note textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
}

.order-confirm-footer {
    padding: 14px 20px;
    border-top: 1px solid #e4e7ec;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- Cards (documenti / ordini) ---- */
.card {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}

.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card-badge {
    display: inline-block;
    background: #2c5aa0;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.card-numero { font-weight: 600; font-size: 1rem; color: #1a1a2e; }
.card-data   { color: #888; font-size: 0.85rem; margin-left: auto; }
.card-note   { margin-top: 8px; font-size: 0.85rem; color: #666; font-style: italic; }

.card-totali {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: #555;
    flex-wrap: wrap;
}

.card-totale { font-weight: 600; color: #1a1a2e; }

.card-actions { margin-top: 12px; }

.btn-dettaglio {
    padding: 6px 16px;
    border: 1px solid #2c5aa0;
    background: #fff;
    color: #2c5aa0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.btn-dettaglio:hover { background: #2c5aa0; color: #fff; }
.btn-dettaglio.loading { opacity: 0.6; cursor: wait; }
.btn-dettaglio.open { background: #e8edf3; border-color: #b0bec5; color: #555; }

.card-detail {
    margin-top: 12px;
    overflow-x: auto;
    animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to   { opacity: 1; max-height: 1000px; }
}

/* ---- Detail table ---- */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.detail-table th {
    background: #f0f2f5;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #444;
    border-bottom: 2px solid #ddd;
}

.detail-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    color: #555;
}

.detail-table .num { text-align: right; white-space: nowrap; }
.detail-table tbody tr:hover { background: #f9fafc; }

/* ---- Stato badge ordini ---- */
.stato-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 10px;
}

.stato-ricevuto    { background: #fff3cd; color: #856404; }
.stato-lavorazione { background: #cce5ff; color: #004085; }
.stato-evaso       { background: #d4edda; color: #155724; }

/* ---- Buttons ---- */
.btn-primary {
    padding: 9px 18px;
    background: #2c5aa0;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: #3a72cc; }

.btn-secondary {
    padding: 9px 18px;
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
}

.btn-secondary:hover { background: #f5f6fa; }

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* ---- Section title ---- */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 16px;
}

/* ---- Filtro data documenti ---- */
.filtro-data {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
}

.filtro-rapido {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.filtro-btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #2c5aa0;
    background: #fff;
    color: #2c5aa0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.filtro-btn:hover,
.filtro-btn.active {
    background: #2c5aa0;
    color: #fff;
}

.filtro-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filtro-custom label {
    font-size: 0.85rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filtro-custom input[type="date"] {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
}

/* ---- Empty message ---- */
.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 0.95rem;
}

/* ---- Notification toast ---- */
.b2b-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #1a1a2e;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 500;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.b2b-toast.show { transform: translateX(-50%) translateY(0); }
.b2b-toast.success { background: #27ae60; }
.b2b-toast.error   { background: #e74c3c; }

/* ---- Admin styles ---- */
.admin-header {
    background: #1a1a2e;
    color: #fff;
    padding: 0;
}

.admin-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-wrap {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

.admin-section {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.admin-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.admin-desc {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 14px;
}

.admin-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.admin-list {
    list-style: none;
    margin-top: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.admin-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid #f0f2f5;
    font-size: 0.875rem;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover { background: #c0392b; }

.btn-icon {
    padding: 3px 8px;
    font-size: 1rem;
    line-height: 1;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.admin-login-form .form-group {
    margin-bottom: 14px;
}

.admin-login-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.admin-login-form input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    font-size: 0.9rem;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .catalog-sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 260px;
        height: 100vh;
        z-index: 150;
        transition: left 0.3s ease;
        max-height: 100vh;
    }

    .catalog-sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    }

    .btn-toggle-sidebar { display: block; }
    .catalog-main { padding: 12px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .product-img { height: 120px; }
}

@media (max-width: 600px) {
    .b2b-header-inner { padding: 10px 14px; }
    .cart-panel { width: 100%; right: -100%; }
    .order-confirm-modal { width: 98%; }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .product-card { font-size: 0.8rem; }
    .product-img { height: 100px; }
    .product-actions { flex-direction: column; gap: 6px; }
    .qty-wrapper { width: 100%; justify-content: center; }
    .btn-add-cart { width: 100%; }

    .detail-table { font-size: 0.75rem; }
    .detail-table th, .detail-table td { padding: 5px 6px; }
}

/* ---------------------------------------------------------------
   Modal dettaglio prodotto
--------------------------------------------------------------- */
.product-detail-modal { max-width: 760px; }

.product-detail-modal-inner {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.pd-img {
    flex: 0 0 260px;
    max-width: 260px;
}

.pd-img img {
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    background: #f5f5f5;
}

.product-img-placeholder-lg {
    width: 100%;
    height: 200px;
    font-size: 2rem;
}

.pd-info { flex: 1; min-width: 0; }

.pd-codice { font-size: 0.85rem; color: #666; margin-bottom: 4px; }
.pd-desc   { font-size: 1.1rem; font-weight: 600; margin: 0 0 8px; }
.pd-meta   { font-size: 0.85rem; color: #555; margin-bottom: 4px; }

.pd-prezzi { margin: 12px 0; font-size: 1rem; }

.pd-dispo  { margin-bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

.pd-desc-estesa {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.pd-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}


@media (max-width: 600px) {
    .product-detail-modal-inner { flex-direction: column; }
    .pd-img { flex: none; max-width: 100%; }
}

/* Alert messaggi feedback */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.95em;
}
.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
