/**
 * Ranking por Temas Styles
 * Using divs with CSS Grid instead of tables
 */

.nocorte-ranking-temas-container {
	max-width: 1200px;
	margin: 40px auto;
	padding: 0 20px;
}

.nocorte-ranking-temas-title {
	font-size: 24px;
	font-weight: 400;
	color: #3F4BFF;
	margin: 0 0 32px;
	text-align: center;
	letter-spacing: -0.5px;
}

.nocorte-ranking-temas-wrapper {
	overflow-x: auto;
	border-radius: 12px;
	background: #fff;
	min-width: 100%;
}

/* Header */
.nocorte-ranking-header {
	display: grid;
	grid-template-columns: 60px 2.5fr repeat(auto-fit, minmax(100px, 1fr));
	background: transparent;
	border-bottom: 1px solid #F0F0F0;
	width: 100%;
}

.nocorte-ranking-header-cell {
	padding: 12px 20px;
	text-align: center;
	font-size: 11px;
	font-weight: 400;
	color: #B5D0E3;
	letter-spacing: 0;
}

.nocorte-ranking-header-cell--position {
	text-align: center;
	padding: 12px 12px;
	color: #B5D0E3;
}

.nocorte-ranking-header-cell--user {
	text-align: left;
	padding: 12px 24px;
	color: #3F4BFF;
}

.nocorte-ranking-header-cell--tema {
	color: #B5D0E3;
}

.nocorte-ranking-tema-name {
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	cursor: default;
}

/* Custom Tooltip (JS controlled) */
.nocorte-ranking-tooltip {
	position: fixed;
	padding: 8px 12px;
	background: #1D1D1F;
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	z-index: 10000;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.nocorte-ranking-tooltip.visible {
	opacity: 1;
}

.nocorte-ranking-tooltip::before {
	content: '';
	position: absolute;
	top: -6px;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-bottom-color: #1D1D1F;
}

/* Body */
.nocorte-ranking-body {
	display: flex;
	flex-direction: column;
	padding: 0 8px;
}

/* Rows */
.nocorte-ranking-row {
	display: grid;
	grid-template-columns: 60px 2.5fr repeat(auto-fit, minmax(100px, 1fr));
	border-bottom: 1px solid #F5F5F5;
	transition: all 0.2s ease;
	width: 100%;
	margin: 4px 0;
	border-radius: 20px;
}

.nocorte-ranking-row:hover {
	background: #EDF3F8;
	border-bottom-color: transparent;
	margin-left: -8px;
	margin-right: -8px;
}

.nocorte-ranking-row:hover .nocorte-ranking-cell:first-child {
	padding-left: 20px;
}

.nocorte-ranking-row:hover .nocorte-ranking-cell:last-child {
	padding-right: 28px;
}

.nocorte-ranking-row--current {
	background: #EDF3F8 !important;
	border-bottom-color: transparent !important;
	margin-left: -8px;
	margin-right: -8px;
}

.nocorte-ranking-row--current .nocorte-ranking-cell:first-child {
	padding-left: 20px;
}

.nocorte-ranking-row--current .nocorte-ranking-cell:last-child {
	padding-right: 28px;
}

.nocorte-ranking-row--current:hover {
	background: #EDF3F8 !important;
}

.nocorte-ranking-row--hidden {
	display: none;
}

.nocorte-ranking-row--hidden.nocorte-ranking-row--visible {
	display: grid;
	grid-template-columns: 60px 2.5fr repeat(auto-fit, minmax(100px, 1fr));
	width: 100%;
}

/* Cells */
.nocorte-ranking-cell {
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nocorte-ranking-cell--position {
	justify-content: center;
	font-weight: 400;
	font-size: 15px;
	color: #1D1D1F;
	padding: 16px 12px;
}

.nocorte-ranking-row:nth-child(1) .nocorte-ranking-cell--position,
.nocorte-ranking-row:nth-child(2) .nocorte-ranking-cell--position,
.nocorte-ranking-row:nth-child(3) .nocorte-ranking-cell--position {
	font-weight: 700;
	font-size: 20px;
	color: #3F4BFF;
}

.nocorte-ranking-cell--user {
	justify-content: flex-start;
	padding: 16px 24px;
}

.nocorte-ranking-cell--tema {
	justify-content: center;
}

/* User info */
.nocorte-ranking-user {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	max-width: 100%;
}

.nocorte-ranking-avatar {
	width: 48px;
	height: 48px;
	border-radius: 50% !important;
	object-fit: cover;
	flex-shrink: 0;
	overflow: hidden;
	display: block;
}

.nocorte-ranking-user-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.nocorte-ranking-user-name {
	font-weight: 700;
	font-size: 14px;
	color: #1D1D1F;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.2;
}

.nocorte-ranking-user-meta {
	font-size: 11px;
	font-weight: 400;
	color: #86868B;
	line-height: 1.2;
}

/* Scores */
.nocorte-ranking-score {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	gap: 4px;
}

.nocorte-ranking-score-value {
	font-weight: 400;
	font-size: 15px;
	color: #1D1D1F;
	line-height: 1;
}

.nocorte-ranking-score-label {
	font-size: 11px;
	font-weight: 400;
	color: #86868B;
	line-height: 1;
}

/* Buttons */
.nocorte-ranking-expand-wrapper,
.nocorte-ranking-ver-mais-wrapper {
	display: flex;
	justify-content: center;
	padding: 24px 0;
}

.nocorte-ranking-expand-btn,
.nocorte-ranking-ver-mais-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0;
	background: transparent;
	border: none;
	font-size: 14px;
	font-weight: 400;
	color: #3F4BFF;
	cursor: pointer;
	transition: all 0.2s ease;
	text-decoration: underline;
}

.nocorte-ranking-expand-btn:hover,
.nocorte-ranking-ver-mais-btn:hover {
	color: #2E3CC7;
}

.nocorte-ranking-expand-icon,
.nocorte-ranking-ver-mais-btn svg {
	transition: transform 0.3s ease;
	stroke: #3F4BFF;
}

.nocorte-ranking-expand-btn:hover .nocorte-ranking-expand-icon,
.nocorte-ranking-ver-mais-btn:hover svg {
	stroke: #2E3CC7;
}

.nocorte-ranking-expand-btn[data-expanded="true"] .nocorte-ranking-expand-icon {
	transform: rotate(45deg);
}

/* Compact mode */
.nocorte-ranking-temas-container--compact {
	margin: 60px auto;
}

/* Reprovados - usuários que não atingiram nota mínima */
.nocorte-ranking-row--reprovado {
	background-color: rgba(239, 68, 68, 0.08) !important;
}

.nocorte-ranking-row--reprovado:hover {
	background-color: rgba(239, 68, 68, 0.12) !important;
}

.nocorte-ranking-row--reprovado .nocorte-ranking-user-name {
	color: #DC2626;
}

.nocorte-ranking-badge-reprovado {
	display: inline-flex;
	align-items: center;
	background: #EF4444;
	color: white;
	font-size: 10px;
	font-weight: 600;
	padding: 2px 6px;
	border-radius: 4px;
	margin-left: 8px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	flex-shrink: 0;
}

.nocorte-ranking-cell--abaixo-minimo {
	background-color: rgba(239, 68, 68, 0.15) !important;
	border-radius: 8px;
}

.nocorte-ranking-cell--abaixo-minimo .nocorte-ranking-score-value {
	color: #DC2626;
	font-weight: 700;
}

.nocorte-ranking-minimo-indicator {
	display: inline-flex;
	align-items: center;
	margin-left: 4px;
	vertical-align: middle;
	flex-shrink: 0;
}

/* Last row adjustment */
.nocorte-ranking-body .nocorte-ranking-row:last-child {
	border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
	.nocorte-ranking-temas-container {
		padding: 0;
	}

	.nocorte-ranking-temas-title {
		font-size: 20px;
		margin-bottom: 20px;
	}

	.nocorte-ranking-temas-wrapper {
		border-radius: 8px;
	}

	.nocorte-ranking-body {
		padding: 0 8px;
	}

	.nocorte-ranking-header {
		grid-template-columns: 40px 1.5fr repeat(auto-fit, minmax(60px, 1fr));
	}

	.nocorte-ranking-row,
	.nocorte-ranking-row--hidden.nocorte-ranking-row--visible {
		grid-template-columns: 40px 1.5fr repeat(auto-fit, minmax(60px, 1fr));
		margin: 2px 0;
		border-radius: 12px;
	}

	.nocorte-ranking-row:hover {
		margin-left: -8px;
		margin-right: -8px;
	}

	.nocorte-ranking-row:hover .nocorte-ranking-cell:first-child {
		padding-left: 12px;
	}

	.nocorte-ranking-row:hover .nocorte-ranking-cell:last-child {
		padding-right: 14px;
	}

	.nocorte-ranking-row--current {
		background: #EDF3F8 !important;
		border-bottom-color: transparent !important;
		margin-left: -8px;
		margin-right: -8px;
	}

	.nocorte-ranking-row--current .nocorte-ranking-cell:first-child {
		padding-left: 12px;
	}

	.nocorte-ranking-row--current .nocorte-ranking-cell:last-child {
		padding-right: 14px;
	}

	.nocorte-ranking-row--current:hover {
		background: #EDF3F8 !important;
	}

	.nocorte-ranking-header-cell {
		padding: 8px 6px;
		font-size: 9px;
	}

	.nocorte-ranking-cell {
		padding: 10px 6px;
	}

	.nocorte-ranking-header-cell--position,
	.nocorte-ranking-cell--position {
		padding: 8px 4px;
		font-size: 12px;
	}

	.nocorte-ranking-row:nth-child(1) .nocorte-ranking-cell--position,
	.nocorte-ranking-row:nth-child(2) .nocorte-ranking-cell--position,
	.nocorte-ranking-row:nth-child(3) .nocorte-ranking-cell--position {
		font-weight: 700;
		font-size: 16px;
		color: #3F4BFF;
	}

	.nocorte-ranking-header-cell--user,
	.nocorte-ranking-cell--user {
		padding: 8px 8px;
	}

	.nocorte-ranking-avatar {
		width: 32px;
		height: 32px;
	}

	.nocorte-ranking-user {
		gap: 6px;
	}

	.nocorte-ranking-user-name {
		font-size: 12px;
	}

	.nocorte-ranking-user-meta {
		font-size: 9px;
	}

	.nocorte-ranking-score {
		flex-direction: column;
		gap: 2px;
	}

	.nocorte-ranking-score-value {
		font-size: 13px;
	}

	.nocorte-ranking-score-label {
		font-size: 9px;
	}

	.nocorte-ranking-expand-wrapper,
	.nocorte-ranking-ver-mais-wrapper {
		padding: 16px 0;
	}

	.nocorte-ranking-expand-btn,
	.nocorte-ranking-ver-mais-btn {
		font-size: 13px;
		gap: 6px;
	}

	.nocorte-ranking-expand-icon,
	.nocorte-ranking-ver-mais-btn svg {
		width: 16px;
		height: 16px;
	}
}
