:root {
    --primary-color: #2ecc71;
    --secondary-color: #27ae60;
    --background-color: #f5f6fa;
    --text-color: #2c3e50;
    --sidebar-width: 280px;
    --notification-hover: #f8f9fa;
    --notification-border: #e9ecef;
    --unread-indicator: #dc3545;
}

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

body {
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

/* Dark Mode Global Styles */
body.dark-mode {
    --primary-color: #4caf50;
    --secondary-color: #45a049;
    --background-color: #121212;
    --text-color: #ffffff;
    --sidebar-bg: #1e1e1e;
    --card-bg: #2d2d2d;
    --border-color: #444444;
    --input-bg: #333333;
    --hover-bg: #383838;
    --notification-hover: #383838;
    --notification-border: #444444;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Dark mode sidebar */
body.dark-mode .sidebar {
    background-color: var(--sidebar-bg);
    color: var(--text-color);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.3);
}

/* Dark mode cards */
body.dark-mode .settings-card,
body.dark-mode .card,
body.dark-mode .notification-card {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* Dark mode inputs and forms */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

/* Dark mode buttons */
body.dark-mode button,
body.dark-mode .btn {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

body.dark-mode button:hover,
body.dark-mode .btn:hover {
    background-color: var(--hover-bg);
}

/* Dark mode navigation */
body.dark-mode .nav-item:hover {
    background-color: var(--hover-bg);
}

/* Dark mode header */
body.dark-mode header {
    background-color: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Dark mode search bar */
body.dark-mode .search-bar {
    background-color: var(--input-bg);
}

body.dark-mode .search-bar input {
    background-color: transparent;
    color: var(--text-color);
}

/* Dark mode tables */
body.dark-mode table,
body.dark-mode th,
body.dark-mode td {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

/* Dark mode modals */
body.dark-mode .modal,
body.dark-mode .modal-content {
    background-color: var(--card-bg);
    color: var(--text-color);
}

/* Dark mode notifications */
body.dark-mode .notification-item {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .notification-item:hover {
    background-color: var(--hover-bg);
}

/* Dark mode additional elements for complete homogeneity */
body.dark-mode .wrapper {
    background-color: var(--background-color);
}

body.dark-mode .main-content,
body.dark-mode .content {
    background-color: var(--background-color);
    color: var(--text-color);
}

body.dark-mode .dashboard-container,
body.dark-mode .monitoring-container,
body.dark-mode .new-shipment-container {
    background-color: var(--background-color);
    color: var(--text-color);
}

body.dark-mode .logo,
body.dark-mode .logo h2 {
    color: var(--text-color) !important;
}

body.dark-mode .nav-item,
body.dark-mode .nav-item a {
    color: var(--text-color);
}

body.dark-mode .nav-item.active {
    background-color: var(--primary-color);
    color: white;
}

body.dark-mode .user-info,
body.dark-mode .user-info span {
    color: var(--text-color);
}

body.dark-mode .notification-icon {
    color: var(--text-color);
}

body.dark-mode .profile-section,
body.dark-mode .security-section,
body.dark-mode .preferences-section,
body.dark-mode .notifications-section {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
}

body.dark-mode .input-help,
body.dark-mode small {
    color: #cccccc;
}

/* Miglioramento visibilità titoli e header in dark mode */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #ffffff !important;
}

body.dark-mode .profile-section h3,
body.dark-mode .security-section h3,
body.dark-mode .preferences-section h3,
body.dark-mode .notifications-section h3 {
    color: #ffffff !important;
    font-weight: 600;
}

body.dark-mode label,
body.dark-mode .form-label {
    color: #e0e0e0 !important;
    font-weight: 500;
}

body.dark-mode .section-title,
body.dark-mode .card-title,
body.dark-mode .settings-section-title {
    color: #ffffff !important;
}

body.dark-mode p,
body.dark-mode .text,
body.dark-mode .description {
    color: #d0d0d0;
}

body.dark-mode .readonly-field {
    background-color: #2a2a2a;
    color: #d0d0d0;
    border: 1px solid #444444;
}

/* Eliminazione bordi e parti bianche in dark mode */
body.dark-mode .settings-card,
body.dark-mode .card,
body.dark-mode .notification-card,
body.dark-mode .container,
body.dark-mode .section {
    border: none !important;
    box-shadow: none !important;
}

body.dark-mode .profile-section,
body.dark-mode .security-section,
body.dark-mode .preferences-section,
body.dark-mode .notifications-section {
    background-color: var(--card-bg) !important;
    border: none !important;
    box-shadow: none !important;
}

/* Uniformare background per eliminare parti bianche */
body.dark-mode .main-content,
body.dark-mode .content,
body.dark-mode .settings-container,
body.dark-mode .dashboard-container {
    background-color: var(--bg-color) !important;
}

body.dark-mode .form-group,
body.dark-mode .input-group,
body.dark-mode .field-group {
    background-color: transparent !important;
    border: none !important;
}

/* Rimuovere separatori visibili */
body.dark-mode hr,
body.dark-mode .divider,
body.dark-mode .separator {
    border-color: #444444;
    opacity: 0.3;
}

body.dark-mode .form-control,
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    border: 1px solid #444444 !important;
    box-shadow: none !important;
}

/* Correzioni selettive background dark mode (rimossa regola universale troppo aggressiva) */
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="tel"],
body.dark-mode input[type="file"] {
    background-color: var(--input-bg) !important;
    color: var(--text-color) !important;
}

body.dark-mode .form-row,
body.dark-mode .input-row,
body.dark-mode .field-wrapper,
body.dark-mode .input-wrapper {
    background-color: transparent;
}

/* Ripristino visibilità testi e contrasti */
body.dark-mode .text-content,
body.dark-mode .field-value,
body.dark-mode .info-text {
    color: #e0e0e0;
    background-color: transparent;
}

body.dark-mode .help-text,
body.dark-mode .description-text {
    color: #cccccc;
}

/* Correzione specifica per sezione Notifiche - aree bianche Email/Browser/SMS */
body.dark-mode .notifications-section .notification-item,
body.dark-mode .notification-toggle,
body.dark-mode .notification-option,
body.dark-mode .toggle-item,
body.dark-mode .notification-card .notification-item {
    background-color: var(--card-bg) !important;
    border: 1px solid #444444;
    color: var(--text-color);
}

body.dark-mode .notification-item span,
body.dark-mode .notification-item label,
body.dark-mode .toggle-item span,
body.dark-mode .toggle-item label {
    color: var(--text-color) !important;
}

body.dark-mode .switch .slider {
    background-color: var(--border-color);
}

body.dark-mode .switch input:checked + .slider {
    background-color: var(--primary-color);
}

body.dark-mode .language-selector,
body.dark-mode .form-control {
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

body.dark-mode .save-settings-btn,
body.dark-mode .primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

body.dark-mode .save-settings-btn:hover,
body.dark-mode .primary-btn:hover {
    background-color: var(--secondary-color);
}

/* Dark mode for form elements */
body.dark-mode label {
    color: var(--text-color);
}

body.dark-mode .input-group {
    background-color: transparent;
}

/* Dark mode scrollbars */
body.dark-mode ::-webkit-scrollbar {
    width: 8px;
}

body.dark-mode ::-webkit-scrollbar-track {
    background-color: var(--card-bg);
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background-color: var(--hover-bg);
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: white;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 90;
}

.sidebar-collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
    margin-left: -20px;
    opacity: 0;
}

.main-content {
    flex: 1;
    overflow-x: hidden;
    transition: all 0.3s ease;
}

.toggle-sidebar-btn {
    position: fixed;
    width: 32px;
    height: 32px;
    left: var(--sidebar-width);
    top: 120px;
    transform: translateX(-50%);
    z-index: 1000;
    overflow: visible;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.toggle-sidebar-btn i {
    font-size: 14px; /* Dimensione della freccia ulteriormente ridotta */
}

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

/* Quando la sidebar è collassata, sposta il pulsante al margine sinistro */
.sidebar-collapsed ~ .toggle-sidebar-btn,
.sidebar-collapsed-body .toggle-sidebar-btn {
    left: 0; /* Mostra solo metà del pulsante al bordo sinistro */
    transform: translateX(-50%);
}

body.dark-mode .toggle-sidebar-btn {
    background-color: #444;
}

body.dark-mode .toggle-sidebar-btn:hover {
    background-color: #555;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.logo h2 {
    font-size: 24px;
    font-weight: 600;
}

.logo i {
    font-size: 28px;
}

.menu {
    list-style: none;
    margin-top: 30px;
}

.menu li {
    margin: 5px 0;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 15px;
}

.menu li i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.menu li a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

body.dark-mode .sidebar .menu a {
    color: #ffffff;
}

body.dark-mode .sidebar .menu a:hover,
body.dark-mode .sidebar .menu li.active a {
    background: #3d3d3d;
}

.menu li:hover {
    background-color: #f0f0f0;
    color: var(--primary-color);
}

.menu li.active {
    background-color: var(--primary-color);
    color: white;
}

/* Stili per il footer della sidebar */
.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

.sidebar-footer a {
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-footer a:hover {
    background-color: #f0f0f0;
    color: var(--primary-color);
}

.sidebar-footer a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

body.dark-mode .sidebar-footer {
    border-top: 1px solid #3d3d3d;
}

body.dark-mode .sidebar-footer a:hover {
    background-color: #3d3d3d;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f5f6fa;
    position: relative;
}

header {
    position: sticky;
    top: 0;
    background-color: #f5f6fa;
    padding: 20px;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dashboard-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    height: calc(100vh - 80px); /* Account for header height */
}

/* Monitoring Container Styles */
.monitoring-container {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.monitoring-container h1 {
    margin-bottom: 20px;
}

.graphs-grid {
    flex: 1;
    display: grid;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

/* Layout per un singolo grafico */
.graphs-grid.single-graph {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

/* Layout per due grafici */
.graphs-grid.two-graphs {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 1fr;
}

/* Layout per tre o quattro grafici */
.graphs-grid.multi-graphs {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* Layout per sei grafici (griglia 3x2) */
.graphs-grid.six-graphs {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* Layout per sette grafici (3-3-1) */
.graphs-grid.seven-graphs {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

/* Stile specifico per la mappa nel layout a sette grafici */
.graphs-grid.seven-graphs .graph-card[data-type="map"] {
    grid-column: 1 / -1; /* Occupa tutte le colonne */
    grid-row: 3; /* Ultima riga */
}

/* Assicurati che tutti i grafici mantengano le proporzioni */
.graph-card {
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.graph-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
    border: 3px solid #2ecc71;
    transition: border-color 0.3s ease, transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    height: 100%;
    overflow: hidden;
}

body.dark-mode .graph-card {
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
}

.graph-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.graph-card.alert {
    border-color: #e74c3c;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

.chart-container {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

body.dark-mode .chart-container {
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
}

canvas {
    width: 100% !important;
    height: 100% !important;
}

.graph-card .chart-container #map {
    width: 100%;
    height: 100%;
    min-height: 200px;
    border-radius: 8px;
}

.graph-card:last-child .chart-container {
    min-height: 200px;
}

.graph-card h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

body.dark-mode .graph-card h3 {
    color: #ffffff;
}

/* Dashboard Container Styles */
.dashboard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px); /* Account for header height and padding */
}

.dashboard-container h1 {
    margin-bottom: 30px;
    color: var(--text-color);
    font-size: 24px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

body.dark-mode .card {
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
}

.card-icon {
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.card-info h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

body.dark-mode .card-info h3 {
    color: #ffffff;
}

.card-info p {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-color);
}

.widgets {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.widget {
    flex: 1;
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body.dark-mode .widget {
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
}

.widget h3 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 18px;
}

.activity-list {
    list-style: none;
}

.activity-list li {
    display: flex;
    align-items: start;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-list i {
    color: var(--primary-color);
    margin-top: 3px;
}

.activity-list p {
    margin-bottom: 5px;
}

.activity-list span {
    font-size: 12px;
    color: #666;
}

.todo-list {
    list-style: none;
}

.todo-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.todo-list li:last-child {
    border-bottom: none;
}

.todo-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.todo-list label {
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
}

/* Stili per le pagine di dettaglio */
.detail-page {
    padding: 20px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.detail-header h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
}

.current-value {
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

body.dark-mode .current-value {
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
}

.current-value .label {
    color: #666;
    font-weight: 500;
}

.current-value .value {
    font-size: 1.2em;
    font-weight: 600;
    color: #2ecc71;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.detail-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

body.dark-mode .detail-card {
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.chart-container {
    height: 300px;
    margin-top: 15px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

.stat-value {
    font-size: 1.1em;
    font-weight: 600;
    color: #2ecc71;
}

.alerts-container {
    max-height: 300px;
    overflow-y: auto;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: #fff3cd;
    color: #856404;
}

.alert.danger {
    background: #f8d7da;
    color: #721c24;
}

.alert .time {
    margin-left: auto;
    font-size: 0.8em;
    color: #666;
}

.notes-container {
    color: #666;
}

.notes-container ul {
    margin-top: 10px;
    padding-left: 20px;
}

.notes-container li {
    margin-bottom: 5px;
}

.map-container {
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
}

.poi-container {
    max-height: 300px;
    overflow-y: auto;
}

/* Stili per il pulsante indietro e selettore temporale */
.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-button {
    background: #f8f9fa;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #666;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: #e9ecef;
    color: #333;
}

.time-range-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.time-preset {
    background: #f8f9fa;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    color: #666;
    transition: all 0.2s ease;
}

.time-preset:hover,
.time-preset.active {
    background: #2ecc71;
    color: white;
}

.custom-range {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Modal per la selezione personalizzata */
.custom-range-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

body.dark-mode .custom-range-modal {
    background: rgba(0, 0, 0, 0.8);
}

.custom-range-modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.dark-mode .modal-content {
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
}

.date-time-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label {
    color: #666;
    font-size: 0.9em;
}

.input-group input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
}

body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode select {
    background: #3d3d3d;
    border: 1px solid #4d4d4d;
    color: #ffffff;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.cancel-btn {
    background: #f8f9fa;
    color: #666;
}

body.dark-mode .theme-btn {
    background: #3d3d3d;
    border: 1px solid #4d4d4d;
    color: #ffffff;
}

body.dark-mode .theme-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.apply-btn {
    background: #2ecc71;
    color: white;
}

.cancel-btn:hover {
    background: #e9ecef;
}

.apply-btn:hover {
    background: #27ae60;
}

/* ===============================
   RESPONSIVE DESIGN COMPLETE
   =============================== */

/* Mobile Menu Hamburger */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

body.dark-mode .mobile-menu-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ===============================
   DESKTOP LARGE (1200px+)
   =============================== */
@media (min-width: 1201px) {
    .graphs-grid.multi-graphs {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
    }
    
    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===============================
   DESKTOP MEDIUM (992px-1200px)
   =============================== */
@media (max-width: 1200px) and (min-width: 992px) {
    .graphs-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-container {
        padding: 15px;
    }
    
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===============================
   TABLET (768px-991px)
   =============================== */
@media (max-width: 991px) and (min-width: 768px) {
    :root {
        --sidebar-width: 250px;
    }
    
    .sidebar {
        width: var(--sidebar-width);
        padding: 15px;
    }
    
    .main-content {
        padding: 0 15px;
    }
    
    .dashboard-container,
    .monitoring-container {
        padding: 15px;
    }
    
    .cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .graphs-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .widgets {
        flex-direction: column;
        gap: 15px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .profile-image img {
        width: 120px;
        height: 120px;
    }
    
    /* Tabelle responsive su tablet */
    .admin-table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    th, td {
        padding: 8px 12px;
        font-size: 0.9em;
    }
}

/* ===============================
   MOBILE LARGE (576px-767px)
   =============================== */
@media (max-width: 767px) and (min-width: 576px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -var(--sidebar-width);
        height: 100vh;
        z-index: 1000;
        transition: transform 0.3s ease;
        width: 280px;
        box-shadow: 4px 0 8px rgba(0,0,0,0.3);
        padding: 20px;
    }
    
    .sidebar .menu a {
        padding: 13px 15px;
        font-size: 15px;
    }
    
    .sidebar .logo {
        max-width: 180px;
        margin-bottom: 20px;
    }
    
    .sidebar-footer a {
        padding: 13px 15px;
        font-size: 15px;
    }
    
    .sidebar.mobile-open {
        transform: translateX(var(--sidebar-width));
    }
    
    .main-content {
        margin-left: 0;
        padding-top: 70px; /* Spazio per menu hamburger */
    }
    
    .dashboard-container,
    .monitoring-container {
        padding: 15px 10px;
    }
    
    .cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .card {
        padding: 15px;
        gap: 15px;
    }
    
    .card-info h3 {
        font-size: 12px;
    }
    
    .card-info p {
        font-size: 20px;
    }
    
    .graphs-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 10px;
    }
    
    .graph-card {
        min-height: 250px;
        padding: 12px;
    }
    
    .widgets {
        flex-direction: column;
        gap: 12px;
    }
    
    .widget {
        padding: 15px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .settings-card {
        padding: 15px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-image img {
        width: 100px;
        height: 100px;
    }
    
    /* Form responsive */
    .input-group {
        margin-bottom: 15px;
    }
    
    input, select, textarea {
        font-size: 16px; /* Previene zoom su iOS */
        padding: 12px;
    }
    
    button, .btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px; /* Touch target */
    }
    
    /* Tabelle su mobile large */
    table {
        font-size: 0.8em;
    }
    
    th, td {
        padding: 6px 8px;
    }
    
    .admin-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Header responsive */
    header {
        padding: 10px 15px;
        margin-left: 0;
    }
    
    .dashboard-container h1 {
        font-size: 20px;
        margin-bottom: 20px;
    }
}

/* ===============================
   MOBILE SMALL (320px-575px)
   =============================== */
@media (max-width: 575px) {
    .mobile-menu-toggle {
        display: block;
        top: 15px;
        left: 15px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        height: 100vh;
        z-index: 1000;
        width: 85%;
        max-width: 320px;
        transition: transform 0.3s ease;
        box-shadow: 4px 0 8px rgba(0,0,0,0.3);
        padding: 20px;
    }
    
    .sidebar .menu a {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .sidebar .logo {
        max-width: 160px;
        margin-bottom: 25px;
    }
    
    .sidebar-footer a {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .sidebar.mobile-open {
        transform: translateX(100%);
    }
    
    .main-content {
        margin-left: 0;
        padding-top: 65px;
        padding-left: 0;
        padding-right: 0;
    }
    
    .dashboard-container,
    .monitoring-container {
        padding: 10px 8px;
    }
    
    .cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .card {
        padding: 12px;
        gap: 12px;
        flex-direction: column;
        text-align: center;
    }
    
    .card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        align-self: center;
    }
    
    .card-info h3 {
        font-size: 11px;
    }
    
    .card-info p {
        font-size: 18px;
    }
    
    .graphs-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 8px;
    }
    
    .graph-card {
        min-height: 200px;
        padding: 10px;
    }
    
    .graph-card h3 {
        font-size: 14px;
    }
    
    .widgets {
        flex-direction: column;
        gap: 10px;
    }
    
    .widget {
        padding: 12px;
    }
    
    .widget h3 {
        font-size: 16px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .settings-card {
        padding: 12px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .profile-image img {
        width: 80px;
        height: 80px;
    }
    
    /* Form ultra-responsive */
    input, select, textarea {
        font-size: 16px;
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    button, .btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 40px;
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Tabelle su mobile small - Stack layout */
    .admin-table-container {
        overflow: visible;
    }
    
    table, thead, tbody, th, td, tr {
        display: block;
    }
    
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 8px;
        background: white;
    }
    
    body.dark-mode tr {
        background: var(--card-bg);
        border-color: var(--border-color);
    }
    
    td {
        border: none;
        position: relative;
        padding: 8px 8px 8px 25% !important;
        text-align: left;
    }
    
    td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 20%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        color: var(--primary-color);
    }
    
    /* Header compatto */
    header {
        padding: 8px 12px;
        margin-left: 0;
    }
    
    .dashboard-container h1 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    /* Sidebar logo e menu compatti */
    .logo h2 {
        font-size: 20px;
    }
    
    .menu li a {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .menu li i {
        font-size: 14px;
    }
}

/* Stili per la pagina delle impostazioni */
.settings-page {
    padding: 20px;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.settings-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

body.dark-mode .settings-card {
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
}

.settings-card h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2em;
}

body.dark-mode .settings-card h2 {
    color: #ffffff;
}

.profile-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-header {
    display: flex;
    gap: 30px;
}

.profile-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.profile-image img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
}

.change-photo-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
}

.profile-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-help {
    display: block;
    color: #666;
    font-size: 0.8em;
    margin-top: 4px;
}

body.dark-mode .input-help {
    color: #999;
}

.security-section,
.notifications-section,
.preferences-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.notification-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

body.dark-mode .notification-option {
    background: #3d3d3d;
}

.notification-text {
    flex: 1;
}

.notification-text h3 {
    margin: 0;
    font-size: 1em;
    color: #333;
}

body.dark-mode .notification-text h3 {
    color: #ffffff;
}

.notification-text p {
    margin: 5px 0 0;
    font-size: 0.9em;
    color: #666;
}

body.dark-mode .notification-text p {
    color: #b3b3b3;
}

/* Stili per Notifiche Dropdown Migliorate */
.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--notification-border);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.notification-item:hover {
    background-color: var(--notification-hover);
    transform: translateX(2px);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-message {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.notification-time {
    font-size: 12px;
    color: #6c757d;
    font-weight: 400;
}

.notification-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    padding-left: 8px;
}

.unread-indicator {
    color: var(--unread-indicator);
    font-size: 6px;
    opacity: 0.8;
}

.notification-read .unread-indicator {
    display: none;
}

.notification-read {
    opacity: 0.7;
}

.notification-read .notification-message {
    font-weight: 400;
    color: #6c757d;
}

/* Dark theme per notifiche */
body.dark-mode .notification-item {
    border-bottom-color: #3d3d3d;
}

body.dark-mode .notification-item:hover {
    background-color: #2d2d2d;
}

body.dark-mode .notification-message {
    color: #ffffff;
}

body.dark-mode .notification-time {
    color: #b3b3b3;
}

body.dark-mode .notification-read .notification-message {
    color: #999999;
}

/* Miglioramenti icone attività */
.activity-icon {
    margin-right: 12px;
    flex-shrink: 0;
}

.activity-details {
    flex-grow: 1;
    min-width: 0;
}

/* Switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.theme-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-options {
    display: flex;
    gap: 10px;
}

.theme-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.theme-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.settings-actions {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
}

.save-settings-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
    transition: background 0.2s ease;
}

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

.update-password-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    margin-top: 10px;
}

/* Stili per la pagina nuova spedizione */
.shipment-page {
    padding: 20px;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

.shipment-form {
    max-width: 1200px;
    margin: 0 auto;
}

.form-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.form-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.parameters-info {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.parameter-card {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

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

.parameter-type {
    flex: 1;
    margin-right: 15px;
}

.remove-parameter {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 5px;
    font-size: 1.2em;
}

.parameter-thresholds {
    display: flex;
    gap: 20px;
}

.threshold-group {
    flex: 1;
}

.threshold-group label {
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.add-parameter-btn {
    background: none;
    border: 2px dashed #ddd;
    color: #666;
    padding: 15px;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1em;
    margin-top: 15px;
}

.add-parameter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

.cancel-btn,
.save-btn {
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
    border: none;
}

.cancel-btn {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

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

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

.destination-wrapper {
    position: relative;
}

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
}

.suggestion-item:hover {
    background: #f0f0f0;
}

/* Dark theme support */
body.dark-mode .form-section {
    background: #2d2d2d;
    border: 1px solid #3d3d3d;
}

body.dark-mode .form-section h2 {
    color: #ffffff;
}

body.dark-mode .form-group label {
    color: #b3b3b3;
}

body.dark-mode .form-group select,
body.dark-mode .form-group input[type="text"],
body.dark-mode .form-group input[type="number"] {
    background: #3d3d3d;
    border-color: #4d4d4d;
    color: #ffffff;
}

body.dark-mode .parameter-card {
    background: #3d3d3d;
    border-color: #4d4d4d;
}

body.dark-mode .suggestions-list {
    background: #2d2d2d;
    border-color: #3d3d3d;
}

body.dark-mode .suggestion-item:hover {
    background: #3d3d3d;
}

body.dark-mode .add-parameter-btn {
    border-color: #4d4d4d;
    color: #b3b3b3;
}

body.dark-mode .cancel-btn {
    background: #3d3d3d;
    border-color: #4d4d4d;
    color: #b3b3b3;
}

/* Monitoring Container Styles */
.monitoring-container {
    padding: 20px;
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

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

.monitoring-header .page-title {
    margin: 0;
    font-size: 1.8em;
    color: #333;
}

/* Aggiunge spazio a sinistra per il titolo quando la sidebar è collassata */
.sidebar-collapsed ~ .main-content .page-title,
.sidebar-collapsed-body .main-content .page-title {
    padding-left: 30px; /* Spazio per evitare sovrapposizione con la freccia */
    transition: padding-left 0.3s ease; /* Transizione fluida */
}

.graph-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.graph-selector {
    display: flex;
    gap: 10px;
}

.graph-selector select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    min-width: 200px;
}

.btn-primary {
    padding: 8px 16px;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #27ae60;
}

.graphs-grid {
    flex: 1;
    display: grid;
    gap: 20px;
    margin-top: 20px;
    overflow: hidden;
    height: calc(100vh - 200px);
}

/* Griglia dinamica basata sul numero di grafici */
.graphs-grid.items-1 { grid-template-columns: 1fr; }
.graphs-grid.items-2 { grid-template-columns: repeat(2, 1fr); }
.graphs-grid.items-3 { grid-template-columns: repeat(3, 1fr); }
.graphs-grid.items-4 { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.graphs-grid.items-5, .graphs-grid.items-6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.graphs-grid.items-7 { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); }

.graph-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    border: 3px solid #2ecc71;
    transition: all 0.3s ease;
    min-height: 300px;
}

.graph-card[data-type="map"] {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.graph-card[data-type="map"] .chart-container {
    flex: 1;
    position: relative;
    min-height: 300px;
}

.graph-card[data-type="map"] #map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* Stili per il marker del veicolo e l'animazione della linea */
.vehicle-marker i {
    transition: transform 0.5s ease;
}

.animated-line {
    stroke-dasharray: 8, 8;
    animation: dash 20s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -100;
    }
}

.graph-card.alert {
    border-color: #e74c3c;
    animation: pulse-border 1.5s infinite;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
}

@keyframes pulse-border {
    0% {
        border-color: #e74c3c;
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
    }
    50% {
        border-color: #ff0000;
        box-shadow: 0 0 25px rgba(255, 0, 0, 0.7);
    }
    100% {
        border-color: #e74c3c;
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
    }
}

.graph-card .remove-graph {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
}

/* Activity Cards Styles */
.activity-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.activity-card.in-progress {
    background-color: #FFF3E0;
    color: #796565;
}

.activity-card.completed {
    background-color: #98E2A1;
    color: #000;
}

.activity-card.pending {
    background-color: #3498db;
    color: #000;
}

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

.activity-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.shipment-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.shipment-id {
    grid-column: 1;
    font-size: 1.25em;
    font-weight: 600;
    color: #000;
    letter-spacing: -0.5px;
}

.created-at {
    grid-column: 2;
    text-align: center;
    justify-self: center;
    color: #000;
    font-size: 0.9em;
    font-weight: 500;
    opacity: 0.7;
}

.status {
    grid-column: 3;
    justify-self: end;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status.in-progress {
    background-color: #FFB74D;
    color: #000;
}

.status.completed {
    background-color: #B8E986;
    color: #000;
}

.status.pending {
    background-color: #90CAF9;
    color: #000;
}

.parameters {
    display: flex;
    justify-content: flex-end;
    gap: 25px;
    padding-top: 15px;
}

.parameter {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.parameter i {
    font-size: 18px;
    color: #666;
    z-index: 1;
}

.parameter.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.2);
    animation: pulse 2s infinite;
}

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

/* Monitoring Cards Container Styles */
.monitoring-cards {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 300px); /* Altezza fissa per il contenitore */
    overflow-y: auto;
}

.monitoring-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-bottom: 20px;
}

.activity-cards-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px; /* Spazio per la scrollbar */
    margin-top: 20px;
}

/* Stile della scrollbar */
.activity-cards-container::-webkit-scrollbar {
    width: 8px;
}

.activity-cards-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.activity-cards-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.activity-cards-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.monitoring-wrapper {
    overflow-x: hidden;
}

.activity-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    border: 1px solid #eee;
}

.activity-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.activity-header h4 {
    margin: 0;
    font-size: 1.1em;
    color: #333;
}

.activity-header span {
    font-size: 0.9em;
    color: #666;
}

.status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
}

.status.in-progress {
    background-color: #fff3cd;
    color: #856404;
}

.status.pending {
    background-color: #cce5ff;
    color: #004085;
}

.status.completed {
    background-color: #d4edda;
    color: #155724;
}

.sensor-icons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.sensor-icons i {
    font-size: 1.2em;
    color: #28a745;
    transition: color 0.3s;
}

.sensor-icons i.alert {
    color: #dc3545;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* Monitoring Cards Styles */
.monitoring-cards {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 280px); /* Account for header, widgets, and margins */
    overflow-y: auto;
}

.monitoring-cards::-webkit-scrollbar {
    width: 6px;
}

.monitoring-cards::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.monitoring-cards::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.monitoring-cards h3 {
    position: sticky;
    top: 0;
    background: white;
    margin-bottom: 20px;
}

/* Stili per il tracking GPS */
.vehicle-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
}

.vehicle-marker i {
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.direction-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
}

.direction-arrow i {
    color: #27ae60;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.2));
    font-size: 12px;
    transition: transform 0.3s ease;
}

/* Stile per i percorsi storici */
.historical-route {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.historical-route:hover {
    opacity: 0.8;
}

.sidebar-collapsed + .main-content {
    margin-left: 0;
}


