/* ========================================================
   ADTPersonal - Hoja de Estilos Maestra (Global)
   ======================================================== */

/* --- 1. BASE Y TIPOGRAFÍA --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #f4f6f9;
    color: #333;
}

/* --- 2. BARRA DE NAVEGACIÓN (NAVBAR) --- */
.navbar {
    background-color: #1a4a76;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.navbar h1 {
    margin: 0;
    font-size: 20px;
    letter-spacing: 1px;
}

.navbar a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 15px;
    border: 1px solid white;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.navbar a:hover {
    background-color: white;
    color: #1a4a76;
}

/* --- 3. CONTENEDORES PRINCIPALES --- */
.container {
    padding: 30px;
    max-width: 1200px; /* Por defecto ancho completo */
    margin: 0 auto;
}
.container-md { max-width: 1000px; } /* Para Fichas de lectura */
.container-sm { max-width: 800px; }  /* Para Formularios simples */

.container-fluid {
    padding: 30px;
    max-width: 98%;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* --- 4. TARJETAS Y PANELES --- */
.card, .card-panel {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 25px;
    margin-bottom: 25px;
}

.card-title, .section-title {
    color: #1a4a76;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
}

/* --- 5. CABECERAS DE PÁGINA --- */
.header-actions, .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-title {
    margin: 0;
    color: #333;
    font-size: 24px;
}

/* --- 6. BOTONES GLOBALES --- */
.btn, .btn-primary, .btn-volver, .btn-submit, .btn-save, .btn-editar, .btn-edit, .btn-exportar {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s, opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
}

/* Botones Secundarios (Grises) */
.btn-cancel, .btn-volver { background-color: #6c757d; color: white; margin: 0; }
.btn-cancel:hover, .btn-volver:hover { background-color: #5a6268; }

/* Botón Guardar en la cabecera (Sin margen, se alinea perfecto con Cancelar) */
.btn-save { background-color: #28a745; color: white; width: auto; margin: 0; }
.btn-save:hover { background-color: #218838; }

/* Botón Submit al final de los formularios (Ancho completo y separado) */
.btn-submit { background-color: #28a745; color: white; width: 100%; margin-top: 15px; }
.btn-submit:hover { background-color: #218838; }

/* Botones de Edición (Amarillos - Cubre ambas variantes) */
.btn-edit, .btn-editar { background-color: #ffc107; color: #212529; margin: 0; }
.btn-edit:hover, .btn-editar:hover { background-color: #e0a800; }

/* Botón Exportar Reportes (Verde) */
.btn-exportar { background-color: #28a745; color: white; margin: 0; }
.btn-exportar:hover { background-color: #218838; }

.btn-mapa { background-color: #28a745; color: white; }
.btn-mapa:hover { background-color: #218838; }

/* Botones pequeños de las tablas */
.btn-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    text-decoration: none;
    border: none;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-icon:hover { opacity: 0.85; transform: scale(1.05); }

/* --- 7. FORMULARIOS --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.full-width { grid-column: span 2; }

label {
    font-size: 13px;
    font-weight: bold;
    color: #495057;
    margin-bottom: 5px;
}

input, select, textarea {
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}
input:focus, select:focus, textarea:focus {
    border-color: #1a4a76;
    outline: none;
}
input[readonly] { background-color: #e9ecef; cursor: not-allowed; }

/* --- 8. TABLAS --- */
.table-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 20px;
    overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 15px; border-bottom: 1px solid #e9ecef; font-size: 14px; }
th { background-color: #f8f9fa; color: #495057; font-weight: 600; text-transform: uppercase; font-size: 13px; }
tr:hover { background-color: #f1f3f5; }

/* --- Estilos para Configuración de Columnas (ColVis) --- */
.top {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap; 
    gap: 15px;
}

/* Alineación: Selector y Botones a la izquierda, Buscador a la derecha */
.dataTables_length { margin-right: 5px; } /* Le da un pequeño respiro antes del botón */
.dt-buttons { margin-right: auto; } /* Esto empuja al buscador hacia la derecha */
.dataTables_filter { margin-left: 0; }

.dt-button.buttons-columnVisibility {
    background-color: #f8f9fa !important; 
    border: 1px solid #dee2e6 !important;
    color: #333 !important;
}
.dt-button.buttons-columnVisibility.active {
    background-color: #0d6efd !important; 
    color: white !important;
}
.btn-colvis-trigger {
    background-color: #0d6efd !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 5px 15px !important;
}

/* --- 9. ETIQUETAS (BADGES) --- */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    display: inline-block;
    text-align: center;
}
.badge-active { background-color: #28a745; }
.badge-inactive { background-color: #dc3545; }

/* ========================================================
   COMPLEMENTOS ESPECÍFICOS (CORRECCIÓN DEFINITIVA)
   ======================================================== */

/* --- 10. ARREGLO DE BOTONES Y CABECERAS --- */
.action-cell { display: flex; gap: 5px; align-items: center; }
.header-actions { display: flex; justify-content: flex-end; gap: 15px; } /* Botones alineados a la derecha */
.header-actions h2, .header-actions .page-title { margin-right: auto !important; } /* Empuja los botones a la derecha si hay un título */

/* --- COLORES DE BOTONES ESPECÍFICOS (Los que faltaban) --- */
.btn-primary { background-color: #28a745; color: white; } /* Botón Agregar Empleado */
.btn-primary:hover { background-color: #218838; }
.btn-danger { background-color: #dc3545 !important; color: white !important; } /* Botón Rojo Suspender */
.btn-success { background-color: #28a745 !important; color: white !important; } /* Botón Verde Activar */
.btn-dark { background-color: #343a40 !important; color: white !important; } /* Botón Negro Eliminar */
.btn-qr { background-color: #17a2b8 !important; color: white !important; } /* Botón Imprimir QR */

/* --- 11. PANTALLA DE LOGIN --- */
.login-container { background-color: #ffffff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 100%; max-width: 350px; text-align: center; margin: 10vh auto; }
.login-container h2 { color: #2c3e50; margin-bottom: 5px; }
.login-container .subtitle { color: #7f8c8d; font-size: 14px; margin-bottom: 30px; }
.btn-login { width: 100%; padding: 12px; margin-top: 15px; background-color: #1a4a76; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; font-weight: bold; transition: 0.3s; }
.btn-login:hover { background-color: #123456; }
.error-message { color: #721c24; background-color: #f8d7da; border: 1px solid #f5c6cb; padding: 10px; border-radius: 4px; margin-bottom: 20px; font-size: 14px; }
/* --- Estilos para el campo de contraseña con ícono integrado --- */
.password-container {
    position: relative;
    width: 100%;
}

/* Sobreescribimos el padding derecho solo para este input, así el texto no pisa el ícono */
.password-container input {
    width: 100%;
    padding-right: 40px !important; 
    box-sizing: border-box;
}

.password-toggle-icon {
    position: absolute;
    top: 50%; /* Centrado vertical perfecto */
    right: 12px;
    transform: translateY(-50%); 
    cursor: pointer;
    color: #6c757d; /* Gris sobrio por defecto */
    font-size: 1.1rem;
    transition: color 0.3s;
}

/* Al pasar el mouse, se ilumina con tu Azul Institucional */
.password-toggle-icon:hover {
    color: #1a4a76; 
}

/* --- 12. FICHAS DE LECTURA (PERFILES) --- */
.profile-card { background: white; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); padding: 30px; display: grid; grid-template-columns: 250px 1fr; gap: 40px; }
.profile-media { text-align: center; border-right: 1px solid #e9ecef; padding-right: 40px; }
.profile-photo { width: 180px; height: 220px; object-fit: contain; border-radius: 8px; border: 3px solid #1a4a76; margin-bottom: 15px; background-color: #ffffff; padding: 8px; box-sizing: border-box; }
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.data-item { display: flex; flex-direction: column; }
.data-label { font-size: 12px; color: #6c757d; font-weight: bold; text-transform: uppercase; margin-bottom: 3px; }
.data-value { font-size: 15px; color: #212529; font-weight: 500; background-color: #f8f9fa; padding: 8px 12px; border-radius: 4px; border: 1px solid #e9ecef; }
.badge-responsable { background-color: #e8f4f8; border: 1px solid #b8daff; padding: 15px; border-radius: 6px; display: flex; flex-direction: column; gap: 5px; }

/* --- 13. AUDITORÍA Y DASHBOARD --- */
.bg-alta { background-color: #28a745; }
.bg-mod { background-color: #ffc107; color: #000; }
.bg-baja { background-color: #dc3545; }
.bg-default { background-color: #6c757d; }
.dashboard-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); align-items: start; }
.layout-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 30px; align-items: start; } /* Devuelve las 2 columnas a Usuarios */
.number-cell { text-align: right; font-weight: bold; font-size: 16px; color: #1a4a76; }


/* --- TARJETAS KPI (DASHBOARD) --- */
.kpi-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.kpi-card {
    background: linear-gradient(135deg, #1a4a76, #2c3e50);
    color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s;
}
.kpi-card:hover { transform: translateY(-5px); }
.kpi-card.success { background: linear-gradient(135deg, #28a745, #218838); }
.kpi-card.danger { background: linear-gradient(135deg, #dc3545, #c82333); }
.kpi-card.info { background: linear-gradient(135deg, #17a2b8, #117a8b); }
.kpi-number { font-size: 32px; font-weight: bold; margin-bottom: 5px; }
.kpi-label { font-size: 14px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.9; }

/* --- CONTENEDORES DE GRÁFICOS --- */
.chart-container {
    position: relative;
    height: 350px; /* Altura fija para mantener proporción */
    width: 100%;
    padding: 10px 0;
}


/* --- 14. IMPRESIÓN PDF --- */
.print-header { display: none; }
@media print {
    body { background-color: white; color: black; }
    .navbar, .btn-actions, .page-header { display: none !important; }
    .container { padding: 0; max-width: 100%; margin: 0; }
    .profile-card { box-shadow: none; border: 1px solid #000; padding: 20px; }
    .data-value { background-color: white; border: 1px solid #ccc; color: black; }
    .badge { background-color: transparent !important; border: 1px solid black; color: black !important; }
    .print-header { display: block !important; text-align: center; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid #000; }
    .print-header h2 { margin: 0; font-size: 18px; text-transform: uppercase; }
    .print-header h3 { margin: 5px 0 0 0; font-size: 14px; color: #555; }
}

/* --- 15. ESTRUCTURA DE FORMULARIOS (EMPLEADOS) --- */
.layout-wrapper { display: grid; grid-template-columns: 2fr 350px; gap: 30px; align-items: start; }
.btn-actions { display: flex; gap: 15px; align-items: center; }
.preview-box { border: 2px dashed #ced4da; border-radius: 8px; padding: 10px; text-align: center; margin-top: 10px; min-height: 150px; display: flex; align-items: center; justify-content: center; background-color: #f8f9fa; overflow: hidden; }
.preview-box img { max-width: 100%; max-height: 180px; border-radius: 4px; object-fit: contain; background-color: white; }
.media-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.error-msg { color: #dc3545; font-size: 12px; margin-top: 4px; display: none; }
.input-error { border-color: #dc3545 !important; }

/* --- 16. BOTONES PEQUEÑOS (PANTALLA DE USUARIOS) --- */
.btn-sm {
    padding: 6px 12px;
    text-decoration: none;
    border: none;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    box-sizing: border-box;
}
.btn-sm:hover { opacity: 0.85; transform: scale(1.02); }