/**
 * Estilos Frontend - Interno UFMG
 * Mobile-first. Integração com Portal PRA-UFMG.
 *
 * @package Interno_UFMG
 */

/* ==========================================================================
   1. VARIÁVEIS E ESCOPO PRINCIPAL
   ========================================================================== */
.interno-ufmg-wrapper {
	--interno-primary:       var(--pra-link-color,    #00a3e6);
	--interno-primary-hover: var(--pra-link-hover,    #002b4d);
	--interno-accent:        var(--pra-accent-blue,   #0072bc);
	--interno-text:          var(--pra-text-main,     #333333);
	--interno-border:        var(--pra-border-color,  #e5e5e5);
	--interno-bg:            #f7f9fa;
	--interno-bg-card:       #ffffff;
	--interno-radius:        6px;

	font-family: sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
	font-size: 15px;
	line-height: 1.5;
	color: var(--interno-text);
	background: transparent;
	width: 100%;
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

.interno-ufmg-wrapper *,
.interno-ufmg-wrapper *::before,
.interno-ufmg-wrapper *::after {
	box-sizing: border-box;
}

/* ==========================================================================
   2. PRÓXIMOS 4 ÔNIBUS (HERO WIDGET EM TEMPO REAL)
   ========================================================================== */
.interno-proximas-partidas-section {
	background: var(--interno-bg-card);
	border: 1px solid var(--interno-border);
	border-radius: var(--interno-radius);
	padding: 12px 14px;
	margin-bottom: 14px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.proximas-partidas-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
}

.proximas-partidas-title {
	display: flex;
	align-items: center;
	gap: 8px;
}

.proximas-pulse-dot {
	width: 9px;
	height: 9px;
	background: #10b981;
	border-radius: 50%;
	display: inline-block;
	animation: pulseLive 1.8s infinite;
}

.proximas-partidas-title h4 {
	font-size: 15px;
	font-weight: 800;
	color: #002b4d;
	margin: 0;
	letter-spacing: -0.2px;
}

.proximas-partidas-meta {
	font-size: 12px;
	color: #64748b;
	font-weight: 600;
}

.proximas-horario-atual {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: #f1f5f9;
	padding: 3px 8px;
	border-radius: 4px;
	font-family: monospace;
	font-size: 12px;
	color: #334155;
}

.proximas-partidas-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
}

.proximo-bus-card {
	background: #fff;
	border: 1px solid var(--interno-border);
	border-left: 4px solid var(--card-line-color, var(--interno-primary));
	border-radius: 6px;
	padding: 9px 11px;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
	cursor: pointer;
	outline: none;
}

.proximo-bus-card:hover,
.proximo-bus-card:focus {
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
	border-color: var(--card-line-color, var(--interno-primary));
}

.bus-card-top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 4px;
}

.bus-card-badge {
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	padding: 2px 6px;
	border-radius: 3px;
	line-height: 1.2;
}

.bus-card-countdown {
	font-size: 11px;
	font-weight: 700;
	color: #059669;
	background: #ecfdf5;
	padding: 2px 6px;
	border-radius: 3px;
	line-height: 1.2;
}

.bus-card-countdown.is-urgent {
	background: #fef2f2;
	color: #dc2626;
	animation: pulseLive 1.5s infinite;
}

.bus-card-time-row {
	display: flex;
	align-items: baseline;
	gap: 6px;
	margin-bottom: 4px;
	flex-wrap: wrap;
}

.bus-card-time {
	font-size: 18px;
	font-weight: 900;
	color: #0f172a;
	font-family: monospace;
	line-height: 1.1;
}

.bus-card-variant-tag {
	font-size: 10px;
	font-weight: 700;
	color: #3730a3;
	background: #e0e7ff;
	padding: 2px 5px;
	border-radius: 3px;
	line-height: 1.2;
}

.bus-card-origem {
	font-size: 11px;
	color: #64748b;
	display: flex;
	align-items: center;
	gap: 3px;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bus-card-origem .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
	color: #94a3b8;
}

/* ==========================================================================
   3. SELETOR DE LINHAS
   ========================================================================== */
.interno-header-selector {
	margin-bottom: 12px;
}

.interno-lines-nav {
	display: flex;
	align-items: center;
	gap: 6px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding-bottom: 4px;
}

.interno-lines-nav::-webkit-scrollbar {
	display: none;
}

.interno-line-pill-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	background: var(--interno-bg-card);
	border: 1.5px solid var(--interno-border);
	border-radius: 7px;
	cursor: pointer;
	color: var(--interno-text);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	flex-shrink: 0;
	transition: border-color 0.15s, box-shadow 0.15s;
	outline: none;
}

.interno-line-pill-btn:hover {
	border-color: #94a3b8;
}

.interno-line-pill-btn.active {
	border-color: var(--line-color, var(--interno-primary));
	box-shadow: 0 0 0 1px var(--line-color, var(--interno-primary));
	background: #f8fafc;
}

.line-badge-bullet {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
}

.line-num {
	font-weight: 800;
}

.btn-show-all {
	background: var(--interno-bg);
	border-style: dashed;
	color: #475569;
}

.btn-show-all:hover,
.btn-show-all.active {
	background: var(--interno-primary);
	color: #fff;
	border-color: var(--interno-primary);
	border-style: solid;
}

/* ==========================================================================
   4. MAPA
   ========================================================================== */
.interno-map-section {
	margin-bottom: 14px;
	border: 1px solid var(--interno-border);
	border-radius: var(--interno-radius);
	overflow: hidden;
}

#interno-ufmg-map,
.interno-ufmg-map-container {
	width: 100%;
	height: 360px;
	background: #e5e3df;
	position: relative;
	z-index: 1;
}

.interno-stop-pin-wrapper {
	background: transparent;
	border: none;
}

.interno-map-pin {
	width: 18px;
	height: 18px;
	background: var(--interno-primary);
	border: 3px solid #fff;
	border-radius: 50%;
	box-shadow: 0 2px 4px rgba(0,0,0,.3);
	cursor: pointer;
	transition: transform 0.15s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.interno-map-pin:hover {
	transform: scale(1.35);
	z-index: 999;
}

.interno-map-pin .pin-inner {
	width: 4px;
	height: 4px;
	background: #fff;
	border-radius: 50%;
}

.interno-popup-content h4 {
	font-size: 13px;
	font-weight: 700;
	color: var(--interno-primary);
	margin: 0 0 4px 0;
}

.interno-line-pill {
	display: inline-block;
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 700;
	color: #fff;
}

/* ==========================================================================
   5. FILTRO DE ROTAS ALTERNATIVAS (SUBLINHAS)
   ========================================================================== */
.interno-sublinhas-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	padding: 8px 10px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	margin-bottom: 10px;
}

.filter-bar-label {
	font-size: 11px;
	font-weight: 700;
	color: #64748b;
	text-transform: uppercase;
	letter-spacing: 0.3px;
	margin-right: 2px;
}

.sublinha-filter-btn {
	background: #fff;
	border: 1px solid #cbd5e1;
	border-radius: 7px;
	padding: 4px 10px;
	font-size: 11px;
	font-weight: 600;
	color: #334155;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	transition: all 0.15s ease;
	outline: none;
}

.sublinha-filter-btn:hover {
	border-color: #94a3b8;
	background: #f1f5f9;
}

.sublinha-filter-btn.active {
	background: #003366;
	color: #fff;
	border-color: #003366;
	box-shadow: 0 1px 3px rgba(0, 51, 102, 0.2);
}

.sublinha-pill-count {
	font-size: 10px;
	font-weight: 800;
	background: rgba(0, 0, 0, 0.08);
	padding: 1px 5px;
	border-radius: 8px;
}

.sublinha-filter-btn.active .sublinha-pill-count {
	background: rgba(255, 255, 255, 0.25);
	color: #fff;
}

/* ==========================================================================
   6. GRID HORÁRIOS + ITINERÁRIO
   ========================================================================== */
.interno-line-grid-layout {
	display: grid;
	grid-template-columns: 1.2fr 0.8fr;
	gap: 14px;
	align-items: start;
}

.interno-column-schedules,
.interno-column-itinerary {
	background: var(--interno-bg-card);
	border: 1px solid var(--interno-border);
	border-radius: var(--interno-radius);
	padding: 14px;
}

.schedules-box-header h4,
.itinerary-box-header h4 {
	font-size: 14px;
	font-weight: 700;
	color: var(--interno-text);
	margin: 0;
	display: flex;
	align-items: center;
	gap: 6px;
}

.itinerary-box-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 4px;
}

.itinerary-instruction {
	font-size: 12px;
	color: #64748b;
	margin: 0 0 10px 0;
}

/* ==========================================================================
   6. ABAS DE HORÁRIOS
   ========================================================================== */
.interno-tabs-nav {
	display: flex;
	gap: 3px;
	border-bottom: 2px solid var(--interno-primary);
	margin: 10px 0 8px 0;
}

.interno-tab-btn {
	background: var(--interno-bg);
	border: 1px solid var(--interno-border);
	border-bottom: none;
	border-radius: 4px 4px 0 0;
	padding: 5px 10px;
	font-size: 12px;
	font-weight: 700;
	color: #475569;
	cursor: pointer;
	transition: background 0.12s, color 0.12s;
}

.interno-tab-btn:hover {
	background: #fff;
	color: var(--interno-primary);
}

.interno-tab-btn.active {
	background: var(--interno-primary);
	color: #fff;
	border-color: var(--interno-primary);
}

.interno-table-summary {
	background: var(--interno-bg);
	border: 1px solid var(--interno-border);
	border-radius: 4px;
	padding: 5px 10px;
	font-size: 12px;
	color: var(--interno-text);
	margin-bottom: 8px;
	display: flex;
	justify-content: space-between;
}

.interno-table-responsive {
	overflow-x: auto;
	border: 1px solid var(--interno-border);
	border-radius: 4px;
}

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

.interno-table thead th {
	background: var(--interno-bg);
	color: var(--interno-text);
	font-weight: 700;
	padding: 7px 10px;
	border-bottom: 2px solid var(--interno-border);
	text-transform: uppercase;
	font-size: 11px;
	letter-spacing: 0.3px;
}

.interno-table thead .th-hour {
	width: 60px;
	text-align: center;
}

.interno-table tbody tr {
	border-bottom: 1px solid var(--interno-border);
}

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

.interno-table tbody tr:hover {
	background: #f0f7ff;
}

.td-hour {
	text-align: center;
	vertical-align: middle;
	padding: 5px 4px;
	border-right: 1px solid var(--interno-border);
}

.hour-badge {
	display: inline-block;
	background: #00a3e6;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	padding: 2px 5px;
	border-radius: 3px;
	font-family: monospace;
}

.td-times {
	padding: 5px 8px;
	vertical-align: middle;
}

.departure-times-list {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.departure-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: #fff;
	border: 1px solid #cbd5e1;
	color: #334155;
	font-weight: 700;
	font-family: monospace;
	font-size: 12px;
	padding: 2px 6px;
	border-radius: 4px;
	transition: all 0.15s ease;
	line-height: 1.2;
}

.departure-chip.is-sublinha {
	border-color: #cbd5e1;
	background: #fafafa;
}

.chip-variant-badge {
	font-size: 9px;
	font-weight: 800;
	padding: 1px 4px;
	border-radius: 3px;
	text-transform: uppercase;
	letter-spacing: 0.2px;
	line-height: 1.1;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	background: #e2e8f0;
	color: #334155;
}

.departure-chip.sublinha-area-militar .chip-variant-badge,
.legend-badge.sublinha-area-militar {
	background: #fee2e2;
	color: #991b1b;
}

.departure-chip.sublinha-bh-tec .chip-variant-badge,
.legend-badge.sublinha-bh-tec {
	background: #dcfce7;
	color: #166534;
}

.departure-chip.sublinha-mcdonalds .chip-variant-badge,
.legend-badge.sublinha-mcdonalds {
	background: #fef3c7;
	color: #92400e;
}

.departure-chip.sublinha-bhtec-mcdonalds .chip-variant-badge,
.legend-badge.sublinha-bhtec-mcdonalds {
	background: #e0e7ff;
	color: #3730a3;
}

.departure-chip.sublinha-ferias .chip-variant-badge,
.legend-badge.sublinha-ferias {
	background: #ede9fe;
	color: #5b21b6;
}

.departure-chip.sublinha-sabado .chip-variant-badge,
.legend-badge.sublinha-sabado {
	background: #e0f2fe;
	color: #0369a1;
}

/* Partida que atende trajetos complementares no mesmo horário */
.departure-chip.sublinha-combinada {
	border-color: #94a3b8;
	background: #f8fafc;
}

.departure-chip.sublinha-combinada .chip-variant-badge {
	background: #e2e8f0;
	color: #1e293b;
}

.departure-chip.sublinha-combinada::before {
	content: "⇄";
	font-size: 11px;
	font-weight: 700;
	color: #475569;
}

/* Legenda das Rotas */
.interno-sublinhas-legend {
	margin-top: 10px;
	padding: 9px 12px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
}

.legend-header {
	font-size: 11px;
	font-weight: 700;
	color: #1e293b;
	margin-bottom: 5px;
	display: flex;
	align-items: center;
	gap: 4px;
}

.legend-items {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.legend-item {
	font-size: 11px;
	color: #475569;
	display: flex;
	align-items: baseline;
	gap: 6px;
	line-height: 1.3;
}

.legend-badge {
	flex-shrink: 0;
}

.interno-no-schedule {
	text-align: center;
	padding: 24px 14px;
	color: #64748b;
}

.interno-no-schedule .dashicons {
	font-size: 28px;
	width: 28px;
	height: 28px;
	margin-bottom: 6px;
	color: #94a3b8;
}

.interno-no-schedule p {
	margin: 0;
	font-size: 13px;
}

/* ==========================================================================
   7. TIMELINE DE ITINERÁRIO
   ========================================================================== */
.interno-timeline {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: auto;
	overflow-y: auto;
}

.interno-timeline-item {
	display: flex;
	align-items: flex-start;
	padding: 5px 6px;
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.12s;
	outline: none;
}

.interno-timeline-item:hover,
.interno-timeline-item:focus {
	background: var(--interno-bg);
}

.interno-timeline-item.focused {
	background: #e0f2fe;
	box-shadow: inset 3px 0 0 var(--interno-accent);
}

.timeline-bullet-col {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-right: 10px;
	flex-shrink: 0;
}

.timeline-bullet {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--interno-primary);
	color: #fff;
	font-size: 10px;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 1px 2px rgba(0,0,0,.2);
	z-index: 2;
}

.timeline-line {
	width: 2px;
	height: 24px;
	background: var(--interno-border);
	margin-top: 2px;
}

.interno-timeline-item:last-child .timeline-line {
	display: none;
}

.timeline-info-col {
	flex-grow: 1;
	padding-top: 1px;
}

.timeline-ponto-title {
	display: block;
	font-size: 13px;
	font-weight: 700;
	color: var(--interno-text);
	line-height: 1.3;
}

.timeline-ponto-ref {
	display: block;
	font-size: 11px;
	color: #64748b;
	margin-top: 1px;
}

.timeline-action-col {
	flex-shrink: 0;
	padding-top: 2px;
	opacity: 0;
	transition: opacity 0.12s;
	color: var(--interno-primary);
}

.interno-timeline-item:hover .timeline-action-col,
.interno-timeline-item:focus .timeline-action-col {
	opacity: 1;
}

.itinerary-empty {
	color: #64748b;
	font-style: italic;
	padding: 10px 0;
}

/* ==========================================================================
   8. RESPONSIVIDADE (Tablets e Mobile)
   ========================================================================== */
@media (max-width: 992px) {
	.proximas-partidas-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 640px) {
	.interno-ufmg-wrapper {
		padding: 0;
		margin: 0;
	}

	.proximas-partidas-grid {
		grid-template-columns: 1fr;
		gap: 8px;
	}

	.proximo-bus-card {
		padding: 8px 10px;
	}

	#interno-ufmg-map,
	.interno-ufmg-map-container {
		height: 260px;
	}

	.interno-line-grid-layout {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.interno-column-schedules,
	.interno-column-itinerary {
		padding: 10px;
	}

	.interno-tab-btn {
		padding: 5px 8px;
		font-size: 11px;
	}

	.hour-badge {
		font-size: 11px;
		padding: 1px 4px;
	}

	.departure-chip {
		font-size: 11px;
	}

	.interno-timeline {
		max-height: 300px;
	}
}

/* =========================================================================
   Seleção de trajeto por horário (chips clicáveis)
   ========================================================================= */

button.departure-chip {
	cursor: pointer;
	font: inherit;
	font-family: monospace;
	font-size: 12px;
	font-weight: 700;
}

button.departure-chip:hover {
	border-color: var(--interno-primary);
	background: #eef4fb;
	transform: translateY(-1px);
}

button.departure-chip:focus-visible {
	outline: 2px solid var(--interno-primary);
	outline-offset: 1px;
}

button.departure-chip.is-selected {
	border-color: var(--interno-primary);
	background: var(--interno-primary);
	color: #fff;
	box-shadow: 0 2px 6px rgba(0, 51, 102, 0.28);
}

button.departure-chip.is-selected .chip-variant-badge {
	background: rgba(255, 255, 255, 0.9);
	color: #003366;
}

.departure-chip.is-default::after {
	content: "";
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: #10b981;
}

button.departure-chip.is-selected.is-default::after {
	background: #a7f3d0;
}

/* Rótulo do trajeto atualmente exibido no mapa */
.interno-map-route-caption {
	padding: 7px 12px;
	background: var(--interno-primary);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.1px;
	min-height: 0;
}

.interno-map-route-caption:empty {
	display: none;
}

/* Contador nas abas de período */
.interno-tab-btn .tab-count {
	display: inline-block;
	margin-left: 5px;
	font-size: 10px;
	font-weight: 800;
	padding: 0 5px;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.08);
	color: inherit;
}

.interno-tab-btn.active .tab-count {
	background: rgba(255, 255, 255, 0.28);
}

/* Contexto do itinerário */
.itinerary-context {
	margin: 0 0 8px 0;
	font-size: 12px;
	font-weight: 700;
	color: var(--interno-primary);
}

.timeline-stop-time {
	display: inline-block;
	margin-right: 6px;
	font-family: monospace;
	font-size: 11px;
	font-weight: 800;
	color: var(--interno-primary);
	background: #eef4fb;
	padding: 1px 5px;
	border-radius: 3px;
}

.interno-timeline-item.focused {
	background: #eef4fb;
	border-radius: 5px;
}

.interno-timeline-item.focused .timeline-action-col {
	opacity: 1;
}

/* Código da parada no popup */
.interno-popup-code {
	display: inline-block;
	font-size: 10px;
	font-weight: 800;
	background: var(--interno-primary);
	color: #fff;
	padding: 1px 5px;
	border-radius: 3px;
	margin-bottom: 4px;
}

.interno-popup-content p {
	margin: 0 0 6px 0;
	font-size: 12px;
	color: #555;
}

.interno-popup-lines {
	margin-top: 6px;
	font-size: 11px;
	font-weight: 600;
	color: #333;
}

.interno-popup-lines .interno-line-pill {
	display: inline-block;
	color: #fff;
	padding: 1px 6px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 700;
	margin-left: 3px;
}

/* =========================================================================
   Rótulos de linha por extenso ("Linha 01")
   ========================================================================= */
.line-num,
.bus-card-badge,
.bus-card-variant-tag {
	white-space: nowrap;
}

.interno-line-pill-btn .line-num {
	font-size: 13px;
	letter-spacing: 0.1px;
}

.bus-card-time-row {
	flex-wrap: wrap;
	row-gap: 3px;
}
