/**
 * SISTEMA SIRE - Colombia
 * Sistema de Información de Riesgos y Emergencias
 * Estilos personalizados - Diseño Moderno
 */

:root {
    /* Colores Sidebar - Tema claro */
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --sidebar-text: #334155;
    --sidebar-text-muted: #64748b;
    --sidebar-hover: #e0f2fe;
    --sidebar-hover-text: #0369a1;
    --sidebar-active-bg: #0ea5e9;
    --sidebar-active-text: #ffffff;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 65px;
    --header-height: 56px;
    
    /* Colores de acento */
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    
    /* Gradientes */
    --gradient-start: #0284c7;
    --gradient-end: #0369a1;
    --gradient-avatar-start: #6366f1;
    --gradient-avatar-end: #4f46e5;
    
    /* Texto */
    --text-muted: #64748b;
    
    /* Tipografía */
    --font-size-base: 0.875rem;
    --font-size-sm: 0.8125rem;
    --font-size-xs: 0.75rem;
}

/* ========================================
   RESET Y BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--font-size-base);
    background-color: #f1f5f9;
    color: #334155;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.content-wrapper {
    flex: 1;
    padding: 20px;
    margin-top: var(--header-height);
}

/* ========================================
   SIDEBAR - Diseño Moderno Claro
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, width 0.2s ease;
}

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

/* Header del Sidebar con gradiente azul */
.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.sidebar-brand {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand-name,
.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.025em;
}

.sidebar-brand small,
.sidebar-brand-subtitle {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 400;
    color: rgba(255,255,255,0.8);
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

/* Usuario */
.sidebar-user {
    padding: 14px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    background: #f8fafc;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-avatar-start) 0%, var(--gradient-avatar-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-sm);
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar.collapsed .user-avatar {
    width: 36px;
    height: 36px;
    font-size: var(--font-size-xs);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: var(--font-size-xs);
    color: var(--sidebar-text-muted);
}

.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
    padding: 14px 8px;
}

/* Contexto activo */
.sidebar-context {
    padding: 12px;
    margin: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    flex-shrink: 0;
}

.context-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: var(--font-size-xs);
    color: var(--sidebar-text);
}

.context-item i {
    width: 18px;
    font-size: 0.9rem;
    text-align: center;
}

.context-item i.text-danger,
.context-item i.bi-exclamation-triangle {
    color: var(--danger);
}

.context-item i.text-success,
.context-item i.bi-house {
    color: var(--success);
}

.context-label {
    color: var(--sidebar-text-muted);
}

.context-value {
    font-weight: 600;
    color: #1e293b;
}

.sidebar-context .btn-outline-light {
    color: var(--primary);
    border-color: var(--primary);
    font-size: var(--font-size-xs);
    padding: 6px 12px;
}

.sidebar-context .btn-outline-light:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.sidebar.collapsed .sidebar-context {
    display: none;
}

/* Navegación */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.nav-section {
    padding: 0 12px;
    margin-bottom: 4px;
}

.nav-section-title {
    padding: 14px 8px 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-text-muted);
}

.sidebar.collapsed .nav-section-title {
    text-align: center;
    padding: 10px 4px 4px;
    font-size: 0.6rem;
}

.nav-item {
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 2px 0;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: var(--font-size-sm);
    transition: all 0.15s ease;
    position: relative;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-hover-text);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 500;
}

.nav-link i {
    width: 20px;
    font-size: 1.05rem;
    text-align: center;
    flex-shrink: 0;
}

.nav-link span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link i {
    width: auto;
}

/* Submenú */
.nav-submenu {
    margin-left: 20px;
    padding-left: 12px;
    border-left: 2px solid var(--sidebar-border);
}

.nav-submenu .nav-link {
    padding: 7px 12px;
    font-size: var(--font-size-xs);
}

.nav-submenu .nav-link i {
    width: 18px;
    font-size: 0.9rem;
}

.sidebar.collapsed .nav-submenu {
    display: none !important;
}

/* Flecha de submenú */
.nav-link .bi-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.sidebar.collapsed .bi-chevron-down {
    display: none;
}

/* Enlace colapsable */
.nav-link[data-bs-toggle="collapse"] {
    cursor: pointer;
}

/* Toggle sidebar desktop */
.sidebar-toggle {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    border: 1px solid var(--sidebar-border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-text-muted);
    transition: all 0.15s ease;
}

.sidebar-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-hover-text);
}

/* Overlay móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Botón cerrar sidebar móvil */
.sidebar-close {
    display: none;
    position: absolute;
    top: 14px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 10;
}

.sidebar-close:hover {
    background: rgba(255,255,255,0.3);
}

/* ========================================
   HEADER
   ======================================== */
.main-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--sidebar-border);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    transition: left 0.25s ease;
}

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

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Botón hamburguesa - VISIBLE en móvil */
.mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.mobile-toggle:hover {
    background: var(--primary-hover);
}

.header-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: #1e293b;
}

.header-breadcrumb {
    font-size: var(--font-size-xs);
    color: var(--sidebar-text-muted);
}

.breadcrumb-wrapper .breadcrumb {
    margin: 0;
    background: none;
    padding: 0;
    font-size: var(--font-size-sm);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-icon {
    position: relative;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--sidebar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: all 0.15s ease;
}

.header-icon:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-hover-text);
}

.header-icon .badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid white;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.header-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-avatar-start), var(--gradient-avatar-end));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.header-user-info {
    text-align: right;
}

.header-user-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: #1e293b;
}

.header-user-role {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* ========================================
   RESPONSIVE - Tablet
   ======================================== */
@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 230px;
    }
}

/* ========================================
   RESPONSIVE - Móvil
   ======================================== */
@media (max-width: 767.98px) {
    /* Sidebar oculto por defecto */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 4px 0 25px rgba(0,0,0,0.15);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Mostrar botón cerrar */
    .sidebar-close {
        display: flex;
    }
    
    /* Header ocupa todo */
    .main-header {
        left: 0;
        padding: 0 12px;
    }
    
    /* Mostrar hamburguesa */
    .mobile-toggle {
        display: flex;
    }
    
    /* Contenido todo el ancho */
    .main-content,
    .content-wrapper {
        margin-left: 0;
    }
    
    /* Toggle desktop oculto */
    .sidebar-toggle {
        display: none;
    }
}

/* ========================================
   RESPONSIVE - Móvil pequeño
   ======================================== */
@media (max-width: 575.98px) {
    .content-wrapper {
        padding: 12px;
    }
    
    .header-breadcrumb {
        display: none;
    }
    
    .header-user-info {
        display: none;
    }
}

/* ========================================
   PÁGINA DE LOGIN
   ======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0c4a6e 100%);
    padding: 20px;
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.03) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.03) 0%, transparent 50%);
    pointer-events: none;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.4);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.login-header {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: #fff;
    padding: 30px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.login-subtitle {
    font-size: 0.85rem;
    opacity: 0.8;
}

.login-body {
    padding: 30px;
}

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

.login-form .form-label {
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 8px;
}

.login-form .form-control {
    height: 48px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 10px 15px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.login-form .form-control:focus {
    border-color: var(--gradient-start);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-form .input-group .form-control {
    border-right: none;
}

.login-form .input-group-text {
    background: #fff;
    border: 2px solid #e9ecef;
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
}

.login-form .btn-login {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-form .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.login-footer {
    text-align: center;
    padding: 20px 30px;
    background: #f8f9fa;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========================================
   SELECTOR DE CONTEXTO (Emergencia/Albergue)
   ======================================== */
.selector-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    padding: 20px;
}

.selector-box {
    width: 100%;
    max-width: 600px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    overflow: hidden;
}

.selector-header {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: #fff;
    padding: 25px 30px;
    text-align: center;
}

.selector-body {
    padding: 30px;
}

.selector-list {
    display: grid;
    gap: 15px;
}

.selector-item {
    display: block;
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.selector-item:hover {
    border-color: var(--gradient-start);
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-2px);
}

.selector-item-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.selector-item-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
}

.selector-item-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1e293b;
}

.selector-item-code {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.selector-item-meta {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.selector-item-meta i {
    margin-right: 5px;
}

/* ========================================
   CARDS Y WIDGETS
   ======================================== */
.card {
    border: 1px solid #93c5fd;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
    margin-bottom: 20px;
    background: white;
}

.card-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%) !important;
    border-bottom: 1px solid #93c5fd !important;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: #1e40af !important;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.card-header i {
    color: #2563eb !important;
}

.card-header span,
.card-header small {
    color: #1e40af !important;
}

/* Variantes de card-header con color */
.card-header-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
}

.card-header-success {
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
}

.card-header-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #b45309 100%);
}

.card-header-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
}

.card-header-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
}

.card-header-light {
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    color: #334155;
    border-bottom: 1px solid #cbd5e1;
}

.card-header-light i {
    color: #64748b;
}

.card-header-light .btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.card-header-light .btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.card-body {
    padding: 16px;
}

/* Stats Cards - Nuevo diseño */
.stat-card {
    background: white;
    border: 1px solid var(--sidebar-border);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.15s ease;
    margin-bottom: 0;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--primary-light); color: var(--primary); }

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--sidebar-text-muted);
    font-weight: 500;
}

/* Stats Cards - Estilo antiguo (compatibilidad) */
.stats-card {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    padding: 20px;
    color: #fff;
    min-height: 120px;
}

.stats-card.bg-primary { background: linear-gradient(135deg, #0d6efd, #0b5ed7); }
.stats-card.bg-success { background: linear-gradient(135deg, #198754, #157347); }
.stats-card.bg-warning { background: linear-gradient(135deg, #ffc107, #e0a800); color: #212529; }
.stats-card.bg-danger { background: linear-gradient(135deg, #dc3545, #bb2d3b); }
.stats-card.bg-info { background: linear-gradient(135deg, #0dcaf0, #0aa2c0); }
.stats-card.bg-purple { background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)); }

.stats-card-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4rem;
    opacity: 0.2;
}

.stats-card-content {
    position: relative;
    z-index: 1;
}

.stats-card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.stats-card-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stats-card-trend {
    font-size: 0.8rem;
    margin-top: 10px;
}

.stats-card-trend i {
    margin-right: 5px;
}

/* ========================================
   TABLAS
   ======================================== */
.table-wrapper {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 20px;
}

.table {
    margin-bottom: 0;
    font-size: var(--font-size-sm);
}

.table thead th,
.table-light th,
.table thead.table-light th {
    background: #f8fafc !important;
    border-bottom: 1px solid var(--sidebar-border);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: #475569 !important;
    padding: 12px 14px;
}

.table tbody td {
    padding: 12px 14px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--sidebar-text);
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Badges generales */
.badge {
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Badges de estado */
.badge-estado {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.badge-activa { background: var(--success-light); color: var(--success); }
.badge-finalizada { background: var(--primary-light); color: var(--primary); }
.badge-cancelada { background: var(--danger-light); color: var(--danger); }
.badge-operativo { background: var(--success-light); color: var(--success); }
.badge-lleno { background: var(--warning-light); color: var(--warning); }
.badge-cerrado { background: #f1f5f9; color: #64748b; }

/* Action buttons en tablas */
.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* ========================================
   FORMULARIOS
   ======================================== */
.form-section {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 25px;
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gradient-start);
}

.form-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: 6px;
    color: #475569;
}

.form-label .required {
    color: var(--danger);
}

.form-control, .form-select {
    font-size: var(--font-size-sm);
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--danger);
}

.invalid-feedback {
    font-size: var(--font-size-xs);
}

.form-text {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* ========================================
   BOTONES
   ======================================== */
.btn {
    font-size: var(--font-size-sm);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-sm {
    font-size: var(--font-size-xs);
    padding: 5px 10px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

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

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

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: #047857;
    border-color: #047857;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #b45309;
    border-color: #b45309;
    color: #fff;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

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

.btn-outline-secondary {
    color: #64748b;
    border-color: #e2e8f0;
}

.btn-outline-secondary:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #334155;
}

.btn-outline-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-gradient {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border: none;
    color: #fff;
}

.btn-gradient:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
    color: #fff;
}

/* ========================================
   ALERTAS Y MENSAJES FLASH
   ======================================== */
.alert {
    font-size: var(--font-size-sm);
    padding: 14px 16px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert i {
    font-size: 1.1rem;
    margin-top: 1px;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary-hover);
}

.alert-dismissible .btn-close {
    padding: 16px;
}

/* ========================================
   PAGINACIÓN
   ======================================== */
.pagination {
    margin: 0;
}

.page-link {
    border-radius: 6px;
    margin: 0 2px;
    color: #1e293b;
    border: 1px solid #e9ecef;
}

.page-link:hover {
    background: #f8f9fa;
    color: #1e293b;
}

.page-item.active .page-link {
    background: var(--gradient-start);
    border-color: var(--gradient-start);
}

/* ========================================
   MODAL
   ======================================== */
.modal-content {
    border: none;
    border-radius: 12px;
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 15px 20px;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 15px 20px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        width: var(--sidebar-width);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.sidebar-collapsed {
        margin-left: 0;
    }
    
    .main-header {
        left: 0;
    }
    
    .main-header.sidebar-collapsed {
        left: 0;
    }
    
    .mobile-toggle {
        display: flex;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .header-user-info {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .content-wrapper {
        padding: 15px;
    }
    
    .stats-card {
        min-height: 100px;
    }
    
    .stats-card-value {
        font-size: 1.5rem;
    }
    
    .stats-card-icon {
        font-size: 3rem;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .btn-action {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

/* ========================================
   UTILIDADES
   ======================================== */
.text-gradient {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-light-primary { background: rgba(13, 110, 253, 0.1); }
.bg-light-success { background: rgba(25, 135, 84, 0.1); }
.bg-light-warning { background: rgba(255, 193, 7, 0.1); }
.bg-light-danger { background: rgba(220, 53, 69, 0.1); }

.border-left-primary { border-left: 4px solid var(--primary); }
.border-left-success { border-left: 4px solid #198754; }
.border-left-warning { border-left: 4px solid #ffc107; }
.border-left-danger { border-left: 4px solid #dc3545; }

.cursor-pointer { cursor: pointer; }

.shadow-sm { box-shadow: 0 2px 10px rgba(0,0,0,0.08); }

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--gradient-start);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* DataTables customization */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 5px 10px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--gradient-start) !important;
    border-color: var(--gradient-start) !important;
    color: #fff !important;
}

/* Select2 customization */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: 6px;
    border: 1px solid #ced4da;
    min-height: 42px;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 8px 12px;
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 300px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 20px;
}

.empty-state-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 10px;
}

.empty-state-text {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ========================================
   WELCOME CARD - Dashboard
   ======================================== */
.welcome-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #3d7ab5 100%);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(30, 58, 95, 0.3);
    overflow: hidden;
    position: relative;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.welcome-card::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
}

.welcome-card-body {
    padding: 30px;
    position: relative;
    z-index: 1;
}

.welcome-title {
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.welcome-title i {
    color: #ffd700;
}

.welcome-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
}

.welcome-subtitle strong {
    color: #ffd700;
    font-weight: 600;
}

.welcome-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.welcome-date i {
    color: #ffd700;
}

/* ========================================
   STATS CARDS - Colores mejorados
   ======================================== */
.stats-card {
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.stats-card.bg-primary {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
}

.stats-card.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%) !important;
}

.stats-card.bg-warning {
    background: linear-gradient(135deg, #fd7e14 0%, #e55a00 100%) !important;
    color: #fff !important;
}

.stats-card.bg-info {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%) !important;
}

.stats-card.bg-danger {
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%) !important;
}

.stats-card.bg-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%) !important;
}

.stats-card-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3.5rem;
    opacity: 0.3;
}

.stats-card-content {
    position: relative;
    z-index: 1;
}

.stats-card-value {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.stats-card-label {
    font-size: 0.85rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   TABS DE FORMULARIOS (Bootstrap nav-tabs)
   ======================================== */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-item {
    margin-bottom: -2px;
}

.nav-tabs .nav-link {
    color: #495057;
    font-weight: 500;
    padding: 12px 20px;
    border: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    background-color: transparent;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    color: #0d6efd;
    background-color: #f8f9fa;
    border-color: #dee2e6 #dee2e6 transparent;
}

.nav-tabs .nav-link.active {
    color: #0d6efd;
    font-weight: 600;
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
}

.nav-tabs .nav-link i {
    opacity: 0.7;
}

.nav-tabs .nav-link.active i {
    opacity: 1;
}

.nav-tabs .nav-link .badge {
    font-size: 0.7rem;
    vertical-align: middle;
}

/* Tab content styling */
.tab-content {
    background-color: #fff;
    border-radius: 0 0 8px 8px;
}

.tab-pane {
    animation: fadeIn 0.3s ease;
}

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

/* Pills variant (optional) */
.nav-pills .nav-link {
    color: #495057;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-pills .nav-link:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.nav-pills .nav-link.active {
    color: #fff;
    background-color: var(--primary);
}

/* ========================================
   PAGE HEADER
   ======================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.page-subtitle {
    font-size: var(--font-size-xs);
    color: var(--sidebar-text-muted);
    margin-top: 2px;
}

@media (max-width: 575.98px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-title {
        font-size: 1.125rem;
    }
}

/* ========================================
   SELECT CARDS
   ======================================== */
.select-cards {
    display: block;
}

.select-card-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.select-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.select-card:hover {
    border-color: #93c5fd;
    background: #f0f9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.select-card-input:checked + .select-card {
    border-color: var(--primary);
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2), 0 4px 12px rgba(2, 132, 199, 0.15);
}

.select-card-input:checked + .select-card .select-card-icon {
    color: var(--primary);
    background: white;
}

.select-card-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 10px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.select-card-text {
    flex: 1;
    min-width: 0;
}

.select-card-text strong {
    display: block;
    font-size: var(--font-size-sm);
    color: #1e293b;
    margin-bottom: 2px;
}

.select-card-text small {
    font-size: var(--font-size-xs);
    color: #64748b;
}

.select-card-input:checked + .select-card .select-card-text strong {
    color: #1e40af;
}

.select-card-input:checked + .select-card .select-card-text small {
    color: #3b82f6;
}

/* Campos de declaratoria ocultos por defecto */
.declaratoria-fields {
    display: none;
}

/* Variantes de select-card */
.select-card-success .select-card-input:checked + .select-card,
.select-card-success .select-card:has(+ .select-card-input:checked) {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--success-light) 0%, #ecfdf5 100%);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2), 0 4px 12px rgba(5, 150, 105, 0.15);
}

.select-card-success .select-card-input:checked + .select-card .select-card-icon {
    color: var(--success);
    background: white;
}

.select-card-success .select-card-input:checked + .select-card .select-card-text strong {
    color: #047857;
}

.select-card-warning .select-card-input:checked + .select-card {
    border-color: var(--warning);
    background: linear-gradient(135deg, var(--warning-light) 0%, #fffbeb 100%);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2), 0 4px 12px rgba(217, 119, 6, 0.15);
}

.select-card-warning .select-card-input:checked + .select-card .select-card-icon {
    color: var(--warning);
    background: white;
}

.select-card-warning .select-card-input:checked + .select-card .select-card-text strong {
    color: #b45309;
}

.select-card-danger .select-card-input:checked + .select-card {
    border-color: var(--danger);
    background: linear-gradient(135deg, var(--danger-light) 0%, #fef2f2 100%);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2), 0 4px 12px rgba(220, 38, 38, 0.15);
}

.select-card-danger .select-card-input:checked + .select-card .select-card-icon {
    color: var(--danger);
    background: white;
}

.select-card-danger .select-card-input:checked + .select-card .select-card-text strong {
    color: #b91c1c;
}

/* Select card compacto */
.select-card-sm .select-card {
    padding: 10px 12px;
    gap: 10px;
}

.select-card-sm .select-card-icon {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
}
