/* Listino Prezzi v1 - Professional Dark/Light Theme */
:root {
    --primary-color: #4a5568;
    --secondary-color: #718096;
    --accent-color: #2b6cb0;
    --success-color: #38a169;
    --danger-color: #e53e3e;
    --warning-color: #d69e2e;
    --bg-primary: #2d3748;
    --bg-secondary: #4a5568;
    --bg-light: #edf2f7;
    --bg-card: #f7fafc;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header Styles */
.navbar {
    background-color: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: white !important;
    letter-spacing: -0.025em;
}

/* Card Styles */
.card {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-radius: 8px;
    background-color: var(--bg-card);
    overflow: hidden;
}

.card-header {
    background-color: var(--bg-primary);
    color: white;
    border-bottom: none;
    font-weight: 600;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
}

/* Navigation Tabs */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
    background-color: white;
    padding: 0 1rem;
}

.nav-tabs .nav-link {
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem 2rem;
    margin-right: 0.5rem;
    border-radius: 0;
    background-color: transparent;
    border-bottom: 3px solid transparent;
}

.nav-tabs .nav-link.active {
    background-color: transparent;
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.nav-tabs .nav-link:hover {
    color: var(--accent-color);
    border-bottom-color: var(--border-color);
}

/* Product Items */
.product-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background-color: white;
    transition: border-color 0.15s ease;
}

.product-item:hover {
    border-color: var(--accent-color);
    background-color: white;
}

.product-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid transparent;
}

.product-name:hover {
    background-color: var(--bg-light);
    border-color: var(--border-color);
}

.product-price {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.1rem;
    font-family: 'JetBrains Mono', monospace;
}

.editable-price {
    cursor: pointer;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    transition: all 0.15s ease;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    min-width: 80px;
    text-align: center;
}

.editable-price:hover {
    background-color: white;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.inline-price-input {
    font-weight: 700;
    color: var(--accent-color);
    text-align: center;
    font-size: 1.1rem;
    padding: 0.6rem 1rem;
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}

.product-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    transition: all 0.15s ease;
}

.btn-outline-primary {
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--accent-color);
    color: white;
}

.btn-outline-danger {
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    background-color: transparent;
}

.btn-outline-danger:hover {
    background-color: var(--danger-color);
    color: white;
}

.category-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background-color: white;
    transition: border-color 0.15s ease;
}

.category-item:hover {
    border-color: var(--primary-color);
}

.category-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.category-order {
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
    background-color: var(--bg-light);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

/* Print Styles */
.print-preview {
    background: white;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    margin-top: 1rem;
    font-family: 'Times New Roman', serif;
}

.print-header {
    text-align: center;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 1rem;
}

.print-title {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--dark-color);
    margin-bottom: 0.3rem;
    letter-spacing: 2px;
}

.print-subtitle {
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.print-date {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.print-content {
    margin-bottom: 2rem;
}

.print-category {
    margin-bottom: 1.5rem;
    break-inside: avoid;
}

.print-category-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.8rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.print-products {
    display: grid;
    gap: 0.3rem;
}

.print-product {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    align-items: center;
    padding: 0.2rem 0;
    font-size: 0.95rem;
}

.print-product-name {
    font-weight: 500;
    color: var(--dark-color);
    grid-column: 1;
}

.print-product-dots {
    grid-column: 2;
    border-bottom: 1px dotted #999;
    margin: 0 0.5rem;
    height: 1px;
    flex-grow: 1;
}

.print-product-price {
    font-weight: 600;
    color: var(--primary-color);
    grid-column: 4;
    text-align: right;
    font-size: 1rem;
}

.print-footer {
    border-top: 2px solid var(--primary-color);
    padding-top: 1rem;
    text-align: center;
    margin-top: auto;
}

.footer-message {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.footer-contact {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-bottom: 0;
}

/* A4 Format - Due colonne di categorie affiancate */
.format-a4 {
    width: 210mm;
    min-height: 297mm;
    font-size: 11px;
    display: flex;
    flex-direction: column;
}

.format-a4 .print-category-row-a4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
    align-items: start;
}

.format-a4 .print-category-a4 {
    margin-bottom: 0;
}

.format-a4 .print-products-a4 {
    columns: 1;
}

.format-a4 .print-product {
    break-inside: avoid;
    margin-bottom: 0.15rem;
    font-size: 0.9rem;
}

.format-a4 .print-category-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* A3 Format - Layout orizzontale */
.format-a3 {
    width: 297mm;
    min-height: 420mm;
    font-size: 13px;
    display: flex;
    flex-direction: column;
}

.format-a3 .print-category-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.format-a3 .print-category-a3 {
    margin-bottom: 0;
}

.format-a3 .print-products-a3 {
    columns: 1;
}

.format-a3 .print-category-title {
    font-size: 1.2rem;
}

/* Print Media Query */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    body {
        margin: 0;
        padding: 0;
        font-size: 12pt;
    }
    
    body * {
        visibility: hidden;
    }
    
    #printableContent {
        visibility: visible;
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0.5cm !important;
        border: none !important;
        border-radius: 0 !important;
        background: white !important;
        box-shadow: none !important;
    }
    
    #printableContent * {
        visibility: visible;
    }
    
    .modal, .modal-backdrop, .navbar, .btn, .card {
        display: none !important;
    }
    
    /* Ensure proper page breaks */
    .print-category, .print-category-row-a4 {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    .print-header {
        page-break-after: avoid;
    }
    
    .print-footer {
        position: fixed;
        bottom: 0.5cm;
        left: 0.5cm;
        right: 0.5cm;
        page-break-inside: avoid;
    }
    
    /* Override any conflicting styles */
    .print-preview {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.modal-header {
    background-color: var(--bg-primary);
    color: white;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        text-align: left;
    }
    
    .product-actions {
        justify-self: end;
    }
    
    .nav-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alert Styles */
.alert {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
}

.alert-success {
    background-color: #f0fff4;
    border-color: var(--success-color);
    color: #22543d;
}

.alert-danger {
    background-color: #fed7d7;
    border-color: var(--danger-color);
    color: #742a2a;
}

.alert-dismissible .btn-close {
    padding: 0.5rem;
    opacity: 0.6;
}

.alert-dismissible .btn-close:hover {
    opacity: 1;
}

/* Button Styles */
.btn {
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.15s ease;
    border: none;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
}

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

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

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

.btn-success:hover {
    background-color: #2f855a;
}

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

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

/* Form Styles */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
