:root {
    --primary: #797a7a;
    --primary-hover: #8d8d8d;
    --secondary: #6e6e6e;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #999a9b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --gradient-blue: linear-gradient(135deg, #a3a3a3, #878888);
    --gradient-green: linear-gradient(135deg, #10b981, #059669);
    --gradient-purple: linear-gradient(135deg, #8b5cf6, #7c3aed);
    --gradient-red: linear-gradient(135deg, #ef4444, #dc2626);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 0.125rem;
    --radius: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;
    --transition: all 0.2s ease-in-out;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: var(--gray-100);
    color: var(--gray-800);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2c3e50, #1a202c);
    padding: 1.5rem;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    padding: 2rem;
    text-align: center;
    background-color: var(--gray-100);
}

.logo-container {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 70px;
    height: 70px;
    background: var(--gradient-blue);
    border-radius: var(--radius-full);
    margin-bottom: 1rem;
    color: white;
    box-shadow: var(--shadow-md);
}

.logo-container i {
    font-size: 2rem;
}

.login-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
}

.login-header h1 span {
    color: var(--primary);
}

.login-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.input-icon input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.input-icon input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-icon input::placeholder {
    color: var(--gray-400);
}

.btn-primary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.login-footer {
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-500);
    font-size: 0.875rem;
}

.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
}

.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background-color: white;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    z-index: 10;
    transition: var(--transition);
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.logo {
    display: flex;
    align-items: center;
}

.logo i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-right: 0.75rem;
}

.logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.logo h2 span {
    color: var(--primary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--gray-100);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: var(--gray-200);
}

.admin-profile {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.avatar {
    width: 42px;
    height: 42px;
    background-color: var(--gray-200);
    color: var(--gray-600);
    border-radius: var(--radius-full);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 0.75rem;
}

.avatar i {
    font-size: 1.125rem;
}

.admin-info {
    flex: 1;
    min-width: 0;
}

.admin-info h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    background-color: var(--gray-100);
    color: var(--gray-600);
}

.menu {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.menu li {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.menu li i {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    transition: var(--transition);
}

.menu li:hover {
    background-color: var(--gray-100);
    color: var(--gray-800);
}

.menu li.active {
    color: var(--primary);
    background-color: rgba(79, 70, 229, 0.1);
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: 260px;
    transition: var(--transition);
}

.main-content.expanded {
    margin-left: 80px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background-color: white;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--gray-200);
}

.top-bar h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.search-bar {
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.search-bar input {
    width: 280px;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    background-color: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.online {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.offline {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: block;
}

.status-badge.online::before {
    background-color: var(--success);
}

.status-badge.offline::before {
    background-color: var(--danger);
}

/* Page Content */
.page-content {
    padding: 1.5rem;
    display: none;
}

.page-content.active {
    display: block;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    display: flex;
    align-items: center;
    background-color: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.gradient-blue {
    border-left: 4px solid var(--info);
}

.gradient-green {
    border-left: 4px solid var(--success);
}

.gradient-purple {
    border-left: 4px solid var(--secondary);
}

.gradient-red {
    border-left: 4px solid var(--danger);
}

.stat-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-xl);
    margin-right: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.gradient-blue .stat-icon {
    background: var(--gradient-blue);
}

.gradient-green .stat-icon {
    background: var(--gradient-green);
}

.gradient-purple .stat-icon {
    background: var(--gradient-purple);
}

.gradient-red .stat-icon {
    background: var(--gradient-red);
}

.stat-icon i {
    font-size: 1.5rem;
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-info h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.stat-change {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.vehicle-actions {
    white-space: nowrap; /* Impedisce ai bottoni di andare a capo */
}

.vehicle-actions button {
    display: inline-block;
    margin-right: 10px; /* Spazio tra i bottoni */
}

.delete-vehicle:hover {
    color: red;
}

.page-content {
    display: none;  /* Nascondi tutti i contenuti di default */
    width: 100%;
    padding: 20px;
}

.page-content.active {
    display: block;  /* Mostra solo il contenuto attivo */
}

/* Assicura che i contenuti occupino l'intera larghezza disponibile */
#vehiclesContent {
    width: 100%;
}

/* Stile per la tabella dei veicoli per assicurare che sia responsive */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

/* Content Card */
.content-card {
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-outline i {
    font-size: 0.875rem;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: var(--gray-50);
    color: var(--gray-600);
    font-weight: 500;
    text-align: left;
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.875rem;
    color: var(--gray-700);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: var(--gray-50);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 100;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.modal-content {
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background-color: var(--gray-100);
    border-radius: var(--radius-full);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}

.btn-close:hover {
    background-color: var(--gray-200);
}

.modal-tabs {
    display: flex;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.tab-btn {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    background-color: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--gray-900);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.modal-body {
    padding: 1.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control:read-only {
    background-color: var(--gray-100);
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tab-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

/* Vehicles Grid */
.vehicles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.vehicle-card {
    background-color: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 1rem;
    position: relative;
}

.vehicle-model {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.vehicle-plate {
    display: inline-block;
    background-color: var(--gray-200);
    color: var(--gray-700);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.vehicle-details {
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* Danger Zone */
.danger-zone {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-lg);
}

.danger-zone h3 {
    color: var(--danger);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.danger-zone p {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.btn-danger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: white;
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
}

/* Confirm Dialog */
.confirm-dialog {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    background-color: white;
    border-radius: var(--radius-lg);
    text-align: center;
}

.confirm-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.confirm-icon i {
    font-size: 3rem;
    color: var(--warning);
}

.confirm-dialog h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
}

.confirm-dialog p {
    color: var(--gray-600);
    margin-bottom: 2rem;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--gray-800);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

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

.toast.error {
    background-color: var(--danger);
}

.toast.warning {
    background-color: var(--warning);
}

/* Loading Spinner */
.loading-container {
    position: fixed;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.loading-container.show {
    visibility: visible;
    opacity: 1;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

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

/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.expanded {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .search-bar input {
        width: 200px;
    }
    
    .modal-content {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.capitalize {
    text-transform: capitalize;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.border-t {
    border-top: 1px solid var(--gray-200);
}

.border-b {
    border-bottom: 1px solid var(--gray-200);
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}