/* Foundations Section */
.foundations-section {
	background-color: #FFFFFF;
	padding: 60px 0 70px;
}

/* Estilo titulo y subtitulo alineado con archive-noticias-foundations */
.fundaciones-search-title {
	font-size: 56px;
	font-weight: 700;
	color: #1A1A1A;
	margin: 0 0 16px 0;
	line-height: 1.1;
}

.fundaciones-search-subtitle {
	font-size: 18px;
	line-height: 1.6;
	color: #666666;
	margin: 0 0 48px 0;
}

.fundaciones-search-subtitle p {
	margin: 0 0 1em 0;
}

.fundaciones-search-subtitle p:last-child {
	margin-bottom: 0;
}

/* Bloque de enlaces por comunidad autonoma */
.foundations-autonomy-links {
	margin-bottom: 32px;
}

.foundations-autonomy-links-title {
	font-size: 18px;
	font-weight: 600;
	color: #1A1A1A;
	margin: 0 0 12px 0;
	line-height: 1.3;
}

.foundations-autonomy-links-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.foundations-autonomy-links-list li {
	margin: 0;
}

.foundations-autonomy-link {
	font-size: 15px;
	color: #0070C1;
	text-decoration: none;
	transition: color 0.2s ease, text-decoration 0.2s ease;
}

.foundations-autonomy-link:hover {
	color: #005a9e;
	text-decoration: underline;
}

/* Form */
.foundations-form {
	background-color: #F8F9FA;
	border-radius: 20px;
	padding: 32px 36px;
	margin-bottom: 50px;
	width: 100%;
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.03);
}

.form-row {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 20px;
	margin-bottom: 20px;
}

.form-row-three {
	grid-template-columns: repeat(3, 1fr);
}

.form-row-two {
	grid-template-columns: repeat(2, 1fr);
}

.form-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.form-label {
	font-size: 14px;
	font-weight: 500;
	color: #1A1A1A;
}

.form-select {
	padding: 12px 16px;
	border: 1px solid #D1D5DB;
	border-radius: 6px;
	font-size: 14px;
	color: #1A1A1A;
	background-color: #FFFFFF;
	cursor: pointer;
	transition: border-color 0.2s ease;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
}

.form-select:hover {
	border-color: #0070C1;
}

.form-select:focus {
	outline: none;
	border-color: #0070C1;
	box-shadow: 0 0 0 3px rgba(0, 112, 193, 0.1);
}

/* Input de texto para nombre de fundación */
.form-input {
	padding: 12px 16px;
	border: 1px solid #D1D5DB;
	border-radius: 6px;
	font-size: 14px;
	color: #1A1A1A;
	background-color: #FFFFFF;
	transition: border-color 0.2s ease;
	width: 100%;
}

.form-input:hover {
	border-color: #0070C1;
}

.form-input:focus {
	outline: none;
	border-color: #0070C1;
	box-shadow: 0 0 0 3px rgba(0, 112, 193, 0.1);
}

.foundation-name-field {
	position: relative;
}

.foundation-name-wrapper {
	position: relative;
}

.foundation-name-suggestions {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background-color: #FFFFFF;
	border: 1px solid #D1D5DB;
	border-radius: 6px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
	max-height: 300px;
	overflow-y: auto;
	z-index: 1000;
	margin-top: 4px;
}

.suggestion-item {
	padding: 12px 16px;
	cursor: pointer;
	border-bottom: 1px solid #F3F4F6;
	transition: background-color 0.2s ease;
	font-size: 14px;
	color: #1A1A1A;
}

.suggestion-item:last-child {
	border-bottom: none;
}

.suggestion-item:hover {
	background-color: #F8F9FA;
}

.suggestion-item mark {
	background-color: #FFF4CD;
	color: #1A1A1A;
	font-weight: 600;
	padding: 0;
}

.suggestion-empty {
	color: #666666;
	cursor: default;
	font-style: italic;
}

.suggestion-empty:hover {
	background-color: transparent;
}

.form-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.form-toggle {
	display: flex;
	align-items: center;
	gap: 12px;
}

.toggle-label {
	font-size: 14px;
	font-weight: 500;
	color: #1A1A1A;
}

.toggle-switch {
	position: relative;
	display: inline-block;
	width: 48px;
	height: 24px;
	cursor: pointer;
}

.toggle-input {
	opacity: 0;
	width: 0;
	height: 0;
}

.toggle-slider {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #D1D5DB;
	border-radius: 24px;
	transition: background-color 0.3s ease;
}

.toggle-slider:before {
	content: "";
	position: absolute;
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background-color: #FFFFFF;
	border-radius: 50%;
	transition: transform 0.3s ease;
}

.toggle-input:checked+.toggle-slider {
	background-color: #0070C1;
}

.toggle-input:checked+.toggle-slider:before {
	transform: translateX(24px);
}

.btn-search {
	padding: 12px 32px;
	background-color: #0070C1;
	color: #FFFFFF;
	border: none;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.5px;
	cursor: pointer;
	transition: background-color 0.3s ease;
}

.btn-search:hover {
	background-color: #005A9C;
}

/* Tag de grupo */
.foundations-group-tag {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px 16px;
	border-radius: 999px;
	background-color: #0070C1;
	color: #FFFFFF;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 16px;
}

.foundations-group-tag[hidden] {
	display: none;
}

.foundations-group-tag-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

.foundations-group-tag-icon svg {
	width: 20px;
	height: 20px;
	display: block;
}

.foundations-group-tag-icon svg path {
	stroke: #FFFFFF;
}

/* Results */
.foundations-results {
	background-color: #FFFFFF;
	border-radius: 8px;
	padding: 32px;
}

.results-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 24px;
	padding-bottom: 20px;
	border-bottom: 1px solid #E5E5E5;
	min-height: 60px;
}

.results-title {
	font-size: 18px;
	font-weight: 700;
	color: #1A1A1A;
	margin: 0;
}


.results-list {
	margin-bottom: 32px;
	min-height: 100px;
}

.foundations-results:not(.has-results) .results-list {
	display: none;
}

/* Estilos de tabla */
.results-table {
	width: 100%;
	border-collapse: collapse;
	background-color: #FFFFFF;
}

.results-table thead {
	background-color: #FFFFFF;
	border-bottom: 2px solid #E5E5E5;
}

.results-table th {
	padding: 16px 20px;
	text-align: left;
	font-size: 14px;
	font-weight: 700;
	color: #1A1A1A;
	white-space: nowrap;
}

.results-table th.sortable {
	cursor: pointer;
	user-select: none;
	position: relative;
	transition: background-color 0.2s ease;
}

.results-table th.sortable:hover {
	background-color: #F8F9FA;
}

.results-table th .sort-icon {
	display: inline-flex;
	align-items: center;
	margin-left: 8px;
	vertical-align: middle;
	color: #666666;
}

.results-table th .sort-icon svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.results-table th.sortable:hover .sort-icon {
	color: #0070C1;
}

.results-table tbody tr {
	border-bottom: 1px solid #F3F4F6;
	transition: background-color 0.2s ease;
}

.results-table tbody tr:nth-child(even) {
	background-color: #FAFAFA;
}

.results-table tbody tr:hover {
	background-color: #F8F9FA;
}

.results-table tbody tr:last-child {
	border-bottom: none;
}

.results-table td {
	padding: 16px 20px;
	font-size: 14px;
	color: #1A1A1A;
	vertical-align: middle;
}

.result-link {
	font-size: 16px;
	font-weight: 500;
	color: #0070C1;
	text-decoration: none;
	transition: color 0.3s ease;
	flex: 1;
}

.result-link:hover {
	color: #005A9C;
	text-decoration: underline;
}

.foundation-siglas {
	font-size: 0.9em;
	color: #6b7280;
	font-weight: 400;
}

.result-info {
	display: flex;
	align-items: center;
	gap: 16px;
}

.result-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0;
	font-size: 13px;
	font-weight: 500;
	color: #0070C1;
}

.result-badge-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	flex-shrink: 0;
}

.result-badge-icon svg {
	width: 24px;
	height: 24px;
	display: block;
}

.result-badge-text {
	line-height: 1.2;
}

.result-detail {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #666666;
}

.result-detail-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.result-detail-icon svg {
	width: 16px;
	height: 16px;
	display: block;
}

.result-detail-text {
	line-height: 1.2;
}

.results-top-bar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 16px;
	margin-bottom: 20px;
}

.foundations-results:not(.has-results) .results-top-bar {
	display: none;
}

.results-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 20px;
	border-top: 1px solid #E5E5E5;
	margin-bottom: 32px;
	min-height: 60px;
}

.foundations-results:not(.has-results) .results-footer {
	display: none;
}

.results-count {
	font-size: 14px;
	color: #666666;
	margin: 0;
}

.btn-export {
	padding: 10px 24px;
	background-color: #FFFFFF;
	color: #0070C1;
	border: 2px solid #0070C1;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.5px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.btn-export:hover {
	background-color: #0070C1;
	color: #FFFFFF;
}

/* Pagination */
.pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	min-height: 36px;
}

.foundations-results:not(.has-results) .pagination {
	display: none;
}

.pagination-btn {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid #D1D5DB;
	border-radius: 6px;
	background-color: #FFFFFF;
	color: #666666;
	cursor: pointer;
	transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
	border-color: #0070C1;
	color: #0070C1;
}

.pagination-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.pagination-number {
	min-width: 36px;
	height: 36px;
	padding: 0 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid #D1D5DB;
	border-radius: 6px;
	background-color: #FFFFFF;
	color: #666666;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.3s ease;
}

.pagination-number:hover {
	border-color: #0070C1;
	color: #0070C1;
}

.pagination-number.active {
	background-color: #0070C1;
	border-color: #0070C1;
	color: #FFFFFF;
}

.pagination-dots {
	color: #666666;
	font-size: 14px;
	padding: 0 4px;
}

/* Spinner de carga (como search-results) */
.foundations-results.is-loading .results-footer,
.foundations-results.is-loading .results-top-bar,
.foundations-results.is-loading .pagination {
	display: none;
}

.search-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 20px;
	gap: 16px;
}

.search-loading-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid #E5E7EB;
	border-top-color: #1d4ed8;
	border-radius: 50%;
	animation: foundations-spin 0.8s linear infinite;
}

.search-loading-text {
	color: #64748b;
	font-size: 15px;
	font-weight: 500;
	margin: 0;
}

@keyframes foundations-spin {
	to { transform: rotate(360deg); }
}

/* Loading state */
.loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Responsive */
@media (max-width: 1024px) {
	.foundations-section {
		padding: 60px 0;
	}

	.fundaciones-search-title {
		font-size: 48px;
		margin-bottom: 32px;
	}

	.form-row {
		grid-template-columns: repeat(2, 1fr);
	}

	.results-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}
}

@media (max-width: 768px) {
	.foundations-section {
		padding: 40px 0;
	}

	.fundaciones-search-title {
		font-size: 40px;
		margin-bottom: 24px;
	}

	.foundations-form {
		padding: 24px;
		margin-bottom: 40px;
	}

	.form-row {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.form-actions {
		flex-direction: column;
		gap: 16px;
		align-items: stretch;
	}

	.btn-search {
		width: 100%;
	}

	.foundations-results {
		padding: 24px;
	}

	.results-table {
		font-size: 13px;
	}

	.results-table th,
	.results-table td {
		padding: 12px 16px;
	}

	.results-table th {
		font-size: 13px;
	}

	.results-footer {
		flex-direction: column;
		gap: 16px;
		align-items: stretch;
	}

	.btn-export {
		width: 100%;
	}
}

@media (max-width: 480px) {
	.foundations-section {
		padding: 32px 0;
	}

	.fundaciones-search-title {
		font-size: 32px;
		margin-bottom: 20px;
	}

	.foundations-form {
		padding: 20px;
	}

	.foundations-results {
		padding: 20px;
	}

	.results-table {
		font-size: 12px;
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.results-table thead,
	.results-table tbody,
	.results-table tr,
	.results-table th,
	.results-table td {
		display: block;
	}

	.results-table thead {
		display: none;
	}

	.results-table tbody tr {
		display: block;
		margin-bottom: 16px;
		border: 1px solid #E5E5E5;
		border-radius: 6px;
		padding: 12px;
		background-color: #FFFFFF;
	}

	.results-table tbody tr:nth-child(even) {
		background-color: #FAFAFA;
	}

	.results-table td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 8px 0;
		border-bottom: 1px solid #F3F4F6;
	}

	.results-table td:last-child {
		border-bottom: none;
	}

	.results-table td:before {
		content: attr(data-label);
		font-weight: 700;
		color: #666666;
		margin-right: 12px;
	}

	.result-link {
		font-size: 15px;
	}

	.pagination {
		flex-wrap: wrap;
		gap: 6px;
	}

	.pagination-number,
	.pagination-btn {
		min-width: 32px;
		height: 32px;
	}
}
