/* ===== AnalisiLogSM - Stylesheet ===== */
/* Autore: Nostridomini Development Team */
/* Versione: 1.0.0 */

/* === Reset e Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

main {
    flex: 1;
    padding: 2rem 0;
}

/* === Header e Navigation === */
header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    box-shadow: var(--shadow-lg);
}

.navbar {
    padding: 1.5rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.navbar-brand h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    font-weight: 500;
    display: block;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Sezioni del menù con sottomenù */
.nav-section {
    position: relative;
}

.nav-section-title {
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    display: block;
    transition: background-color 0.2s;
}

.nav-section:hover .nav-section-title {
    background-color: rgba(255, 255, 255, 0.1);
}

/* === Footer === */
footer {
    background-color: var(--text-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

footer p {
    margin: 0;
    opacity: 0.8;
}

/* === Page Header === */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.page-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* === Services Grid (Dashboard Generale) === */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.service-card {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid var(--border-color);
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.service-card.service-placeholder {
    opacity: 0.6;
    border-style: dashed;
}

.service-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-align: center;
}

.service-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.service-description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.service-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.service-actions .btn {
    flex: 1;
    min-width: 100px;
    text-align: center;
}

/* === Cards e Sezioni === */
.section {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.section h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    color: var(--text-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card.highlight {
    border: 2px solid var(--primary-color);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.stat-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stat-content h3, .stat-content h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 0.5rem 0;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin: 0;
}

.stat-value-small {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.4;
    margin: 0;
}

/* === Tables === */
.table-responsive {
    overflow-x: auto;
    margin: 1rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

.data-table thead {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Severity Classes */
.severity-high {
    background-color: #fef2f2 !important;
}

.severity-medium {
    background-color: #fffbeb !important;
}

.severity-low {
    background-color: #f0fdf4 !important;
}

.text-center {
    text-align: center;
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.375rem;
    line-height: 1;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

/* === Progress Bars === */
.progress-bar {
    width: 100%;
    height: 1.5rem;
    background-color: #e5e7eb;
    border-radius: 0.375rem;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 0.375rem;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
}

.progress-text {
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: #2563eb;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none;
}

/* === Alerts === */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-error {
    background-color: #fee2e2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-info {
    background-color: #dbeafe;
    border-color: var(--info-color);
    color: #1e40af;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

/* === Info Boxes === */
.info-box {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1rem 0;
}

.info-box p {
    margin: 0.5rem 0;
}

.info-box strong {
    color: var(--text-color);
}

.info-box code {
    background-color: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.code-block {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.code-block code {
    background: none;
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* === Forms === */
.filter-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-color);
}

.form-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filters-section {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

/* === Actions Section === */
.actions-section {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
}

/* === File List === */
.file-list {
    margin-top: 1rem;
}

.file-list ul {
    list-style: none;
    padding: 0;
}

.file-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.file-list li:last-child {
    border-bottom: none;
}

/* === Results Grid === */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.result-card {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
}

.result-card h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 0 0 1rem 0;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

/* === Warning and Danger Zones === */
.warning-box {
    background-color: #fef3c7;
    border: 1px solid var(--warning-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1rem 0;
}

.warning-box strong {
    color: #92400e;
}

.warning-box ul {
    margin: 0.5rem 0 0 1.5rem;
    color: #92400e;
}

.danger-zone {
    background-color: #fee2e2;
    border: 2px solid var(--danger-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1rem 0;
}

.danger-zone h4 {
    color: #991b1b;
    margin: 0 0 0.5rem 0;
}

.danger-zone p {
    color: #7f1d1d;
    margin: 0.5rem 0 1rem 0;
}

/* === Legend === */
.legend {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.legend h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.legend-items {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
}

/* === Severity Grid === */
.severity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.severity-card {
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 2px solid;
    text-align: center;
}

.severity-card.severity-high {
    background-color: #fee2e2;
    border-color: var(--danger-color);
}

.severity-card.severity-medium {
    background-color: #fef3c7;
    border-color: var(--warning-color);
}

.severity-card.severity-low {
    background-color: #d1fae5;
    border-color: var(--success-color);
}

.severity-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}

.severity-card .stat-value {
    font-size: 2.5rem;
    margin: 0.5rem 0;
}

.severity-card small {
    color: var(--text-muted);
}

/* === Date Range === */
.date-range {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.date-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-separator {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* === Spinner === */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === Form Actions === */
.form-actions {
    margin: 2rem 0;
    text-align: center;
}

.import-form {
    max-width: 800px;
    margin: 0 auto;
}

/* === Form Groups === */
.form-group {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.form-group h4 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

.form-help {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.date-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.date-field {
    display: flex;
    flex-direction: column;
}

.date-field label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.form-control {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.checkbox-group label:hover {
    background-color: var(--bg-color);
}

.checkbox-group input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* === Responsive === */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar-menu {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .form-input {
        width: 100%;
    }

    .actions-section {
        flex-direction: column;
    }

    .actions-section .btn {
        width: 100%;
    }

    .date-range {
        flex-direction: column;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* === Modal Styles per Email Dates === */
/* Stili per la griglia delle date delle email nel modal */
.email-dates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.date-badge {
    background-color: #dbeafe;
    color: #1e40af;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid #3b82f6;
    transition: all 0.2s;
}

.date-badge:hover {
    background-color: #bfdbfe;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* === Modal Styles === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-header h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.modal-body {
    text-align: center;
}

.modal-message {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 2rem;
}

.modal-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1.5rem;
    font-style: italic;
}

.progress-container {
    margin: 2rem 0;
}

.progress-bar-wrapper {
    width: 100%;
    height: 2.5rem;
    background-color: #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 50%, #1e40af 100%);
    background-size: 200% 100%;
    border-radius: 0.75rem;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0%;
    animation: progressShimmer 2s linear infinite;
    position: relative;
    overflow: hidden;
}

@keyframes progressShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progressGloss 1.5s ease-in-out infinite;
}

@keyframes progressGloss {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

/* === Sort Links === */
/* Stili per i link di ordinamento nelle tabelle */
.sort-link {
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s;
    cursor: pointer;
}

.sort-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.data-table th a.sort-link {
    color: white;
    font-weight: 600;
}

/* === Print Styles === */
@media print {
    header, footer, .actions-section, .export-buttons, .filters-section {
        display: none;
    }

    body {
        background-color: white;
    }

    .section {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .modal-overlay {
        display: none !important;
    }

    .sort-link {
        color: black !important;
        text-decoration: none !important;
    }
}

/* ============================================ */
/* === NUOVO LAYOUT CON SIDEBAR VERTICALE === */
/* ============================================ */

/* Modifica body per layout con sidebar */
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* === Sidebar Navigation === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed {
    width: 70px;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
}

.brand-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.brand-text {
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 0.25rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background-color: rgba(37, 99, 235, 0.2);
    color: white;
    border-left: 4px solid #3b82f6;
}

.nav-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}

.nav-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Submenu */
.has-submenu .nav-link {
    justify-content: flex-start;
}

.submenu-arrow {
    font-size: 0.9rem;
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
    margin-right: 0.5rem;
    order: -1; /* Posiziona la freccia all'inizio */
}

.sidebar.collapsed .submenu-arrow {
    opacity: 0;
}

.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.2);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-item.open .nav-submenu {
    max-height: 500px;
}

.nav-subitem {
    margin: 0;
}

.nav-sublink {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem 0.75rem 3.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.sidebar.collapsed .nav-sublink {
    padding-left: 1.25rem;
}

.nav-sublink:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-sublink.active {
    background-color: rgba(37, 99, 235, 0.3);
    color: white;
    font-weight: 600;
}

.nav-subtext {
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-subtext {
    opacity: 0;
}

/* Badge Coming Soon */
.badge-coming-soon {
    font-size: 0.65rem;
    background-color: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .badge-coming-soon {
    opacity: 0;
}

.nav-item.disabled .nav-link {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Sidebar Footer */
/* === Sidebar Footer === */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.version-info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .version-info {
    opacity: 0;
}

/* === Sidebar Toggle Button === */
/* Posizionato in basso a destra, sopra la linea bianca del footer */
.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: absolute;
    bottom: 100%;
    right: 1rem;
    margin-bottom: 0.5rem;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.sidebar.collapsed .sidebar-toggle-btn {
    /* Quando la sidebar è collassata, il pulsante rimane visibile */
}

.toggle-icon {
    font-size: 1rem;
    font-weight: normal;
    line-height: 1;
    transition: transform 0.3s ease;
}

/* === Main Content Area === */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    background-color: var(--bg-color);
}

.main-content.sidebar-collapsed {
    margin-left: 70px;
}

/* Top Header */
.top-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.header-left {
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

/* Date Filter Compact (in header) */
.date-filter-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.date-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.form-input-compact {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    min-width: 140px;
}

.form-input-compact:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.btn-compact {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Footer */
.content-footer {
    background-color: var(--text-color);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-content p {
    margin: 0;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* === Dashboard Styles === */
.page-header-dashboard {
    margin-bottom: 2rem;
}

.page-header-dashboard h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

/* Global Date Filter */
.global-date-filter {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.date-filter-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.date-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
    min-width: 160px;
}

.date-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-filter {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filter:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-reset {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-reset:hover {
    background-color: #475569;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.filter-header {
    margin-bottom: 1rem;
}

.filter-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
}

.filter-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.filter-form-global {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-inputs {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.btn-icon {
    margin-right: 0.5rem;
}

/* Dashboard Boxes */
.dashboard-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-box {
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.dashboard-box-placeholder {
    opacity: 0.7;
    border-style: dashed;
}

.box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid var(--border-color);
}

.box-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.box-icon {
    font-size: 1.75rem;
}

.box-title h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.box-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.btn-link:hover {
    color: #1e40af;
    text-decoration: underline;
}

.box-content {
    padding: 1.5rem;
}

.box-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1.5rem;
}

.box-stat {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-value-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.box-footer-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.placeholder-text {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
}

/* === Responsive Design per Sidebar === */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .main-content.sidebar-collapsed {
        margin-left: 0;
    }

    .sidebar-toggle-btn {
        left: 1rem;
    }

    .sidebar-toggle-btn.sidebar-collapsed {
        left: 1rem;
    }

    .dashboard-boxes {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 1rem;
    }

    .top-header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .header-left {
        text-align: center;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .date-filter-compact {
        flex-direction: column;
        align-items: stretch;
    }

    .date-filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .form-input-compact {
        width: 100%;
    }

    .filter-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .box-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* === Paginazione === */
.pagination-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.pagination-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.pagination-info p {
    margin: 0;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pagination-current {
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: 0.375rem;
    font-size: 0.95rem;
    color: var(--text-color);
}

.pagination-controls .btn {
    min-width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination-controls .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--secondary-color);
}

.page-size-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.page-size-selector label {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

.page-size-selector .form-input {
    width: auto;
    min-width: 100px;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .pagination-section {
        padding: 1rem;
    }

    .pagination-controls {
        gap: 0.5rem;
    }

    .pagination-current {
        font-size: 0.875rem;
        padding: 0.4rem 0.75rem;
    }

    .page-size-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .page-size-selector .form-input {
        width: 100%;
    }
}

/* ============================================
   USER MENU STYLES
   ============================================ */

.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
}

.user-info:hover {
    background: rgba(0, 0, 0, 0.05);
}

.user-icon {
    font-size: 1.2rem;
    color: var(--text-color);
}

.user-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
}

.user-badge {
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-badge-role {
    background: #ef4444;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    padding-top: 8px; /* Ponte invisibile per mantenere l'hover */
    background: transparent;
    min-width: 200px;
    z-index: 1001;
}

/* Contenuto effettivo del dropdown con stili visivi */
.user-dropdown-content {
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.user-menu:hover .user-dropdown {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f3f4f6;
}

.dropdown-item.logout {
    border-top: 1px solid #e5e7eb;
    color: #dc2626;
}

.dropdown-item.logout:hover {
    background: #fee2e2;
}

/* ============================================
   HEADER DATE FILTER STYLES
   ============================================ */

.header-date-filter {
    display: flex;
    align-items: center;
}

.header-date-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-input-group label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
}

.date-input-compact {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    color: #1e293b;
    transition: all 0.3s;
    font-weight: 500;
}

.date-input-compact:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.date-input-compact::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

.btn-filter-compact,
.btn-reset-compact {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-filter-compact {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.btn-filter-compact:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.btn-reset-compact {
    background: #64748b;
    color: white;
    display: inline-block;
}

.btn-reset-compact:hover {
    background: #475569;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(100, 116, 139, 0.2);
}

/* Responsive per il filtro date nell'header */
@media (max-width: 1200px) {
    .header-date-form {
        flex-wrap: wrap;
        gap: 6px;
    }

    .date-input-compact {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    .btn-filter-compact,
    .btn-reset-compact {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
}

@media (max-width: 768px) {
    .header-date-filter {
        display: none;
    }
}

/* ===== Date Range Picker Dropdown ===== */

/* Container relativo per posizionare il dropdown */
.date-picker-container {
    position: relative;
}

/* Trigger per aprire il dropdown */
.date-picker-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.date-picker-trigger:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

/* Campo data con label sopra */
.date-picker-field {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.date-picker-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: #64748b;
    text-transform: none;
    line-height: 1;
}

.date-picker-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}

.date-picker-separator {
    font-size: 1rem;
    color: #94a3b8;
    margin: 0 4px;
    align-self: flex-end;
    padding-bottom: 2px;
}

.date-picker-icon {
    font-size: 1rem;
}

.date-picker-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.date-picker-arrow {
    font-size: 0.6rem;
    color: #64748b;
    transition: transform 0.2s ease;
    align-self: center;
}

.date-picker-trigger.active .date-picker-arrow {
    transform: rotate(180deg);
}

/* Dropdown container */
.date-picker-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    min-width: 380px;
}

.date-picker-dropdown.active {
    display: block;
}

/* Body del dropdown - layout a due colonne */
.date-picker-dropdown-body {
    display: flex;
}

/* Colonna preimpostazioni */
.date-picker-presets {
    width: 110px;
    padding: 6px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.preset-btn {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 0.7rem;
    color: #475569;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.preset-btn:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #2563eb;
}

.preset-btn.active {
    background: #1e40af;
    border-color: #1e40af;
    color: white;
    font-weight: 600;
}

/* Colonna calendari */
.date-picker-calendars {
    flex: 1;
    padding: 8px;
}

/* Input manuali per le date nel modal */
.date-inputs-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

/* Campo data con label sopra - centrato */
.date-input-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.date-input-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: #64748b;
    line-height: 1;
    text-align: center;
}

.date-input-manual {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #1e293b;
    transition: border-color 0.2s;
    text-align: center;
}

/* Nasconde l'icona del calendario negli input date */
.date-input-manual::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

.date-input-manual:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.date-input-separator {
    color: #94a3b8;
    font-size: 1rem;
    align-self: flex-end;
    padding-bottom: 8px;
}

/* Mantiene compatibilità con vecchi stili */
.date-input-group {
    flex: 1;
}

.date-input-group label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 3px;
    text-transform: uppercase;
}

/* Navigazione calendari */
.calendar-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.calendar-nav-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
}

.calendar-nav-btn {
    width: 22px;
    height: 22px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.65rem;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.calendar-nav-btn:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #2563eb;
}

/* Calendari verticali */
.calendars-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Singolo calendario - compatto */
.calendar-month {
    background: white;
    border: 1px solid #f1f5f9;
    border-radius: 4px;
    padding: 4px 6px;
}

.calendar-month-header {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
    padding-bottom: 2px;
    border-bottom: 1px solid #f1f5f9;
}

/* Griglia giorni della settimana - compatta */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 1px;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.55rem;
    font-weight: 700;
    color: #94a3b8;
    padding: 1px 0;
    text-transform: uppercase;
}

/* Griglia dei giorni - compatta */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}

.calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #475569;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.1s ease;
    border: none;
    background: transparent;
    padding: 0;
    height: 24px;
    font-weight: 500;
}

.calendar-day:hover:not(.disabled):not(.empty) {
    background: #eff6ff;
    color: #2563eb;
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.disabled {
    color: #cbd5e1;
    cursor: not-allowed;
}

.calendar-day.today {
    font-weight: 700;
    color: #2563eb;
    border: 1px solid #3b82f6;
}

/* Stili per la selezione del range - ALTO CONTRASTO */
.calendar-day.selected-start,
.calendar-day.selected-end {
    background: #1e3a8a;
    color: white;
    font-weight: 700;
}

.calendar-day.selected-start {
    border-radius: 4px 0 0 4px;
}

.calendar-day.selected-end {
    border-radius: 0 4px 4px 0;
}

.calendar-day.selected-start.selected-end {
    border-radius: 4px;
}

/* Range selezionato - ALTO CONTRASTO */
.calendar-day.in-range {
    background: #3b82f6;
    color: white;
    border-radius: 0;
    font-weight: 600;
}

.calendar-day.in-range:hover {
    background: #2563eb;
}

/* Footer del dropdown */
.date-picker-dropdown-footer {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 8px 8px;
}

.btn-cancel {
    background: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-cancel:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

.btn-apply {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border: none;
    color: white;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-apply:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

/* Responsive per il Date Picker Dropdown */
@media (max-width: 768px) {
    .date-picker-dropdown {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        min-width: auto;
        width: 95%;
        max-width: 400px;
        max-height: 90vh;
    }

    .date-picker-dropdown-body {
        flex-direction: column;
        max-height: calc(90vh - 60px);
        overflow-y: auto;
    }

    .date-picker-presets {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding: 8px;
    }

    .preset-btn {
        flex: 1 1 calc(50% - 4px);
        text-align: center;
        font-size: 0.7rem;
        padding: 6px 8px;
    }

    .date-picker-calendars {
        max-height: none;
    }
}

/* ============================================
   VALIDATION SUMMARY - NASCONDI QUANDO VUOTO
   ============================================ */

/*
 * Nasconde il div validation-summary di default.
 * Il div viene mostrato SOLO quando ASP.NET Core aggiunge la classe
 * 'validation-summary-errors' (quando ci sono errori di validazione).
 *
 * Questo approccio è più affidabile del selettore :has() che non è
 * supportato da tutti i browser.
 */

/* Nasconde il validation-summary di default */
.validation-summary {
    display: none;
}

/* Mostra SOLO quando ASP.NET Core aggiunge la classe validation-summary-errors */
.validation-summary.validation-summary-errors {
    display: block;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.validation-summary ul {
    margin: 0;
    padding-left: 20px;
    color: #dc2626;
}

/* Stile per i messaggi di validazione sui singoli campi */
.text-validation-error:empty,
.field-validation-error:empty,
.field-validation-valid {
    display: none;
}

/*
 * Stile per i messaggi di errore visibili
 * Rende i messaggi più user-friendly
 */
.field-validation-error,
.text-validation-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 5px;
    display: block;
}

/* ============================================
   TRAFFICO REAL TIME - STILI
   ============================================ */

/* Container principale */
.realtime-container {
    background: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Header del box real-time */
.realtime-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.realtime-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Indicatore di stato (pallino colorato) */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #64748b;
    transition: all 0.3s ease;
}

.status-indicator.connecting {
    background-color: #f59e0b;
    animation: pulse 1.5s infinite;
}

.status-indicator.active {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-indicator.paused {
    background-color: #3b82f6;
}

.status-indicator.waiting {
    background-color: #f59e0b;
}

.status-indicator.error,
.status-indicator.disconnected {
    background-color: #ef4444;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
}

.realtime-info {
    flex: 1;
    text-align: center;
}

.file-name {
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
}

.realtime-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Selettore intervallo di refresh */
.refresh-selector {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #6e7681;
}

.refresh-selector label {
    margin: 0;
    font-weight: 500;
}

.refresh-selector select {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid #30363d;
    border-radius: 4px;
    background: #21262d;
    color: #c9d1d9;
    cursor: pointer;
    min-width: 80px;
}

.refresh-selector select:hover {
    border-color: #58a6ff;
}

.refresh-selector select:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.realtime-controls .btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Box del log (console) */
.realtime-log-box {
    height: 500px;
    overflow-y: auto;
    overflow-x: auto;
    background: #0d1117;
    color: #c9d1d9;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    padding: 1rem;
    scroll-behavior: smooth;
}

/* Scrollbar personalizzata per il box log */
.realtime-log-box::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.realtime-log-box::-webkit-scrollbar-track {
    background: #161b22;
}

.realtime-log-box::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 5px;
}

.realtime-log-box::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* Loading nel box log */
.log-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: #8b949e;
    font-style: italic;
}

.log-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #30363d;
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Singola riga di log */
.log-line {
    padding: 0.15rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    white-space: pre-wrap;
    word-break: break-all;
}

.log-line:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Colori per i diversi tipi di log */
.log-line.auth-failed {
    color: #f85149;
    background-color: rgba(248, 81, 73, 0.1);
}

.log-line.auth-success {
    color: #3fb950;
    background-color: rgba(63, 185, 80, 0.1);
}

.log-line.auth-attempt {
    color: #58a6ff;
}

/* Messaggio informativo nel log */
.log-info {
    color: #8b949e;
    font-style: italic;
    text-align: center;
    padding: 0.5rem 0;
}

/* Footer del box real-time */
.realtime-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-stats .separator {
    color: var(--border-color);
}

/* Legenda nel footer */
.footer-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-legend .legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.footer-legend .legend-color.auth-failed {
    background-color: #f85149;
}

.footer-legend .legend-color.auth-success {
    background-color: #3fb950;
}

.footer-legend .legend-color.auth-attempt {
    background-color: #58a6ff;
}

/* Responsive per il traffico real-time */
@media (max-width: 768px) {
    .realtime-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .realtime-status {
        justify-content: center;
    }

    .realtime-info {
        text-align: center;
    }

    .realtime-controls {
        justify-content: center;
    }

    .realtime-log-box {
        height: 400px;
        font-size: 0.75rem;
    }

    .realtime-footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-legend {
        justify-content: center;
    }
}

