/**
 * Estilos Personalizados - Sistema Búsqueda de Personas
 * Policía de Misiones
 */

/* ============================================
   VARIABLES Y COLORES INSTITUCIONALES
   ============================================ */
:root {
    --color-primario: #1e3a8a; /* Azul institucional */
    --color-secundario: #3b82f6;
    --color-exito: #10b981;
    --color-advertencia: #f59e0b;
    --color-peligro: #ef4444;
    --color-alerta-roja: #dc2626;
    --color-alerta-amarilla: #fbbf24;
    --color-alerta-verde: #22c55e;
}

/* ============================================
   BOOTSTRAP ICONS - Optimización
   ============================================ */
i.bi, .bi {
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: -.125em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tamaños predefinidos */
.bi-lg { font-size: 1.33em; }
.bi-xl { font-size: 1.75em; }
.bi-2x { font-size: 2em; }
.bi-3x { font-size: 3em; }

/* Iconos en botones y navegación */
.btn i.bi, .nav-link i.bi, .card-title i.bi {
    display: inline-block;
    min-width: 1.2em;
    text-align: center;
}

/* Iconos de información */
.info-box-icon i.bi {
    font-size: 2.5rem;
}

/* ============================================
   LAYOUT GENERAL
   ============================================ */
body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.content-wrapper {
    background-color: #f4f6f9;
}

/* ============================================
   HEADER PERSONALIZADO
   ============================================ */
.main-header .navbar {
    background-color: var(--color-primario) !important;
}

.main-header .navbar-nav .nav-link {
    color: #ffffff !important;
}

.brand-link {
    background-color: #172554 !important;
    border-bottom: 1px solid #1e40af;
}

.brand-link .brand-text {
    color: #ffffff !important;
    font-weight: 600;
}

.brand-link .brand-image {
    opacity: 1;
}

/* ============================================
   SIDEBAR
   ============================================ */
.main-sidebar {
    background-color: #1e293b !important;
}

.sidebar .nav-link {
    color: #cbd5e1 !important;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: var(--color-primario) !important;
    color: #ffffff !important;
}

.sidebar .nav-icon {
    color: #94a3b8;
}

.sidebar .nav-link:hover .nav-icon,
.sidebar .nav-link.active .nav-icon {
    color: #ffffff;
}

/* Menú expandible - Casos */
.sidebar .nav-treeview {
    background-color: #0f172a !important;
    padding-left: 1rem;
}

.sidebar .nav-treeview .nav-link {
    padding-left: 2rem;
}

.sidebar .nav-treeview .nav-icon {
    font-size: 0.875rem;
}

/* Animación del chevron */
.nav-link[data-widget="treeview"] i.right,
#casos-chevron {
    transition: transform 0.3s ease;
}

.nav-item.menu-open > .nav-link[data-widget="treeview"] i.right,
.nav-item.menu-open > .nav-link i.right {
    transform: rotate(-90deg);
}

/* ============================================
   BADGES DE ALERTA
   ============================================ */
.badge-alerta-roja {
    background-color: var(--color-alerta-roja);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-alerta-amarilla {
    background-color: var(--color-alerta-amarilla);
    color: #1f2937;
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-alerta-verde {
    background-color: var(--color-alerta-verde);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   BADGES DE ESTADO
   ============================================ */
.badge-estado-desaparecido {
    background-color: #dc2626;
    color: #ffffff;
}

.badge-estado-visto {
    background-color: #f59e0b;
    color: #ffffff;
}

.badge-estado-habido {
    background-color: #10b981;
    color: #ffffff;
}

.badge-estado-cerrado {
    background-color: #6b7280;
    color: #ffffff;
}

/* ============================================
   DATATABLES PERSONALIZADO
   ============================================ */
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    margin-left: 0.5rem;
}

table.dataTable thead th {
    background-color: var(--color-primario);
    color: #ffffff;
    font-weight: 600;
    border-bottom: 2px solid #1e40af;
}

table.dataTable tbody tr:hover {
    background-color: #f3f4f6 !important;
}

table.dataTable tbody td {
    vertical-align: middle;
}

/* Botones de DataTables */
.dt-buttons {
    margin-bottom: 1rem;
}

.dt-button {
    background-color: var(--color-primario) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 1rem !important;
    margin-right: 0.5rem !important;
    font-weight: 500 !important;
}

.dt-button:hover {
    background-color: #1e40af !important;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 0.5rem;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 2px solid #e5e7eb;
    font-weight: 600;
    color: #1f2937;
}

.card-primary:not(.card-outline) .card-header {
    background-color: var(--color-primario);
}

.small-box {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.small-box .icon {
    font-size: 4rem;
    opacity: 0.3;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-control:focus {
    border-color: var(--color-primario);
    box-shadow: 0 0 0 0.2rem rgba(30, 58, 138, 0.25);
}

.form-group label {
    font-weight: 600;
    color: #374151;
}

.required:after {
    content: " *";
    color: #dc2626;
}

/* ============================================
   BOTONES
   ============================================ */
.btn-primary {
    background-color: var(--color-primario);
    border-color: var(--color-primario);
}

.btn-primary:hover {
    background-color: #1e40af;
    border-color: #1e40af;
}

.btn-icon {
    padding: 0.375rem 0.75rem;
}

/* ============================================
   MAPA
   ============================================ */
#mapa {
    height: 600px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.leaflet-popup-content {
    font-family: 'Source Sans Pro', sans-serif;
}

.leaflet-popup-content h6 {
    color: var(--color-primario);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Marcadores personalizados */
.marker-desaparicion {
    background-color: #dc2626;
    border: 2px solid #ffffff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
}

.marker-visto {
    background-color: #f59e0b;
    border: 2px solid #ffffff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
}

.marker-hallado {
    background-color: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
}

/* ============================================
   FOTO DE PERSONA
   ============================================ */
.foto-persona {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 3px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.foto-persona-grande {
    width: 250px;
    height: 250px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 3px solid var(--color-primario);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ============================================
   HISTORIAL
   ============================================ */
.timeline-item {
    border-left: 3px solid var(--color-primario);
    padding-left: 1.5rem;
    padding-bottom: 1rem;
    position: relative;
}

.timeline-item:before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    width: 12px;
    height: 12px;
    background-color: var(--color-primario);
    border-radius: 50%;
    border: 2px solid #ffffff;
}

.timeline-item:last-child {
    border-left-color: transparent;
}

/* ============================================
   LOGIN
   ============================================ */
.login-page {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.login-box {
    width: 400px;
}

.login-card-body {
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.login-logo a {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.75rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================
   FILTROS
   ============================================ */
.filtros-panel {
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

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

.filtros-panel .btn {
    width: 100%;
}

/* ============================================
   ESTADÍSTICAS
   ============================================ */
/* Dashboard - espaciado mejorado */
.content-wrapper .content {
    padding: 1.5rem;
}

.row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.row > [class*='col-'] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.card {
    margin-bottom: 1rem;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
    border: none;
    border-radius: 0.5rem;
}

.info-box {
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
    border-radius: 0.5rem;
    min-height: 90px;
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
}

.stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primario);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .foto-persona-grande {
        width: 150px;
        height: 150px;
    }
    
    #mapa {
        height: 400px;
    }
    
    .stat-card .stat-number {
        font-size: 2rem;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-muted-custom {
    color: #6b7280 !important;
}

.bg-institucional {
    background-color: var(--color-primario) !important;
    color: #ffffff !important;
}

.border-institucional {
    border-color: var(--color-primario) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.shadow-custom {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
