*{
	box-sizing: border-box;
}
body{
	margin: 2%;
	padding: 0;
	background-color: #f0f4f8;
}
.row.dash .chart{
	background-color: #fff;
	border:1px solid #dee2e6;
	border-radius:5px;
	width:100%;
}
.media{
	padding: 5px;
}
.row.dash .card{
	border:none;
}


.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px #0000000f;
    transition: all .3s ease;
    border-left: 4px solid;
}
.stat-card:hover {
    box-shadow: 0 4px 16px #0000001a;
    transform: translateY(-2px);
}
.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}
.stat-label {
    font-size: .85rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.stat-icon {
    font-size: 24px;
    opacity: .8;
}
.stat-card.women {
    border-left-color: #ec4899;
}
.stat-card.men {
    border-left-color: #3b82f6;
}
.stat-card.total {
    border-left-color: #2d7a4f;
}
.stat-card.families {
    border-left-color: #f59e0b;
}
.stat-card.house {
    border-left-color: #20c997;
}
.stats-grid{
	//display:none;
}

.stat-value {
    transition: all 0.8s ease;
}

.floating-filter{
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 1050;

	background: #ffffff;
	border-radius: 12px;
	padding: 15px 18px;

	box-shadow: 0 4px 20px rgb(0 0 0 / 85%);
	border: 1px solid #dee2e6;

	min-width: 20%;
}

.floating-filter label{
	font-size: .8rem;
	font-weight: 600;
	color: #64748b;
	text-transform: uppercase;
	letter-spacing: .5px;
	margin: 0;
	width: 100%;
}

.floating-filter select{
	margin-top: 6px;
	border-radius: 8px;
}

@media (max-width: 768px){
	.floating-filter{
		top: auto;
		bottom: 10px;
		right: 50%;
		transform: translateX(50%);
		width: calc(100% - 30px);
		max-width: 400px;
	}
}

/* DASHBOARD HEADER*/

.dashboard-header {
    position: fixed; /* Siempre visible arriba */
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    z-index: 1100;
    padding: 10px 20px;
}

.container-header {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header .logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.dashboard-header .app-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

body {
    margin: 0;
    padding: 80px 2% 2%; /* 80px para el header fijo */
    background-color: #f0f4f8;
}



/* ================== Estilos para impresión ================== */
@media print {

    /* Ocultar elementos interactivos y flotantes */
    .floating-filter, /* select flotante */
    .stats-grid.hidden, /* si está oculto por JS */
    .dashboard-header { 
        /* opcional: si no quieres header en la impresión */
        display: block; /* si quieres mostrar header, déjalo block */
    }

    /* Simplificar body */
    body {
        background: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
        color: #000;
    }

    /* Ocultar select flotante y cualquier otro botón */
    select, button {
        display: none !important;
    }

    /* Ajustar tarjetas */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
        gap: 15px !important;
    }

    .stat-card {
        padding: 15px !important;
		border-right: 1px solid #6c757d !important;
		border-top: 1px solid #6c757d !important;
		border-bottom: 1px solid #6c757d !important;
    }

    .stat-value {
        font-size: 1.8rem !important;
    }

    /* Ajustar gráficos */
    .chart {
        page-break-inside: avoid;
        border: 1px solid #6c757d !important;
        box-shadow: none !important;
        background: #fff !important;
		margin-top:1em !important;
    }

    .chart #grafico,
    .chart #graficoSexo {
        width: 100% !important;
        height: 350px !important; /* tamaño fijo para impresión */
		margin-top:1em;
    }
	
    .chart #graficoVivienda,
    .chart #graficoEdad {
        width: 100% !important;
        height: 500px !important; /* tamaño fijo para impresión */
    }

    /* Evitar que flotantes queden encima */
    .floating-filter {
        display: none !important;
    }

    /* Quitar colores de fondo del body */
    .row.dash .chart, .stats-grid {
        background: #fff !important;
    }

    /* Ajustar header */
    .dashboard-header {
        position: relative !important;
        box-shadow: none !important;
        border-bottom: 1px solid #000;
    }
}

.chart.ultimo{
	margin-bottom: 10%;
}

@media (max-width: 768px){
	.chart.ultimo{
		margin-bottom: 30%;
	}
}

.btn-download:hover{
	color: #fff;
	background-color: #2b5c41;
}
.dropdown-item.active, .dropdown-item:active{
	background-color: #2d7a4f;
	color: #fff;
}

.btn-download{
	color: #fff;
    background-color: #307c52;
    border-color: #307c52;
}

.swal-confirm-btn {
    background-color: #3085d6 !important;
    color: #fff !important;
}

#row-principal{
	opacity:0;
}

/* Botón flotante */
.filter-toggle {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 120;
}

/* Panel flotante */
.floating-filter-panel {
	position: fixed;
	bottom: 70px;
	right: 20px;
	width: 350px;
	z-index: 1040;
}

/* Opcional: estilo más moderno */
.floating-filter-panel .card {
	border-radius: 12px;
}