:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --bg-color: #f4f6f9;
    --text-color: #333;
    --card-bg: #fff;
    --sidebar-width: 250px;
    --danger: #e74c3c;
    --success: #2ecc71;
    --border-color: #ddd;
}

[data-theme="dark"] {
    --primary-color: #1a1a1a;
    --secondary-color: #2d2d2d;
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --accent-color: #3498db;
    --border-color: #444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(--bg-color); color: var(--text-color); transition: 0.3s; }

/* Correção específica para a coluna do nome e textos em negrito no Dark Mode */
[data-theme="dark"] table.dataTable tbody tr td,
[data-theme="dark"] table.dataTable tbody tr td b,
[data-theme="dark"] table.dataTable tbody tr td strong,
[data-theme="dark"] .card-viatura h3,
[data-theme="dark"] .info-group p {
    color: var(--text-color) !important;
}
/* Login */
.login-body { display: flex; justify-content: center; align-items: center; height: 100vh; background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); }
.login-container { background: white; padding: 2rem; border-radius: 10px; width: 100%; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); text-align: center; }
.login-header i { color: #1e3c72; margin-bottom: 1rem; }
.form-group { margin-bottom: 1.5rem; text-align: left; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: #333; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; }
.btn-login { width: 100%; padding: 12px; background: #1e3c72; color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 1rem; transition: 0.2s; }
.btn-login:hover { background: #2a5298; }

/* Layout */
.app-container { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--primary-color); color: white; display: flex; flex-direction: column; position: fixed; height: 100%; transition: 0.3s; z-index: 100; }
.brand { padding: 20px; font-size: 1.2rem; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,0.1); }
.brand span { color: var(--accent-color); }
.sidebar ul { list-style: none; margin-top: 20px; flex: 1; }
.sidebar ul li a { display: block; padding: 15px 20px; color: #bdc3c7; text-decoration: none; transition: 0.2s; }
.sidebar ul li.active a, .sidebar ul li a:hover { background: var(--secondary-color); color: white; border-left: 4px solid var(--accent-color); }
.sidebar li.disabled a { opacity: 0.5; cursor: not-allowed; }
.user-info { padding: 20px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; align-items: center; }
.theme-toggle { text-align: center; padding: 10px; }
.theme-toggle button { background: none; border: none; color: white; cursor: pointer; font-size: 1.2rem; }

.content { margin-left: var(--sidebar-width); flex: 1; padding: 30px; width: calc(100% - var(--sidebar-width)); }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.date-display { font-weight: bold; color: var(--accent-color); }

/* Dashboard Cards */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.card { background: var(--card-bg); border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); overflow: hidden; margin-bottom: 20px; border: 1px solid var(--border-color); }
.card-stat { display: flex; align-items: center; padding: 20px; }
.stat-icon { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.5rem; margin-right: 20px; }
.bg-blue { background: #3498db; }
.bg-green { background: #2ecc71; }
.bg-orange { background: #f39c12; }
.stat-info h3 { font-size: 1.8rem; margin-bottom: 5px; }
.stat-info p { color: #7f8c8d; font-size: 0.9rem; }

/* DataTables Dark Mode Fix */
.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter, 
.dataTables_wrapper .dataTables_info, 
.dataTables_wrapper .dataTables_processing, 
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-color) !important;
}

table.dataTable {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-collapse: collapse !important;
}

table.dataTable thead th {
    background-color: var(--secondary-color) !important;
    color: white !important;
    border-bottom: 1px solid var(--border-color) !important;
}

table.dataTable tbody tr {
    background-color: var(--card-bg) !important;
}

table.dataTable tbody td {
    border-bottom: 1px solid var(--border-color) !important;
}

.dataTables_wrapper .dataTables_filter input {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px;
    padding: 5px;
}

/* Modals */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-content { background-color: var(--card-bg); margin: 5% auto; padding: 25px; border-radius: 8px; width: 90%; max-width: 700px; position: relative; color: var(--text-color); box-shadow: 0 5px 30px rgba(0,0,0,0.5); }
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 28px; cursor: pointer; color: #888; transition: 0.2s; }
.close-modal:hover { color: var(--danger); }
.modal-header-custom { border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-bottom: 15px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.info-group label { display: block; font-size: 0.8rem; color: #7f8c8d; text-transform: uppercase; margin-bottom: 3px; }
.info-group p { font-weight: 500; font-size: 1rem; }
.text-large { font-size: 1.2rem !important; font-weight: bold; }
.text-danger { color: var(--danger) !important; }
.alert-box { background: rgba(231, 76, 60, 0.1); color: var(--danger); padding: 10px; border-radius: 5px; font-size: 0.9rem; border: 1px solid var(--danger); }
.full-width { grid-column: 1 / -1; }

/* Estilos para Viaturas */
.grid-viaturas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card-viatura {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s;
    border: 1px solid var(--border-color);
}

.card-viatura:hover {
    transform: translateY(-5px);
}

.viatura-header {
    background: var(--secondary-color);
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.viatura-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.matricula {
    background: white;
    color: black;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-family: monospace;
    border: 1px solid #ccc;
    display: inline-block;
    margin-top: 5px;
}

.viatura-body {
    padding: 15px;
}

.viatura-body p {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 15px;
}

.full-width {
    width: 100%;
    display: block;
}

.modal-grid select, .modal-grid input, .modal-grid textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.btn-action { padding: 8px 15px; border: none; border-radius: 4px; cursor: pointer; color: white; transition: 0.2s; font-weight: 600; text-decoration: none; display: inline-block; text-align: center; }
.btn-view { background: var(--accent-color); }
.btn-view:hover { opacity: 0.9; }
.badge { padding: 4px 10px; background: var(--secondary-color); border-radius: 12px; font-size: 0.75rem; color: white; }

hr { border: 0; border-top: 1px solid var(--border-color); margin: 15px 0; }