:root {
	--primary: #2c3e50;
	--accent: #3498db;
	--bg: #f0f2f5;
	--text: #333;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	background-color: var(--bg);
	color: var(--text);
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	padding: 20px;
}

.container {
	background: white;
	padding: 2rem;
	border-radius: 15px;
	box-shadow: 0 10px 25px rgba(0,0,0,0.1);
	
	width: 90%; /* En celulares casi siempre quieres que ocupe casi todo el ancho */
	max-width: 800px;/*500px; */
	margin: auto; /* Centrado horizontal */			
}	

h3 {
	text-align: center;
	margin-bottom: 1.5rem;
	color: var(--primary);
	font-size: 1.1rem;
}

#h3AportPend {
	margin-bottom: 0rem;
}

/* Buscador adaptable */
.search-box {
	display: flex;
	flex-direction: column; /* Columna en móviles */
	gap: 10px;
	margin-bottom: 2rem;
}

input {
	width: 100%;
	padding: 12px;
	border: 2px solid #ddd;
	border-radius: 8px;
	font-size: 1rem;
	transition: border-color 0.3s;
}

input:focus {
	outline: none;
	border-color: var(--accent);
}

button {
	width: 100%;
	padding: 12px;
	background: var(--accent);
	color: white;
	border: none;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: bold;
	cursor: pointer;
	transition: background 0.3s;
}

button:hover { background: #2980b9; }

/* Contenedor de Carga */
.loading-container {
    display: none; /* Se activa con JS */
    padding: 20px;
    margin: 1rem 0;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    text-align: center;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: var(--primary);
    font-weight: 500;
}

/* Engranaje CSS */
.spinner-gear {
    width: 40px;
    height: 40px;
    border: 4px solid #bdc3c7;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 2s linear infinite;
    position: relative;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animación de puntos (1 punto por segundo, ciclo de 4s) */
.dots::after {
    content: '';
    display: inline-block;
    width: 20px;
    text-align: left;
    animation: dotsSequence 4s infinite step-end;
}

@keyframes dotsSequence {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

.check-badge {
	display: none; /* Oculto por defecto */
	position: absolute;
	/* Centrado en la esquina superior derecha */			
	top: 10px; /*mueve check*/
	right: 5px; /*mueve check*/
	transform: translate(50%, -50%);
	width: 40px;
	height: 40px;
	z-index: 100;
	/* Fondo transparente para que no tape nada */
	/* Eliminamos fondos sólidos, bordes y sombras anteriores */
	background: transparent;
	border-radius: 0; 
	box-shadow: none;
	overflow: visible;					
	justify-content: center;
	align-items: center;
}

.check-badge img {
	width: 100%; /* Ajusta esto según qué tan grande quieras que se vea el dibujo */
	height: 100%;
	object-fit: contain;
	display: block;
	
	/* Este modo hará que el blanco de la imagen se mezcle con lo que hay detrás */
	/* En la zona gris se verá gris, fuera (en el blanco) seguirá siendo blanco */
	mix-blend-mode: multiply;
}

#resultado {
	display: none;
	text-align: center;
	animation: fadeIn 0.5s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.foto-container {
	margin-bottom: 1.5rem;
}

.foto {
	width: 150px;
	height: 150px;
	object-fit: cover;
	border-radius: 50%;
	border: 4px solid var(--accent);
	box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.info-colegiado {
	position: relative; /* Obligatorio para que el check se pegue aquí */
	text-align: left;
	background: #f8f9fa;
	padding: 20px;
	border-radius: 10px;			

	display: flex;
	flex-direction: column;
	gap: 8px;
}

.info-colegiado p {
	margin: 0;
	font-size: 0.95rem;
	
	display: flex; /* Usamos flex para alinear etiqueta y valor */
	line-height: 1.4;
}

/* Forzamos a que el texto en negrita ocupe un espacio fijo */
.info-colegiado p strong {
	display: inline-block;
	width: 195px; /* Ajusta este ancho según el texto más largo */
	flex-shrink: 0; /* Evita que la etiqueta se encoja */
	color: var(--primary);
}

.info-colegiado p span {
	flex-grow: 1; /* El span ocupa el resto del espacio */
	word-break: break-word; /* Evita que correos largos rompan el diseño */
	color: var(--accent);
	font-weight: bold;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	letter-spacing: 0.3px; /* Separa apenas las letras */
}

.deudas-container {
	margin-top: 25px;
	padding: 15px;
	border-top: 2px solid #eee;
	
	width: 100%;
}

.deudas-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 15px;
}

.total-general {
	font-size: 1em;
	font-weight: bold;
	color: #d32f2f;
	background: #ffebee;
	padding: 5px 15px;
	border-radius: 5px;
}

.year-summary {
	display: flex;
	justify-content: space-between;
	background: #f5f5f5;
	padding: 10px;
	font-size: 0.8em;
	border-left: 5px solid #2196f3;
}

.table-responsive {
	overflow-x: auto;
	margin-top: 10px;
}

.tabla-aportaciones {
	width: 100%;	
	margin: 0 auto; /* Centra la tabla */			
}

.tabla-aportaciones th, .tabla-aportaciones td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid #ddd;
}		

.pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: 20px;
}

.pagination button {
	padding: 8px 15px;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	transition: 0.3s;
}

.pagination button.btn-active:hover {
	background-color: #2196f3;
	color: white;
}

.pagination button:disabled {
	background-color: #f5f5f5;
	color: #ccc;
	cursor: not-allowed;
}

.nav-indicator {
	font-weight: bold;
	padding: 0 10px;
}

/* Estilo para meses con saldo 0 (pagados) */
.saldo-pagado {
	color: var(--accent);
	font-weight: bold;
}

.saldo-pendiente {
	color: #f44336;
}

.logo-footer {
	position: fixed; /* Lo mantiene pegado a la pantalla aunque hagas scroll */
	bottom: 20px;    /* Distancia desde abajo */
	right: 20px;     /* Distancia desde la derecha */
	z-index: 1000;   /* Asegura que esté por encima de otros elementos */
}

.logo-footer img {
	width: 230px;    /* Tamaño para PC y Laptops */
	height: auto;    /* Mantiene la proporción */
	filter: drop-shadow(0 2px 5px rgba(0,0,0,0.2)); /* Sombra suave para que resalte */
	transition: width 0.3s ease; /* Transición suave al cambiar de tamaño */
}

/* Contenedor base de la alerta */
.mensaje-alerta {
    display: none; /* Oculto por defecto */
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    margin: 1rem 0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    position: relative;
    animation: slideIn 0.4s ease forwards;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Animación de entrada */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Variación Error */
.mensaje-alerta.error {
    display: flex;
    background-color: #fdecea;
    color: #d32f2f;
    border-left: 5px solid #d32f2f;
}

/* Variación Éxito */
.mensaje-alerta.success {
    display: flex;
    background-color: #edf7ed;
    color: #1e4620;
    border-left: 5px solid #4caf50;
}

/* Botón de cierre (la X) */
.btn-cerrar {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    margin-left: 15px;
    padding: 0;
    opacity: 0.6;
    transition: 0.2s;
}

.btn-cerrar:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* --- MEDIA QUERIES (Responsividad) --- */

/* Para tablets y PCs (pantallas medianas a grandes) */
@media (min-width: 480px) {
	.search-box {
		flex-direction: row; /* Fila en pantallas más anchas */
	}
	
	button {
		width: auto;
	}
	
	h3 { font-size: 1.1rem; }
}

/* Regla para Laptops/PCs: Se activa solo en pantallas grandes */
@media (min-width: 1024px) {
	.container {
		width: 50%;
	}
}

@media (max-width: 768px) {
	.logo-footer img {
		width: 100px; 
	}
	
	.container {
		width: 90%;
	}
}

/* Ajuste para pantallas muy pequeñas */
@media (max-width: 320px) {
	.container { 
		padding: 1rem; 
		width: 90%;
	}
	
	h3 { font-size: 1.1rem; }
}

@media (max-width: 480px) {
	.logo-footer {
		bottom: 10px;
		right: 10px;
	}
	
	.logo-footer img {
		width: 80px; /* Más pequeño para que no tape los resultados de la consulta */
		opacity: 0.8; /* Un poco de transparencia para no distraer en móviles */
	}
	
	.check-badge {				
		width: 30px;
		height: 30px;
		/* Mantenemos el centrado en la esquina */
		top: 0;
		right: 0;
		transform: translate(50%, -50%);
	}
	
	.check-badge img {
		width: 15px;
		height: 15px;
	}
	
	.container {
		width: 90%;
	}
	
	.mensaje-alerta {
        font-size: 0.85rem;
        padding: 10px 15px;
    }
	
	.loading-container {
        padding: 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 600px) {
	.deudas-header { flex-direction: column; align-items: flex-start; gap: 10px; }
	
	.year-summary { flex-direction: column; }
	
	.info-colegiado p {
		flex-direction: column; /* En móviles, la etiqueta arriba y el dato abajo */
	}
	
	.info-colegiado p strong {
		width: 95%;
		margin-bottom: 2px;
	}
	
	.container {
		width: 90%;
	}
}
