/* Stili per il frontend dell'inventario */

.inventario-frontend-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Controlli */
.inventario-controls {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.controls-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
    align-items: center;
}

.search-control input,
.filter-control select,
.sort-control select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
}

.search-control input:focus,
.filter-control select:focus,
.sort-control select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.search-control input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Statistiche */
.inventario-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.inventario-stats h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabella */
.inventario-table-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.inventario-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.inventario-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.inventario-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.inventario-table th:hover {
    background-color: #e9ecef;
}

.inventario-table th:after {
    content: "↕";
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 12px;
}

.inventario-table th.sort-asc:after {
    content: "↑";
    opacity: 1;
}

.inventario-table th.sort-desc:after {
    content: "↓";
    opacity: 1;
}

.inventario-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

.inventario-table tbody tr {
    transition: background-color 0.2s ease;
}

.inventario-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Badge categoria */
.categoria-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.categoria-notebook {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1976d2;
    border-color: #90caf9;
}

.categoria-tastiera {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    color: #7b1fa2;
    border-color: #ce93d8;
}

.categoria-mouse {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    color: #388e3c;
    border-color: #a5d6a7;
}

.categoria-borse {
    background: linear-gradient(135deg, #fff3e0, #ffcc02);
    color: #f57c00;
    border-color: #ffb74d;
}

/* Quantità */
.quantita-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 13px;
    min-width: 35px;
    text-align: center;
    border: 2px solid transparent;
}

.quantita-badge.in-stock {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-color: #28a745;
}

.quantita-badge.low-stock {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border-color: #ffc107;
    animation: pulse 2s infinite;
}

.quantita-badge.out-of-stock {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-color: #dc3545;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.stock-warning {
    margin-left: 8px;
    font-size: 16px;
}

/* Prezzi */
.price {
    font-weight: 600;
    color: #28a745;
}

.no-price {
    color: #6c757d;
    font-style: italic;
}

/* Date */
.no-date {
    color: #6c757d;
    font-style: italic;
}

/* Seriali */
.seriale code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #495057;
    border: 1px solid #e9ecef;
}

/* Foto prodotti */
.foto-cell {
    width: 80px;
    text-align: center;
}

.prodotto-foto {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.prodotto-foto:hover {
    transform: scale(1.1);
    border-color: #007cba;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.no-foto-placeholder {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.no-foto-icon {
    font-size: 24px;
    color: #6c757d;
    opacity: 0.6;
}

/* Destinatario */
.destinatario-text {
    font-weight: 500;
    color: #495057;
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.no-destinatario {
    color: #6c757d;
    font-style: italic;
}

/* Modal per foto */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    cursor: default;
}

.image-modal-content img {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    margin: 0 auto;
}

.image-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 30px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    z-index: 10001;
}

.image-modal-close:hover {
    color: #ff6b6b;
}

.image-modal-caption {
    padding: 10px;
    background: #f8f9fa;
    text-align: center;
    font-size: 14px;
    color: #495057;
}

/* Note */
.note-text {
    max-width: 200px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-note {
    color: #6c757d;
    font-style: italic;
}

/* Nome prodotto */
.nome-prodotto strong {
    color: #212529;
    font-size: 15px;
}

/* Messaggio nessun prodotto */
.no-products {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.no-products-message {
    max-width: 400px;
    margin: 0 auto;
}

.no-products-message p {
    margin: 10px 0;
    line-height: 1.6;
}

/* Footer */
.inventario-footer {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    color: #6c757d;
    font-size: 13px;
}

.update-info {
    margin: 0 0 15px 0;
    font-weight: 500;
}

.legend {
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .inventario-frontend-container {
        padding: 15px;
    }
    
    .controls-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stats-row {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .inventario-table {
        font-size: 13px;
    }
    
    .inventario-table th,
    .inventario-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 768px) {
    .inventario-frontend-container {
        padding: 10px;
    }
    
    .inventario-table-wrapper {
        overflow-x: auto;
    }
    
    .inventario-table {
        min-width: 800px;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .legend {
        flex-direction: column;
        gap: 10px;
    }
    
    .categoria-badge,
    .quantita-badge {
        font-size: 10px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .stat-number {
        font-size: 20px;
    }
    
    .inventario-stats {
        padding: 15px;
    }
    
    .inventario-controls {
        padding: 15px;
    }
}

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

.inventario-frontend-container > * {
    animation: fadeInUp 0.6s ease-out;
}

.inventario-frontend-container > *:nth-child(1) { animation-delay: 0.1s; }
.inventario-frontend-container > *:nth-child(2) { animation-delay: 0.2s; }
.inventario-frontend-container > *:nth-child(3) { animation-delay: 0.3s; }
.inventario-frontend-container > *:nth-child(4) { animation-delay: 0.4s; }

/* Stati di caricamento */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Miglioramenti accessibilità */
.inventario-table th:focus,
.search-control input:focus,
.filter-control select:focus,
.sort-control select:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Stili per stampa */
@media print {
    .inventario-controls,
    .inventario-footer {
        display: none;
    }
    
    .inventario-table {
        font-size: 12px;
    }
    
    .inventario-table th,
    .inventario-table td {
        padding: 8px 6px;
    }
}
