/* Reset e Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
}

.header h1 i {
    color: #3498db;
    margin-right: 15px;
}

.subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 25px 30px;
}

.card-header h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.card-header h2 i {
    margin-right: 10px;
}

.card-header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

.card-body {
    padding: 30px;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #bdc3c7;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9fa;
    margin-bottom: 20px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #3498db;
    background: #e3f2fd;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    color: #3498db;
    margin-bottom: 20px;
}

.upload-content h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.upload-content p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* File List */
.file-list {
    margin: 20px 0;
}

.file-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: between;
    align-items: center;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.file-size {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.file-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-remove:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Upload Actions */
.upload-actions {
    text-align: center;
    margin-top: 20px;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    border-left: 5px solid #3498db;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.summary-icon {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.summary-content h3 {
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.summary-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #27ae60;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.results-table th {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.3s ease;
}

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

.results-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters select,
.filters input {
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
}

.filters select:focus,
.filters input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Export Actions */
.export-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #dee2e6;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading p {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* Stili per pulsanti Export */
.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #218838, #1ea080);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    border: none;
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333, #dc2626);
    transform: translateY(-2px);
}

/* CSS Print Media Queries per formato A4 */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    @page {
        size: A4;
        margin: 15mm;
    }
    
    body {
        font-size: 10pt;
        line-height: 1.2;
        color: #000;
        background: white;
    }
    
    .container {
        max-width: none;
        padding: 0;
        margin: 0;
    }
    
    /* Nascondi elementi non necessari per la stampa */
    .upload-section,
    .export-actions,
    .filters,
    .btn,
    button,
    input,
    select {
        display: none !important;
    }
    
    /* Header per stampa */
    .header {
        text-align: center;
        margin-bottom: 20px;
        border-bottom: 2px solid #333;
        padding-bottom: 10px;
    }
    
    .header h1 {
        font-size: 18pt;
        margin: 0;
        color: #333;
    }
    
    .header .company-info {
        font-size: 12pt;
        margin-top: 5px;
        color: #666;
    }
    
    /* Riepilogo per stampa */
    .summary-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }
    
    .summary-card {
        border: 1px solid #ddd;
        padding: 10px;
        background: #f8f9fa;
    }
    
    .summary-card h3 {
        font-size: 11pt;
        margin: 0 0 5px 0;
        color: #333;
    }
    
    .summary-card .value {
        font-size: 14pt;
        font-weight: bold;
        color: #000;
    }
    
    /* Tabelle per stampa */
    .table-container {
        overflow: visible;
    }
    
    table {
        width: 100%;
        border-collapse: collapse;
        font-size: 8pt;
        page-break-inside: auto;
    }
    
    table thead {
        display: table-header-group;
    }
    
    table tbody {
        display: table-row-group;
    }
    
    table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    table th,
    table td {
        border: 1px solid #333;
        padding: 4px;
        text-align: left;
        vertical-align: top;
    }
    
    table th {
        background: #e9ecef !important;
        font-weight: bold;
        color: #000;
    }
    
    /* Evita interruzioni di pagina indesiderate */
    .results-section {
        page-break-inside: avoid;
    }
    
    .marketplace-summary {
        page-break-inside: avoid;
        margin-bottom: 15px;
    }
    
    /* Footer per stampa */
    .print-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 8pt;
        color: #666;
        border-top: 1px solid #ddd;
        padding-top: 5px;
    }
    
    /* Nascondi contenuto che non serve */
    .loading,
    .no-data {
        display: none !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filters select,
    .filters input {
        width: 100%;
    }
    
    .export-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: #27ae60; }
.text-danger { color: #e74c3c; }
.text-warning { color: #f39c12; }
.text-info { color: #3498db; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Info Section Styles */
.info-section {
    margin-bottom: 30px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border-left: 4px solid #3498db;
    transition: all 0.3s ease;
}

.info-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.15);
    border-left-color: #2980b9;
}

.info-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.info-content h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.info-content p {
    color: #5a6c7d;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Usage Steps */
.usage-steps {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #ecf0f1;
}

.usage-steps h3 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin-bottom: 25px;
    text-align: center;
}

.usage-steps h3 i {
    color: #3498db;
    margin-right: 10px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.step:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.step-number {
    flex-shrink: 0;
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.step-content h4 {
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.step-content p {
    color: #5a6c7d;
    font-size: 0.9rem;
    line-height: 1.4;
}

.step-link {
    margin: 10px 0;
    padding: 10px;
    background: linear-gradient(135deg, #e8f5e8, #d4edda);
    border-radius: 8px;
    border-left: 3px solid #27ae60;
}

.step-link i {
    color: #27ae60;
    margin-right: 8px;
}

.step-link a {
    color: #27ae60;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.step-link a:hover {
    color: #229954;
    text-decoration: underline;
}

.step-note {
    margin-top: 8px !important;
    padding: 8px 12px;
    background: #fff3cd;
    border-radius: 6px;
    border-left: 3px solid #ffc107;
    font-size: 0.85rem !important;
    color: #856404 !important;
}

.step-note i {
    color: #ffc107;
    margin-right: 6px;
}

/* Responsive adjustments for info section */
@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .info-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .steps {
        grid-template-columns: 1fr;
    }
    
    .step {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .header,
    .info-section,
    .upload-section,
    .export-actions,
    .footer {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .results-table {
        font-size: 0.8rem;
    }
    
    .pagination-container {
        display: none;
    }
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px 0;
    border-top: 1px solid #e9ecef;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-pagination {
    background: #fff;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    min-width: 40px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-pagination:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

.btn-pagination:disabled {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-pagination.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
    font-weight: 600;
}

.btn-pagination.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.pagination-numbers {
    display: flex;
    gap: 2px;
    margin: 0 10px;
}

/* Responsive Pagination */
@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .pagination-info {
        order: 2;
    }
    
    .pagination-controls {
        order: 1;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn-pagination {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-width: 35px;
        height: 35px;
    }
}