:root {
    --primary-color: #2563eb;
    --secondary-color: #1e293b;
    --accent-color: #3b82f6;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-width: 250px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-color);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    flex-shrink: 0;
}

#sidebar .brand {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-color);
}

#sidebar nav ul {
    list-style: none;
}

#sidebar nav li {
    margin-bottom: 0.5rem;
}

#sidebar nav a {
    color: #94a3b8;
    text-decoration: none;
    padding: 0.75rem 1rem;
    display: block;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

#sidebar nav a:hover,
#sidebar nav a.active {
    background-color: #334155;
    color: white;
}

/* Main Content */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.page-header {
    background-color: var(--card-bg);
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-wrapper {
    flex: 1;
    overflow: auto;
    padding: 2rem;
    position: relative;
}

/* View Specific: Dashboard */
.dashboard-container {
    display: flex;
    height: 100%;
    /* Fill content-wrapper */
}

.vehicle-list {
    width: 300px;
    background: var(--card-bg);
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    flex-shrink: 0;
}

.vehicle-item {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.1s;
}

.vehicle-item:hover {
    background-color: #f8fafc;
}

.vehicle-item.active {
    background-color: #eff6ff;
    border-left: 4px solid var(--primary-color);
}

.vehicle-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.vehicle-status {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

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

.status-stopped {
    background-color: var(--danger);
}

#map {
    flex: 1;
    height: 100%;
    z-index: 1;
}

/* Common Components */
.card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: filter 0.2s;
}

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

.btn-primary:hover {
    filter: brightness(110%);
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
}

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

.data-table th,
.data-table td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.data-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
}

/* Documents Traffic Light */
.doc-status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.doc-ok {
    background-color: #dcfce7;
    color: #166534;
}

.doc-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.doc-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Grid Layout for History */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-view {
    background-color: white;
    border: 1px solid #cbd5e1;
    color: var(--text-muted);
}

.btn-view:hover {
    background-color: #f1f5f9;
}

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

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

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Alerts Layout */
.alerts-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.alerts-layout .card {
    margin-bottom: 0;
}

.alerts-layout>div:first-child {
    flex: 1;
    /* Form logic (approx 30-40%) */
}

.alerts-layout>div:last-child {
    flex: 2;
    /* Table logic (remaining space) */
}

@media (max-width: 900px) {
    .alerts-layout {
        flex-direction: column;
    }

    .alerts-layout>div {
        width: 100%;
    }
}

/* Badges */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-danger {
    background-color: #fee2e2;
    color: #ef4444;
}

.badge-warning {
    background-color: #fef3c7;
    color: #f59e0b;
}

.badge-primary {
    background-color: #dbeafe;
    color: #3b82f6;
}

.badge-normal {
    background-color: #f1f5f9;
    color: #64748b;
}