:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --accent-color: #e67e22;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --border-color: #ddd;
    --success-color: #2ecc71;
    --selection-color: #f39c12;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    margin-bottom: 30px;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.container {
    display: flex;
    gap: 20px;
}

.filters {
    flex: 1;
    padding: 20px;
    background-color: var(--light-gray);
    border-radius: 8px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.results {
    flex: 3;
}

.search-box {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.catalog-item {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}

.catalog-item.selected {
    border: 2px solid var(--selection-color);
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.5);
}

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

.catalog-id-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.catalog-id {
    font-weight: bold;
    color: var(--primary-color);
}

.catalog-ambito {
    background-color: var(--primary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 14px;
}

.catalog-section {
    margin-bottom: 15px;
}

.catalog-section h3 {
    color: var(--secondary-color);
    font-size: 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.catalog-item-list {
    list-style-type: none;
    padding-left: 5px;
}

.catalog-item-entry {
    margin-bottom: 8px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    position: relative;
}

.catalog-item-entry.selected {
    background-color: #e8f4fd;
    border: 1px solid var(--primary-color);
}

.item-selection-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
}

.keywords {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.keyword {
    background-color: var(--light-gray);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--secondary-color);
}

.loading {
    text-align: center;
    padding: 50px;
    font-size: 18px;
    color: var(--secondary-color);
}

#uploadSection, #selectionSection {
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--light-gray);
    border-radius: 8px;
}

#fileInput {
    margin-right: 10px;
}

.btn {
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: var(--accent-color);
}

.btn-secondary:hover {
    background-color: #d35400;
}

.message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
}

.success {
    background-color: var(--success-color);
    color: white;
}

.error {
    background-color: #e74c3c;
    color: white;
}

.no-results {
    text-align: center;
    padding: 50px;
    color: var(--secondary-color);
    font-style: italic;
}

.select-btn {
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    background-color: var(--accent-color);
    color: white;
    font-size: 14px;
    border: none;
}

.quantity-controls {
    margin-top: 15px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 4px;
    display: none;
}

.quantity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.quantity-label {
    font-weight: bold;
    min-width: 150px;
}

.quantity-input {
    width: 60px;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
}

.selected-items-counter {
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--accent-color);
}

#selectionSection {
    display: none;
}

#selectedItemsPreview {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    background-color: white;
    border-radius: 4px;
    padding: 10px;
}

.preview-item {
    padding: 8px;
    background-color: var(--light-gray);
    margin-bottom: 5px;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

.preview-details {
    display: flex;
    flex-direction: column;
}

.preview-ambito {
    font-size: 12px;
    color: var(--secondary-color);
}

.preview-quantities {
    text-align: right;
}

.preview-quantity {
    font-weight: bold;
    color: var(--accent-color);
    margin-left: 10px;
}

.json-preview {
    background-color: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 8px;
    overflow: auto;
    max-height: 300px;
    margin-top: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    white-space: pre;
}

.detailed-selection {
    padding: 10px;
    margin-top: 10px;
    background-color: #f8f8f8;
    border-radius: 4px;
    border: 1px dashed var(--border-color);
}

.detail-section-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 3px;
}

.selectable-item {
    position: relative;
    padding: 5px 25px 5px 5px;
    margin-bottom: 5px;
    background-color: white;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.selectable-item.selected {
    background-color: #e8f4fd;
    border-color: var(--primary-color);
}

.select-item-checkbox {
    position: absolute;
    top: 5px;
    right: 5px;
}

/* Nuovi stili per i totali e prezzi */
.totals-container {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #e8f4fd;
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.totals-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.total-points {
    font-size: 16px;
    font-weight: bold;
    color: var(--accent-color);
}

.price-row {
    margin: 5px 0;
    padding: 5px 0;
    border-bottom: 1px dashed var(--border-color);
}

.price-total {
    font-weight: bold;
    color: var(--primary-color);
}

.total-price-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--accent-color);
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-total-label {
    font-weight: bold;
    font-size: 16px;
}

.price-total-amount {
    font-weight: bold;
    font-size: 18px;
    color: var(--accent-color);
}

.catalog-prezzi {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin-top: 5px;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .filters {
        position: static;
        max-height: none;
    }
}

.file-formats-info {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Aggiungi questi stili alla fine del file styles.css */

/* Stili per l'header con informazioni utente */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-title {
    flex: 1;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: var(--light-gray);
    padding: 10px 15px;
    border-radius: 6px;
    margin-top: 5px;
}

#userEmailDisplay {
    font-weight: 600;
    color: var(--secondary-color);
}

.logout-btn {
    background-color: #e74c3c;
    font-size: 14px;
    padding: 6px 12px;
}

.logout-btn:hover {
    background-color: #c0392b;
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
    }

    .user-info {
        width: 100%;
        margin-top: 15px;
        justify-content: space-between;
    }
}

