:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #7209b7;
    --success: #4cc9f0;
    --warning: #f72585;
    --danger: #e63946;
    --dark: #1e1e2e;
    --light: #f8f9fa;
    --gray: #6c757d;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 70px;
    --border-radius: 12px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

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

body {
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
    color: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Fondo animado */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.1);
    animation: float 15s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-20px) translateX(10px) rotate(180deg);
        opacity: 0.3;
    }
    100% {
        transform: translateY(0) translateX(0) rotate(360deg);
        opacity: 0.7;
    }
}

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

/* Sidebar moderno */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    position: fixed;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

/* Estilos para móviles */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
    
    .overlay.active {
        display: block;
    }
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-header h1 {
    display: none;
}

.logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 18px;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-section {
    padding: 10px 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: var(--transition);
    color: rgba(255, 255, 255, 0.7);
    position: relative;
    overflow: hidden;
}

.menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary);
    transform: scaleY(0);
    transition: var(--transition);
}

.menu-item:hover {
    background: rgba(67, 97, 238, 0.1);
    color: white;
}

.menu-item.active {
    background: rgba(67, 97, 238, 0.15);
    color: white;
}

.menu-item.active::before {
    transform: scaleY(1);
}

.menu-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar.collapsed .menu-item span {
    display: none;
}

.sidebar.collapsed .menu-section {
    display: none;
}

/* Contenido principal */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* Header superior */
.top-header {
    height: var(--header-height);
    background: rgba(30, 30, 46, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 98;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
    z-index: 101;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 50px;
    transition: var(--transition);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

/* Área de contenido */
.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.module-content {
    display: none;
}

.module-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-title {
    font-size: 2rem;
    margin-bottom: 30px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Tarjetas modernas */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.card {
    background: rgba(30, 30, 46, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--success));
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.card-title {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.icon-primary {
    background: rgba(67, 97, 238, 0.15);
    color: var(--primary);
}

.icon-success {
    background: rgba(76, 201, 240, 0.15);
    color: var(--success);
}

.icon-warning {
    background: rgba(247, 37, 133, 0.15);
    color: var(--warning);
}

.icon-danger {
    background: rgba(230, 57, 70, 0.15);
    color: var(--danger);
}

.card-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.card-footer {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Tablas modernas */
table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(30, 30, 46, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

thead {
    background: rgba(67, 97, 238, 0.1);
}

th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(67, 97, 238, 0.05);
}

/* Pestañas modernas */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.tab {
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    position: relative;
}

.tab:hover {
    background: rgba(67, 97, 238, 0.1);
    color: white;
}

.tab.active {
    background: rgba(67, 97, 238, 0.15);
    color: white;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

/* Formularios modernos */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(30, 30, 46, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

/* Botones modernos */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #3aa8d4);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d41c6f);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #c1121f);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* Estados y badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-active, .status-vigente {
    background: rgba(76, 201, 240, 0.15);
    color: var(--success);
}

.status-pending, .status-pendiente {
    background: rgba(247, 37, 133, 0.15);
    color: var(--warning);
}

.status-finalizado {
    background: rgba(108, 117, 125, 0.15);
    color: var(--gray);
}

.status-overdue {
    background: rgba(230, 57, 70, 0.15);
    color: var(--danger);
}

.status-paid, .status-pagado {
    background: rgba(76, 201, 240, 0.15);
    color: var(--success);
}

.status-atrasado {
     background: rgba(230, 57, 70, 0.15);
    color: var(--danger);
}

.status-canceled {
    background: rgba(108, 117, 125, 0.15);
    color: var(--gray);
}

/* Alertas modernas */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-warning {
    background: rgba(247, 37, 133, 0.1);
    border-color: var(--warning);
    color: rgba(255, 255, 255, 0.9);
}

.alert-success {
    background: rgba(76, 201, 240, 0.1);
    border-color: var(--success);
    color: rgba(255, 255, 255, 0.9);
}

.alert-danger {
    background: rgba(230, 57, 70, 0.1);
    border-color: var(--danger);
    color: rgba(255, 255, 255, 0.9);
}

/* Subida de archivos */
.file-upload {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 20px;
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.05);
}

.file-upload i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

/* Vista previa de fotos */
.photo-preview {
    max-width: 200px;
    border-radius: 8px;
    margin-top: 10px;
}

/* Firma digital */
.signature-pad {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    background: rgba(30, 30, 46, 0.7);
    margin-bottom: 20px;
    position: relative;
    min-height: 200px;
}

.signature-clear {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.signature-canvas {
     border: 1px solid rgba(255, 255, 255, 0.1);
     border-radius: 4px;
     background: white;
     cursor: crosshair;
}

/* Lista de documentos */
.document-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(30, 30, 46, 0.5);
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.document-actions {
    display: flex;
    gap: 8px;
}

/* Grid de fotos */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.photo-item {
    text-align: center;
}

.photo-preview-container {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
}

/* Alertas de vencimiento */
.expiration-warning {
    color: var(--warning);
    font-weight: 600;
}

.alert-badge {
    background: var(--warning);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-right: 5px;
}

/* Mapa placeholder */
.map-placeholder {
    height: 300px;
    background: rgba(30, 30, 46, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

/* Historial de mantenimiento */
.maintenance-item {
    background: rgba(30, 30, 46, 0.5);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
}

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

/* Información GPS */
.gps-info p {
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(30, 30, 46, 0.5);
    border-radius: 6px;
}

/* Estilos de Contratos */
.contract-terms {
    background: rgba(30, 30, 46, 0.5);
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.contract-terms h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

.contract-terms p, .contract-terms ul {
    margin-bottom: 10px;
    line-height: 1.6;
}

.contract-terms ul {
    margin-left: 20px;
}

.contract-preview {
    background: white;
    color: #333;
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.contract-preview-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.contract-preview-details, .contract-preview-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.contract-preview-signatures {
    margin-top: 50px;
}

.signature-box {
    text-align: center;
    border-top: 1px solid #333;
    padding-top: 20px;
}

.renewal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(30, 30, 46, 0.5);
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary);
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.workshops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}


/* Responsive */
@media (max-width: 768px) {
    .content-area {
        padding: 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .document-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .document-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .photos-grid, .workshops-grid {
        grid-template-columns: 1fr;
    }

    .contract-preview-details,
    .contract-preview-signatures {
        grid-template-columns: 1fr;
    }
}


/* ============================================= */
/* === CORRECCIÓN PARA TABLAS DINÁMICAS === */
/* ============================================= */

#driversTable td {
    color: #f8f9fa !important; /* Fuerza el color del texto a ser claro */
}

/* ============================================= */
/* ESTILOS PARA EL MÓDULO DE USUARIOS (usuarios.js) */
/* ============================================= */

#usersTable {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    margin-top: 1.5rem;
}

#usersTable th {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #555;
    border-bottom: 2px solid #dee2e6;
}

#usersTable td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

#usersTable tr:last-child td {
    border-bottom: none;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.user-avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.role-badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 10px;
    color: #fff;
}

.role-admin {
    background-color: #e63946; /* Rojo */
}

.role-visitor {
    background-color: #6c757d; /* Gris */
}

/* * --------------------------------
 * AQUÍ ESTÁ EL CSS DEL SELECT
 * --------------------------------
 */
.role-select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9rem;
    background-color: #fff;
}

.role-select:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Pestaña Mi Perfil */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.user-avatar.large {
    width: 100px;
    height: 100px;
    font-size: 2.5rem;
    border-radius: 50%;
    background-color: #0d1a26;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 10px;
}

