/**
 * Public Styles
 *
 * @package ABLD_Ranking
 */

/* ==========================================================================
   Selector
   ========================================================================== */

.abld-ranking-selector {
	max-width: 800px;
	margin: 0 auto 40px;
	padding: 0px;
	background: #fff;
}

.abld-selector-steps {
	margin-bottom: 30px;
}

.abld-selector-step {
	margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    padding: 30px;
    background: #dddddd30;
    border: 1px solid #dddddd59;
    border-radius: 8px; 
}

.abld-selector-step:last-child {
}

.abld-step-title {
	font-size: 20px;
	font-weight: 600;
	margin: 0 0 20px;
	color: #1d2327;
}

.abld-selector-buttons {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 15px;
}

.abld-selector-btn {
	padding: 15px 20px;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	background: #f0f6fc;
	border: none !important;
	border-radius: 6px;
	color: #d7b56d;
	cursor: pointer;
	transition: all 0.3s ease;
}

.abld-selector-btn:hover {
	background: #d7b56d;
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.abld-selector-btn:focus {
	/* outline: none !important; */
	/* outline-offset: 2px; */
}

.abld-selector-btn.selected {
	background: #d7b56d;
	color: #fff;
}

.abld-no-options {
	text-align: center;
	color: #646970;
	font-style: italic;
	padding: 20px;
	background: #f6f7f7;
	border-radius: 6px;
}

/* Step Actions - Buttons aligned to the right */
.abld-step-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid #e8e8e8;
}

.abld-next-btn,
.abld-submit-btn {
	padding: 12px 30px;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	background: #d7b56d !important;
	border: none;
	border-radius: 6px;
	color: #fff;
	cursor: pointer;
	transition: all 0.3s ease;
	min-width: 150px;
	box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

.abld-next-btn:hover,
.abld-submit-btn:hover {
	background: #a37c2a !important;
	border-color: none;
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
}

.abld-next-btn:focus,
.abld-submit-btn:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.abld-submit-btn {
	background: #00a32a;
	border-color: #00a32a;
	box-shadow: 0 2px 4px rgba(0, 163, 42, 0.2);
}

.abld-submit-btn:hover {
	background: #007a20;
	border-color: #007a20;
	box-shadow: 0 4px 8px rgba(0, 163, 42, 0.3);
}

.abld-submit-btn:focus {
	outline-color: #00a32a;
}

.abld-loading-options {
	text-align: center;
	color: #646970;
	font-style: italic;
	padding: 20px;
	background: #f6f7f7;
	border-radius: 6px;
	margin: 0;
}

/* Selector Summary */
.abld-selector-summary {
	background: #f0f6fc;
	/* border: 2px solid #2c3e50; */
	border-radius: 6px;
	padding: 20px;
	margin-top: 20px;
	display: none;
}

.abld-selector-summary h4 {
	margin: 0 0 15px;
	font-size: 18px;
	color: #2c3e50;
}

.abld-selected-values {
	list-style: none;
	padding: 0;
	margin: 0 0 20px;
}

.abld-selected-values li {
	padding: 8px 0;
	border-bottom: 1px solid #d0e4f5;
	font-size: 15px;
}

.abld-selected-values li:last-child {
	border-bottom: none;
}

.abld-selected-values strong {
	display: inline-block;
	min-width: 100px;
	color: #1d2327;
}

#abld-reset-selection {
	width: 100%;
	padding: 12px;
	font-size: 16px;
	background: #fff;
	border: 2px solid #2c3e50;
	color: #2c3e50;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.3s ease;
}

#abld-reset-selection:hover {
	background: #f0f6fc;
}

/* ==========================================================================
   Table
   ========================================================================== */

.abld-ranking-table-wrapper {
	margin: 40px 0;
}

.abld-active-filters {
	/* background: #f0f6fc; */
	/* border-left: 4px solid #2c3e50; */
	/* padding: 20px; */
	margin-bottom: 30px;
	/* border-radius: 4px; */
}

.abld-active-filters h4 {
	margin: 0 0 15px;
	font-size: 18px;
	color: #2c3e50;
}

.abld-active-filters ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
}

.abld-active-filters li {
	background: #fff;
	padding: 8px 15px;
	border-radius: 20px;
	border: 1px solid #2c3e50;
	font-size: 14px;
}

.abld-active-filters strong {
	color: #1d2327;
	margin-right: 5px;
}

/* Table Container */
.abld-ranking-table-container {
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
}

.abld-ranking-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	margin: 0;
}

/* Remove all cell borders */
.abld-ranking-table td,
.abld-ranking-table th {
	border: none !important;
	border-left: none !important;
	border-right: none !important;
	border-top: none !important;
}

.abld-ranking-table thead {
	background: #2c3e50;
	color: #fff;
}

.abld-ranking-table th {
	padding: 15px;
	text-align: left;
	font-weight: 600;
	font-size: 15px;
	border: none;
}

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

.abld-ranking-table th.abld-sortable:hover {
	background: #34495e;
}

.abld-ranking-table th.abld-sortable a {
	color: #fff;
	text-decoration: none;
	display: flex;
	align-items: center;
	gap: 8px;
}

.abld-ranking-table th.abld-sortable .abld-sort-arrow {
	display: inline-block;
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-bottom: 5px solid rgba(255, 255, 255, 0.3);
	transition: all 0.2s ease;
}

.abld-ranking-table th.abld-sorted.abld-asc .abld-sort-arrow {
	border-bottom: 5px solid #fff;
	transform: rotate(0deg);
}

.abld-ranking-table th.abld-sorted.abld-desc .abld-sort-arrow {
	border-bottom: none;
	border-top: 5px solid #fff;
	transform: rotate(180deg);
}

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

.abld-ranking-table tbody tr:hover {
	background: #f8f9fa;
}

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

.abld-ranking-table td {
	padding: 15px;
	font-size: 15px;
	color: #1d2327;
	border: none;
}

.abld-ranking-table .abld-position {
	font-weight: 700;
	font-size: 18px;
	color: #2c3e50;
	text-align: center;
	width: 80px;
}

.abld-ranking-table .abld-competitor {
	font-weight: 600;
}

.abld-ranking-table .abld-earnings {
	font-weight: 600;
	color: #00a32a;
	text-align: right;
}

/* No Results */
.abld-no-results {
	text-align: center;
	padding: 60px 20px;
	background: #f6f7f7;
	border-radius: 8px;
}

.abld-no-results p {
	font-size: 18px;
	color: #646970;
	margin: 0;
}

/* ==========================================================================
   Totals Box
   ========================================================================== */

.abld-totals-box {
	margin: 30px 0;
	padding: 20px;
	background: #f8f9fa;
	border: 2px solid #0073aa;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
}

.abld-totals-content {
	display: flex;
	justify-content: space-around;
	align-items: center;
	flex-wrap: wrap;
	gap: 20px;
}

.abld-total-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.abld-total-label {
	font-size: 14px;
	font-weight: 600;
	color: #555;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.abld-total-value {
	font-size: 24px;
	font-weight: 700;
	color: #0073aa;
}

@media (max-width: 768px) {
	.abld-totals-content {
		flex-direction: column;
		gap: 15px;
	}
	
	.abld-total-value {
		font-size: 20px;
	}
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.abld-pagination {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px;
	background: #f8f9fa;
	border-top: 1px solid #ddd;
	flex-wrap: wrap;
	gap: 15px;
}

.abld-pagination-info {
	font-size: 14px;
	color: #646970;
}

.abld-pagination-links {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.abld-page-link {
	display: inline-block;
	padding: 8px 12px;
	min-width: 40px;
	text-align: center;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	color: #2c3e50;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s ease;
}

.abld-page-link:hover {
	background: #2c3e50;
	border-color: #2c3e50;
	color: #fff !important;
}

.abld-page-link.abld-current-page {
	background: #2c3e50;
	border-color: #2c3e50;
	color: #fff;
	pointer-events: none;
}

.abld-first-page,
.abld-last-page,
.abld-prev-page,
.abld-next-page {
	font-weight: 600;
}

/* ==========================================================================
   Detail Views (Animal / Competidor)
   ========================================================================== */

.abld-detail-wrapper {
	margin: 40px 0;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
	padding: 30px;
}

.abld-detail-header {
	margin-bottom: 25px;
}

.abld-detail-title {
	margin: 0 0 10px;
	font-size: 26px;
	color: #1d2327;
}

.abld-detail-subtitle {
	margin: 0;
	color: #646970;
	font-size: 15px;
}

.abld-detail-filters {
	margin-bottom: 25px;
}

.abld-detail-filter-form {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.abld-detail-filter-form select {
	min-width: 220px;
	padding: 6px 10px;
	border-radius: 4px;
	border: 1px solid #ccd0d4;
	font-size: 14px;
}

.abld-detail-table-wrapper {
	overflow-x: auto;
}

.abld-detail-table {
	width: 100%;
	border-collapse: collapse;
}

.abld-detail-table thead {
	background: #2c3e50;
	color: #fff;
}

.abld-detail-table th,
.abld-detail-table td {
	padding: 14px 16px;
	border-bottom: 1px solid #e5e5e5;
	text-align: left;
	font-size: 15px;
}

.abld-detail-table tbody tr:hover {
	background: #f8f9fa;
}

.abld-detail-table tfoot {
	background: #f0f6fc;
	font-weight: 700;
}

.abld-align-right {
	text-align: right;
}

.abld-detail-empty,
.abld-detail-error {
	padding: 40px 20px;
	text-align: center;
	background: #f6f7f7;
	border-radius: 8px;
	color: #646970;
	font-size: 16px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 768px) {
	.abld-ranking-selector {
		padding: 20px;
	}

	.abld-selector-buttons {
		grid-template-columns: 1fr;
	}

	.abld-ranking-table-container {
		overflow-x: auto;
	}

	.abld-ranking-table {
		min-width: 600px;
	}

	.abld-pagination {
		flex-direction: column;
		text-align: center;
	}

	.abld-active-filters ul {
		flex-direction: column;
	}
}

@media screen and (max-width: 480px) {
	.abld-step-title {
		font-size: 18px;
	}

	.abld-selector-btn {
		padding: 12px 15px;
		font-size: 14px;
	}

	.abld-ranking-table th,
	.abld-ranking-table td {
		padding: 10px;
		font-size: 14px;
	}

	.abld-page-link {
		padding: 6px 10px;
		min-width: 35px;
		font-size: 13px;
	}
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus styles for keyboard navigation */
.abld-selector-btn:focus-visible,
.abld-page-link:focus-visible,
#abld-reset-selection:focus-visible {
	outline: 3px solid #2c3e50;
	outline-offset: 2px;
}

/* Skip link for screen readers */
.abld-skip-link {
	position: absolute;
	top: -40px;
	left: 0;
	background: #2c3e50;
	color: #fff;
	padding: 8px;
	text-decoration: none;
	z-index: 100;
}

.abld-skip-link:focus {
	top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.abld-selector-btn,
	.abld-page-link {
		border-width: 3px;
	}

	.abld-ranking-table thead {
		font-weight: 700;
	}
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
	.abld-selector-btn,
	.abld-page-link,
	.abld-ranking-table tbody tr,
	#abld-reset-selection {
		transition: none;
	}

	.abld-selector-btn:hover {
		transform: none;
	}
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.abld-loading-overlay {
	position: relative;
	pointer-events: none;
	opacity: 0.6;
}

.abld-loading-overlay::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 4px solid #f3f3f3;
	border-top-color: #2c3e50;
	border-radius: 50%;
	animation: abld-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
	.abld-ranking-selector,
	.abld-pagination,
	.abld-active-filters {
		display: none;
	}

	.abld-ranking-table {
		border: 1px solid #000;
	}

	.abld-ranking-table th {
		background: #f0f0f0 !important;
		color: #000 !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}

/* ==========================================================================
   Filter Dropdowns
   ========================================================================== */

.abld-filter-dropdowns {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
}

.abld-filter-dropdown {
	position: relative;
	display: inline-block;
}

.abld-filter-btn {
	background-color: #ffffff !important;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 35px 12px 16px !important; 
    font-size: 14px !important;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    transition: all 0.2s ease;
    min-width: 150px;
    color: #333 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

.abld-filter-btn:hover {
	background: #f8f9fa !important;
	border-color: #d0d0d0;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.abld-filter-btn.active {
	background: #f8f9fa !important;
	border-color: #d0d0d0;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.abld-filter-label {
	font-weight: 400;
    color: #999;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.abld-filter-btn:hover .abld-filter-label,
.abld-filter-btn.active .abld-filter-label {
	color: #999;
}

.abld-filter-value {
	flex: 1;
	text-align: left;
	font-weight: 600;
	color: #333;
	font-size: 14px;
	line-height: 1.3;
}

.abld-filter-arrow {
	transition: transform 0.3s ease;
	font-size: 10px;
	color: #666;
	position: absolute;
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
	line-height: 1;
}

.abld-filter-btn.active .abld-filter-arrow {
	transform: translateY(-50%) rotate(180deg);
}

.abld-filter-options {
	position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #eaecef;
    border-radius: 8px;
    box-shadow: 2px 5px 16px 6px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.abld-filter-dropdown.active .abld-filter-options {
	display: block;
}

.abld-filter-option {
	display: block;
    padding: 12px 16px !important;
    color: #495057 !important;
    text-decoration: none !important;
    border-bottom: 1px solid #e9ecef !important;
    transition: background-color 0.2s ease;
    font-size: 13px;
    font-weight: 600 !important;
}

.abld-filter-option:last-child {
	border-bottom: none;
}

.abld-filter-option:hover {
	background-color: #f8f9fa;
}

.abld-filter-option.current {
	background-color: #e3f2fd;
	color: #1976d2;
	font-weight: bold;
}

.abld-filter-option-wrapper {
	position: relative;
}

.abld-filter-option-text {
	flex: 1;
	display: inline-block;
}

.abld-filter-remove-item {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
	height: 20px;
	line-height: 18px;
	text-align: center;
	font-size: 18px;
	font-weight: bold;
	color: #dc3545;
	cursor: pointer;
	border-radius: 50%;
	background: rgba(220, 53, 69, 0.1);
	transition: all 0.2s ease;
}

.abld-filter-remove-item:hover {
	background: rgba(220, 53, 69, 0.2);
	color: #c82333;
	transform: translateY(-50%) scale(1.1);
}

.abld-filter-option.current {
	position: relative;
	padding-right: 40px !important;
}

.abld-filter-option.remove {
	color: #dc3545 !important;
    border-top: 2px solid #e9ecef;
    font-weight: bold !important;
    font-size: 11px;
    text-transform: uppercase;
}

.abld-filter-option.remove:hover {
	background-color: #f8d7da;
}

/* Group By Dropdown - Special styling */
.abld-group-by-dropdown {
	position: relative;
	display: inline-block;
}

.abld-group-by-btn {
	background-color: #e3f2fd !important;
	border: 1px solid #90caf9 !important;
}

.abld-group-by-btn:hover {
	background: #bbdefb !important;
	border-color: #64b5f6 !important;
}

.abld-group-by-btn.active {
	background: #bbdefb !important;
	border-color: #64b5f6 !important;
}

.abld-group-by-btn .abld-filter-label {
	color: #1976d2;
	font-weight: 500;
}

.abld-group-by-btn .abld-filter-value {
	color: #0d47a1;
	font-weight: 700;
}

/* ==========================================================================
   Search
   ========================================================================== */

.abld-search-wrapper {
	margin: 40px 0;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
	padding: 30px;
}

.abld-search-form {
	margin-bottom: 30px;
}

.abld-search-fields {
	display: flex;
	gap: 10px;
	flex-wrap: nowrap;
	align-items: center;
}

.abld-search-input {
	flex: 1;
	min-width: 0;
	padding: 11px 15px !important;
	border: 1px solid #ddd !important;
	border-radius: 6px !important;
	font-size: 15px;
	transition: border-color 0.3s ease !important;
}

.abld-search-input:focus {
	outline: none;
	border-color: #2c3e50;
}

.abld-search-select {
	min-width: 180px;
	max-width: 220px;
	padding: 12px 15px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 15px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.3s ease;
	flex-shrink: 0;
}

.abld-search-select:focus {
	outline: none;
	border-color: #2c3e50;
}

.abld-search-submit {
	padding: 12px 30px;
	background: #2c3e50;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.3s ease;
	white-space: nowrap;
	flex-shrink: 0;
}

.abld-search-submit:hover {
	background: #34495e;
}

.abld-search-submit:focus {
	outline: 2px solid #2c3e50;
	outline-offset: 2px;
}

.abld-search-results {
	margin-top: 30px;
	padding-top: 30px;
	border-top: 1px solid #e8e8e8;
}

.abld-search-loading {
	text-align: center;
	padding: 20px;
	color: #646970;
}

.abld-search-results-list {
	margin-top: 20px;
}

.abld-search-results-items {
	list-style: none;
	padding: 0;
	margin: 0;
}

.abld-search-result-item {
	padding: 12px 0;
	border-bottom: 1px solid #e8e8e8;
}

.abld-search-result-item:last-child {
	border-bottom: none;
}

.abld-search-result-link {
	color: #2c3e50;
	text-decoration: none;
	font-size: 16px;
	font-weight: 500;
	transition: color 0.2s ease;
	display: block;
}

.abld-search-result-link:hover {
	color: #34495e;
	text-decoration: underline;
}

.abld-search-results-count {
	margin-top: 20px;
	padding-top: 15px;
	border-top: 1px solid #e8e8e8;
	color: #646970;
	font-size: 14px;
	text-align: center;
}

.abld-search-no-results,
.abld-search-error {
	text-align: center;
	padding: 30px;
	color: #646970;
	font-size: 16px;
}

.abld-search-error {
	color: #dc3545;
}

@media screen and (max-width: 768px) {
	.abld-search-fields {
		flex-wrap: wrap;
	}

	.abld-search-input {
		flex: 1 1 100%;
		min-width: 100%;
	}

	.abld-search-select {
		flex: 1 1 calc(50% - 5px);
		min-width: calc(50% - 5px);
		max-width: none;
	}

	.abld-search-submit {
		flex: 1 1 calc(50% - 5px);
		min-width: calc(50% - 5px);
	}
}

@media screen and (max-width: 480px) {
	.abld-search-fields {
		flex-direction: column;
	}

	.abld-search-input,
	.abld-search-select,
	.abld-search-submit {
		width: 100%;
		flex: 1 1 100%;
		min-width: 100%;
		max-width: 100%;
	}
}

