/* ==========================================================================
   FCCCM TOPigeon Results — Frontend CSS
   ========================================================================== */

.topigeon-results-container {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
	font-size: 14px;
	color: #1a1a1a;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0,0,0,.07);
	margin-bottom: 1.5em;
}

/* ---- Header ---- */
.topigeon-header {
	background: linear-gradient(135deg, #1a365d 0%, #2d5498 100%);
	color: #fff;
	padding: 8px 16px;
}

.topigeon-title-row {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 4px;
}

.topigeon-race-title {
	font-size: 15px;
	font-weight: 700;
	margin: 0;
	color: #fff;
}

.topigeon-live-badge { display: none; }
.topigeon-pulse      { display: none; }

.topigeon-meta-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 11px;
	opacity: .85;
}

.topigeon-count-num {
	font-size: 15px;
	font-weight: 700;
	margin-right: 3px;
	opacity: 1;
	color: #fff;
}

.topigeon-update-info {
	display: flex;
	flex-direction: column;
	gap: 1px;
	line-height: 1.3;
}

/* ---- Controls ---- */
.topigeon-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	padding: 10px 16px;
	background: #f8fafc;
	border-bottom: 1px solid #e2e8f0;
}

.topigeon-controls-left,
.topigeon-controls-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.topigeon-search {
	padding: 6px 10px;
	border: 1px solid #cbd5e0;
	border-radius: 6px;
	font-size: 13px;
	width: 200px;
	background: #fff;
	transition: border-color .15s;
}

.topigeon-search:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

.topigeon-controls select {
	padding: 6px 10px;
	border: 1px solid #cbd5e0;
	border-radius: 6px;
	font-size: 13px;
	background: #fff;
	cursor: pointer;
}

/* ---- Botones ---- */
.topigeon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 32px;
	padding: 0 14px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	border: 1px solid transparent;
	transition: all .15s;
	background: #fff;
	color: #374151;
	border-color: #d1d5db;
	white-space: nowrap;
	box-sizing: border-box;
}

.topigeon-btn:hover:not(:disabled) {
	background: #f3f4f6;
}

.topigeon-btn:disabled {
	opacity: .5;
	cursor: not-allowed;
}

.topigeon-btn-refresh {
	border-color: #2d5498;
	color: #2d5498;
}

.topigeon-btn-refresh:hover:not(:disabled) {
	background: #eff6ff;
}

.topigeon-btn-toggle-auto[data-active="1"] {
	background: #ecfdf5;
	border-color: #059669;
	color: #065f46;
}

.topigeon-btn-toggle-auto[data-active="0"] {
	background: #fef3c7;
	border-color: #d97706;
	color: #92400e;
}

.topigeon-btn-download-csv {
	background: #f0fff4;
	border-color: #22c55e;
	color: #15803d;
}

.topigeon-btn-download-csv:hover:not(:disabled) {
	background: #dcfce7;
}

/* ---- Tabla ---- */
.topigeon-table-wrapper {
	overflow-x: auto;
	margin-top: 0;
	padding-top: 0;
}

.topigeon-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 40px 20px;
	color: #6b7280;
}

.topigeon-spinner {
	width: 24px;
	height: 24px;
	border: 3px solid #e5e7eb;
	border-top-color: #2d5498;
	border-radius: 50%;
	animation: topigeon-spin .7s linear infinite;
}

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

.topigeon-error-msg {
	margin: 16px;
	padding: 12px 16px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 6px;
	color: #b91c1c;
	font-size: 13px;
}

.topigeon-no-data {
	padding: 40px 20px;
	text-align: center;
	color: #9ca3af;
	font-style: italic;
}

.topigeon-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.topigeon-table thead th {
	background: #f8fafc;
	border-bottom: 2px solid #e2e8f0;
	padding: 10px 12px;
	text-align: left;
	font-weight: 600;
	color: #374151;
	white-space: nowrap;
	position: sticky;
	top: 0;
	z-index: 1;
}

.topigeon-table thead th.sortable {
	cursor: pointer;
	user-select: none;
}

.topigeon-table thead th.sortable:hover {
	background: #edf2f7;
}

.topigeon-table thead th.sort-asc  .sort-icon::after { content: ' ↑'; }
.topigeon-table thead th.sort-desc .sort-icon::after { content: ' ↓'; }

.topigeon-table tbody tr {
	border-bottom: 1px solid #f1f5f9;
	transition: background .1s;
}

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

.topigeon-table tbody tr:nth-child(even) {
	background: #fafafa;
}

.topigeon-table tbody tr:nth-child(even):hover {
	background: #f0f4f8;
}

.topigeon-table td {
	padding: 9px 12px;
	vertical-align: middle;
	color: #374151;
}

.topigeon-table .col-rank {
	font-weight: 700;
	color: #2d5498;
	width: 55px;
	text-align: center;
}

.topigeon-table .col-ring {
	font-family: monospace;
	font-size: 12px;
	white-space: nowrap;
}

.topigeon-table .col-loft small {
	display: block;
	color: #9ca3af;
	font-size: 11px;
}

.topigeon-table .col-arrival {
	font-family: monospace;
	font-size: 12px;
	white-space: nowrap;
}

.topigeon-table .col-velocity {
	font-weight: 600;
	color: #059669;
}

.topigeon-table .col-flighttime {
	font-family: monospace;
	font-size: 12px;
}

.topigeon-table .col-dist {
	color: #6b7280;
	font-size: 12px;
}

.topigeon-table .col-release {
	font-size: 12px;
	color: #4b5563;
}

.topigeon-table .col-ring small.pring {
	display: block;
	font-size: 10px;
	color: #9ca3af;
}

/* ---- Filas nuevas ---- */
.topigeon-row-new {
	animation: topigeon-highlight 3s ease-out;
}

@keyframes topigeon-highlight {
	0%   { background: #fef9c3; }
	100% { background: transparent; }
}

.topigeon-new-badge {
	display: inline-block;
	background: #22c55e;
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: .05em;
	padding: 1px 5px;
	border-radius: 999px;
	vertical-align: middle;
	text-transform: uppercase;
	margin-left: 4px;
}

/* ---- Footer ---- */
.topigeon-footer {
	padding: 8px 16px;
	background: #f8fafc;
	border-top: 1px solid #e2e8f0;
	color: #9ca3af;
}

.topigeon-footer a {
	color: #2d5498;
	text-decoration: none;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
	.topigeon-controls {
		flex-direction: column;
		align-items: stretch;
	}
	.topigeon-controls-left,
	.topigeon-controls-right {
		flex-direction: column;
	}
	.topigeon-search {
		width: 100%;
	}
	.topigeon-controls select {
		width: 100%;
	}
	.topigeon-meta-row {
		flex-direction: column;
		align-items: flex-start;
	}
	.topigeon-table .col-device,
	.topigeon-table .col-color,
	.topigeon-table .col-dist,
	.topigeon-table .col-release {
		display: none;
	}
}
