/**
 * TopList Core — component styles.
 * Theme có thể ghi đè bằng cách khai báo lại biến trong :root.
 */

:root {
	--tl-primary: #5b21b6;      /* tím chủ đạo */
	--tl-primary-600: #6d28d9;
	--tl-primary-50: #f5f3ff;
	--tl-accent: #2563eb;       /* xanh dương */
	--tl-star: #f59e0b;
	--tl-ink: #16181d;
	--tl-muted: #6b7280;
	--tl-line: #e5e7eb;
	--tl-surface: #ffffff;
	--tl-bg: #f7f7fb;
	--tl-ok: #16a34a;
	--tl-err: #dc2626;
	--tl-radius: 16px;
	--tl-radius-sm: 10px;
	--tl-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}

/* ---------- Sao ---------- */

.tl-stars { display: inline-flex; gap: 1px; letter-spacing: -1px; }
.tl-star { color: var(--tl-line); font-size: 15px; line-height: 1; }
.tl-star.is-full { color: var(--tl-star); }
.tl-star.is-half { background: linear-gradient(90deg, var(--tl-star) 50%, var(--tl-line) 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tl-rating-value { font-weight: 700; margin-left: 6px; color: var(--tl-ink); }

.tl-rating-input .tl-star { font-size: 30px; cursor: pointer; transition: transform .12s ease; }
.tl-rating-input .tl-star:hover { transform: scale(1.12); }

/* ---------- Card địa điểm ---------- */

.tl-card {
	background: var(--tl-surface);
	border: 1px solid var(--tl-line);
	border-radius: var(--tl-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow .18s ease, transform .18s ease;
}
.tl-card:hover { box-shadow: var(--tl-shadow); transform: translateY(-2px); }
.tl-card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--tl-bg); }
.tl-card__media img { width: 100%; height: 100%; object-fit: cover; }
.tl-card__badge {
	position: absolute; inset-inline-start: 12px; inset-block-start: 12px;
	background: rgba(255,255,255,.94); color: var(--tl-primary);
	font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}
.tl-card__fav {
	position: absolute; inset-inline-end: 12px; inset-block-start: 12px;
	width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
	background: rgba(255,255,255,.94); color: var(--tl-muted); font-size: 16px; line-height: 1;
}
.tl-card__fav.is-active { color: var(--tl-err); }
.tl-card__body { padding: 14px 16px 16px; display: grid; gap: 6px; }
.tl-card__title { font-size: 16px; font-weight: 700; margin: 0; line-height: 1.35; }
.tl-card__title a { color: var(--tl-ink); text-decoration: none; }
.tl-card__title a:hover { color: var(--tl-primary); }
.tl-card__meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--tl-muted); font-size: 13px; }
.tl-card__foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }

.tl-open { font-size: 12px; font-weight: 600; }
.tl-open.is-open { color: var(--tl-ok); }
.tl-open.is-closed { color: var(--tl-err); }

.tl-verified { color: var(--tl-accent); font-size: 13px; }

/* ---------- Bản đồ ---------- */

.tl-map { width: 100%; min-height: 320px; border-radius: var(--tl-radius); z-index: 1; }
.tl-marker span {
	display: block; width: 22px; height: 22px; border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg); background: var(--tl-primary); border: 2px solid #fff;
	box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.tl-marker.is-active span { background: var(--tl-accent); }
.tl-map-popup { width: 200px; }
.tl-map-popup img { width: 100%; height: 96px; object-fit: cover; border-radius: 8px; margin-bottom: 6px; }
.tl-map-title { font-weight: 700; color: var(--tl-ink); text-decoration: none; display: block; }
.tl-map-meta { font-size: 12px; color: var(--tl-muted); margin-top: 2px; }
.tl-map-rating { color: var(--tl-star); font-weight: 600; }

/* ---------- Địa điểm gần đây ---------- */

.tl-nearby-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--tl-line); text-decoration: none; }
.tl-nearby-item:last-child { border-bottom: 0; }
.tl-nearby-item img, .tl-thumb-empty { width: 64px; height: 64px; border-radius: var(--tl-radius-sm); object-fit: cover; background: var(--tl-bg); flex: none; }
.tl-nearby-title { display: block; font-weight: 600; color: var(--tl-ink); }
.tl-nearby-meta { font-size: 13px; color: var(--tl-muted); }

/* ---------- Form ---------- */

.tl-field { margin-bottom: 16px; display: grid; gap: 6px; }
.tl-field label { font-weight: 600; font-size: 14px; }
.tl-field input[type="text"],
.tl-field input[type="email"],
.tl-field input[type="url"],
.tl-field input[type="tel"],
.tl-field input[type="password"],
.tl-field select,
.tl-field textarea {
	width: 100%; padding: 11px 13px; border: 1px solid var(--tl-line);
	border-radius: var(--tl-radius-sm); font: inherit; background: #fff;
}
.tl-field input:focus, .tl-field select:focus, .tl-field textarea:focus {
	outline: 2px solid var(--tl-primary); outline-offset: 1px; border-color: transparent;
}
.tl-field .has-error { border-color: var(--tl-err); }
.tl-hp { position: absolute !important; left: -9999px; }
.tl-gmaps-status { font-size: 13px; color: var(--tl-muted); }
.tl-gmaps-status.is-ok { color: var(--tl-ok); }

.tl-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 11px 20px; border-radius: 999px; border: 0; cursor: pointer;
	font-weight: 600; font-size: 15px; text-decoration: none;
	background: var(--tl-primary); color: #fff;
}
.tl-btn:hover { background: var(--tl-primary-600); color: #fff; }
.tl-btn--ghost { background: transparent; color: var(--tl-primary); border: 1px solid var(--tl-line); }
.tl-btn--block { width: 100%; }

.tl-alert { padding: 10px 14px; border-radius: var(--tl-radius-sm); font-size: 14px; margin-bottom: 12px; }
.tl-alert--error { background: #fef2f2; color: var(--tl-err); }
.tl-alert--success { background: #f0fdf4; color: var(--tl-ok); }
.tl-notice { padding: 14px; background: var(--tl-primary-50); border-radius: var(--tl-radius-sm); }

.is-loading { opacity: .6; pointer-events: none; }

/* ---------- Auth ---------- */

.tl-auth { max-width: 420px; margin: 0 auto; background: var(--tl-surface); padding: 28px; border-radius: var(--tl-radius); border: 1px solid var(--tl-line); }
.tl-auth h2 { margin-top: 0; }
.tl-auth-alt { text-align: center; font-size: 14px; color: var(--tl-muted); margin-top: 16px; }
.tl-google-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 11px; border: 1px solid var(--tl-line); border-radius: 999px; text-decoration: none; color: var(--tl-ink); font-weight: 600; }

/* ---------- Tabs ---------- */

.tl-tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--tl-line); margin-bottom: 20px; }
.tl-tabs a { padding: 12px 16px; text-decoration: none; color: var(--tl-muted); font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; }
.tl-tabs a.is-active { color: var(--tl-primary); border-bottom-color: var(--tl-primary); }
.tl-tab-panel { display: none; }
.tl-tab-panel.is-active { display: block; }

/* ---------- Phân bổ sao ---------- */

.tl-dist { display: grid; gap: 6px; }
.tl-dist__row { display: grid; grid-template-columns: 42px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.tl-dist__bar { height: 8px; background: var(--tl-line); border-radius: 999px; overflow: hidden; }
.tl-dist__fill { height: 100%; background: var(--tl-star); border-radius: 999px; }

/* ---------- Listing ---------- */

.tl-listing { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; align-items: start; }
.tl-listing-map { position: sticky; top: 90px; height: calc(100vh - 120px); }
.tl-listing-map .tl-map { height: 100%; }
.tl-listing-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tl-listing-pager { display: flex; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.tl-page { min-width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--tl-line); background: #fff; cursor: pointer; font-weight: 600; }
.tl-page.is-current { background: var(--tl-primary); color: #fff; border-color: var(--tl-primary); }
.tl-empty { color: var(--tl-muted); padding: 32px; text-align: center; grid-column: 1 / -1; }

.tl-filter-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; background: var(--tl-surface); padding: 16px; border-radius: var(--tl-radius); border: 1px solid var(--tl-line); margin-bottom: 20px; }
.tl-filter-form .tl-field { margin: 0; min-width: 160px; }

/* ---------- Bảng xếp hạng ---------- */

.tl-rank-table { width: 100%; border-collapse: collapse; background: var(--tl-surface); border-radius: var(--tl-radius); overflow: hidden; }
.tl-rank-table th, .tl-rank-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--tl-line); font-size: 14px; }
.tl-rank-table th { background: var(--tl-primary-50); color: var(--tl-primary); font-weight: 700; }
.tl-rank-pos { font-weight: 800; font-size: 18px; color: var(--tl-muted); width: 60px; }
.tl-rank-pos.is-top { color: var(--tl-star); }

/* ---------- Form nhiều bước ---------- */

.tl-steps { display: flex; gap: 8px; margin-bottom: 22px; }
.tl-step-dot { flex: 1; padding: 10px 12px; border-radius: 999px; background: var(--tl-bg); color: var(--tl-muted); font-size: 13px; font-weight: 600; text-align: center; }
.tl-step-dot.is-done { background: var(--tl-primary); color: #fff; }
.tl-step-nav { display: flex; gap: 10px; justify-content: space-between; margin-top: 20px; }

/* ---------- Breadcrumb ---------- */

.tl-breadcrumb ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; font-size: 13px; color: var(--tl-muted); }
.tl-breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--tl-line); }
.tl-breadcrumb a { color: var(--tl-muted); text-decoration: none; }
.tl-breadcrumb a:hover { color: var(--tl-primary); }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
	.tl-listing { grid-template-columns: 1fr; }
	.tl-listing-map { position: relative; top: 0; height: 320px; order: -1; }
}
@media (max-width: 640px) {
	.tl-listing-results { grid-template-columns: 1fr; }
	.tl-filter-form .tl-field { min-width: 100%; }
	.tl-steps { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
	* { animation: none !important; transition: none !important; }
}
