/*
Theme Name: TopViet Pro
Theme URI: https://topviet.pro
Author: TopViet Team
Author URI: https://topviet.pro
Description: Theme chuyên nghiệp cho nền tảng xếp hạng, danh sách, review du lịch & doanh nghiệp Việt Nam. Tương thích WordPress 7.0+, hỗ trợ FSE (Full Site Editing), Block Themes, custom post types và tích hợp plugin TopViet Core.
Version: 1.0.0
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: topviet
Tags: travel, directory, listing, ranking, review, ratings, block-styles, custom-logo, custom-menu, featured-images, full-site-editing, threaded-comments, translation-ready
*/

/* ==========================================
   CSS VARIABLES - TopViet.Pro Design System
   ========================================== */
:root {
  /* Brand colors */
  --tv-primary: #E53E3E;
  --tv-primary-dark: #C53030;
  --tv-primary-light: #FED7D7;
  --tv-accent: #FBB040;
  --tv-success: #38A169;
  --tv-warning: #ECC94B;
  --tv-info: #3182CE;
  --tv-danger: #E53E3E;

  /* Neutrals */
  --tv-bg: #FFFFFF;
  --tv-bg-alt: #F7FAFC;
  --tv-bg-dark: #1A202C;
  --tv-border: #E2E8F0;
  --tv-text: #2D3748;
  --tv-text-muted: #718096;
  --tv-text-light: #A0AEC0;

  /* Rating star */
  --tv-star: #F6AD55;

  /* Spacing */
  --tv-radius-sm: 6px;
  --tv-radius: 10px;
  --tv-radius-lg: 16px;
  --tv-shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --tv-shadow: 0 4px 12px rgba(0,0,0,.08);
  --tv-shadow-lg: 0 12px 32px rgba(0,0,0,.12);

  /* Font */
  --tv-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================
   RESET & BASE
   ========================================== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--tv-font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--tv-text);
  background: var(--tv-bg-alt);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--tv-primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--tv-primary-dark); }
h1,h2,h3,h4,h5,h6 { margin: 0 0 .6em; line-height: 1.3; font-weight: 700; color: var(--tv-text); }
button { font-family: inherit; cursor: pointer; }

/* ==========================================
   LAYOUT - Container & Grid
   ========================================== */
.tv-container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.tv-grid { display: grid; gap: 20px; }
.tv-grid-2 { grid-template-columns: repeat(2, 1fr); }
.tv-grid-3 { grid-template-columns: repeat(3, 1fr); }
.tv-grid-4 { grid-template-columns: repeat(4, 1fr); }
.tv-grid-5 { grid-template-columns: repeat(5, 1fr); }
.tv-flex { display: flex; gap: 16px; align-items: center; }
.tv-row { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }

@media (max-width: 1024px) {
  .tv-row { grid-template-columns: 1fr; }
  .tv-grid-4, .tv-grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .tv-grid-2, .tv-grid-3, .tv-grid-4, .tv-grid-5 { grid-template-columns: 1fr; }
}

/* ==========================================
   HEADER
   ========================================== */
.tv-site-header {
  background: #fff;
  border-bottom: 1px solid var(--tv-border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--tv-shadow-sm);
}
.tv-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; gap: 24px;
}
.tv-logo { display: flex; align-items: center; gap: 10px; }
.tv-logo-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--tv-primary); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 20px;
}
.tv-logo-text { font-weight: 800; font-size: 18px; color: var(--tv-text); }
.tv-logo-sub { font-size: 11px; color: var(--tv-text-muted); display: block; line-height: 1; }

.tv-main-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.tv-main-nav a {
  padding: 8px 14px; color: var(--tv-text); font-weight: 600; font-size: 14px;
  border-radius: 8px;
}
.tv-main-nav a:hover { background: var(--tv-bg-alt); color: var(--tv-primary); }

.tv-header-actions { display: flex; align-items: center; gap: 8px; }
.tv-icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--tv-bg-alt); border: none;
  display: grid; place-items: center; color: var(--tv-text);
}
.tv-icon-btn:hover { background: var(--tv-primary-light); color: var(--tv-primary); }

/* ==========================================
   BUTTONS
   ========================================== */
.tv-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: none; border-radius: 8px;
  font-weight: 600; font-size: 14px;
  background: var(--tv-bg-alt); color: var(--tv-text);
  transition: all .2s;
}
.tv-btn:hover { transform: translateY(-1px); box-shadow: var(--tv-shadow); }
.tv-btn-primary { background: var(--tv-primary); color: #fff; }
.tv-btn-primary:hover { background: var(--tv-primary-dark); color: #fff; }
.tv-btn-outline { background: transparent; border: 1px solid var(--tv-border); color: var(--tv-text); }
.tv-btn-block { width: 100%; justify-content: center; }
.tv-btn-lg { padding: 14px 28px; font-size: 16px; }

/* ==========================================
   HERO BANNER (Homepage)
   ========================================== */
.tv-hero {
  position: relative; padding: 80px 0; text-align: center;
  background-image: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,.45)), url('assets/images/hero.jpg');
  background-size: cover; background-position: center;
  color: #fff;
}
.tv-hero h1 { font-size: 42px; color: #fff; margin-bottom: 8px; }
.tv-hero p { font-size: 16px; opacity: .95; margin-bottom: 28px; }
.tv-hero-search {
  max-width: 640px; margin: 0 auto;
  display: flex; gap: 8px; background: #fff; padding: 8px;
  border-radius: 50px; box-shadow: var(--tv-shadow-lg);
}
.tv-hero-search input {
  flex: 1; border: none; padding: 12px 20px; font-size: 15px;
  border-radius: 50px; outline: none;
}
.tv-hero-search button {
  background: var(--tv-primary); color: #fff; border: none;
  padding: 12px 32px; border-radius: 50px; font-weight: 600;
}

.tv-hero-categories {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-top: 24px;
}
.tv-hero-cat {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; background: rgba(255,255,255,.95); color: var(--tv-text);
  border-radius: 50px; font-weight: 600; font-size: 14px;
  box-shadow: var(--tv-shadow-sm);
}

/* ==========================================
   SECTIONS
   ========================================== */
.tv-section { padding: 40px 0; }
.tv-section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.tv-section-title { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 10px; }
.tv-section-title .tv-icon { color: var(--tv-primary); }
.tv-see-all { color: var(--tv-primary); font-weight: 600; font-size: 14px; }

/* ==========================================
   CARDS
   ========================================== */
.tv-card {
  background: #fff; border-radius: var(--tv-radius);
  overflow: hidden; box-shadow: var(--tv-shadow-sm);
  border: 1px solid var(--tv-border);
  transition: transform .2s, box-shadow .2s;
}
.tv-card:hover { transform: translateY(-4px); box-shadow: var(--tv-shadow-lg); }
.tv-card-img { position: relative; aspect-ratio: 16/10; overflow: hidden; }
.tv-card-img img { width: 100%; height: 100%; object-fit: cover; }
.tv-card-body { padding: 16px; }
.tv-card-title { font-size: 16px; margin-bottom: 6px; }
.tv-card-meta { font-size: 13px; color: var(--tv-text-muted); display: flex; align-items: center; gap: 10px; }

.tv-card-rank-badge {
  position: absolute; top: 12px; left: 12px;
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(0,0,0,.65); color: #fff;
  display: grid; place-items: center; font-weight: 800;
}
.tv-card-rank-badge.gold { background: linear-gradient(135deg, #FFD700, #FFA500); }
.tv-card-rank-badge.silver { background: linear-gradient(135deg, #C0C0C0, #A0A0A0); }
.tv-card-rank-badge.bronze { background: linear-gradient(135deg, #CD7F32, #8B4513); }

/* ==========================================
   RATING
   ========================================== */
.tv-rating { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tv-stars { color: var(--tv-star); letter-spacing: 1px; }
.tv-rating-score { color: var(--tv-text); }
.tv-rating-count { color: var(--tv-text-muted); font-weight: 400; }

.tv-rating-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tv-rating-bar-track {
  flex: 1; height: 6px; background: var(--tv-border); border-radius: 3px; overflow: hidden;
}
.tv-rating-bar-fill { height: 100%; background: var(--tv-star); border-radius: 3px; }

/* ==========================================
   LISTING (Top 100, etc.)
   ========================================== */
.tv-listing { display: flex; flex-direction: column; gap: 12px; }
.tv-listing-item {
  display: grid; grid-template-columns: 50px 100px 1fr auto auto;
  gap: 16px; align-items: center;
  padding: 14px; background: #fff;
  border: 1px solid var(--tv-border); border-radius: var(--tv-radius);
  transition: all .2s;
}
.tv-listing-item:hover { box-shadow: var(--tv-shadow); border-color: var(--tv-primary-light); }
.tv-listing-rank {
  font-size: 24px; font-weight: 800; color: var(--tv-text-muted);
  text-align: center;
}
.tv-listing-rank.top3 { color: var(--tv-primary); }
.tv-listing-thumb { width: 100px; height: 70px; border-radius: 8px; overflow: hidden; }
.tv-listing-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tv-listing-info h3 { font-size: 16px; margin: 0 0 4px; }
.tv-listing-info p { font-size: 13px; color: var(--tv-text-muted); margin: 0; }
.tv-listing-score {
  font-size: 28px; font-weight: 800; color: var(--tv-primary);
  text-align: center; min-width: 60px;
}
.tv-listing-score-label { font-size: 11px; color: var(--tv-text-muted); display: block; font-weight: 400; }

@media (max-width: 640px) {
  .tv-listing-item { grid-template-columns: 40px 80px 1fr; }
  .tv-listing-score, .tv-listing-thumb + div + div { display: none; }
}

/* ==========================================
   SIDEBAR
   ========================================== */
.tv-sidebar { display: flex; flex-direction: column; gap: 16px; }
.tv-widget {
  background: #fff; border-radius: var(--tv-radius);
  border: 1px solid var(--tv-border); padding: 16px;
}
.tv-widget-title { font-size: 15px; margin-bottom: 12px; }
.tv-widget ul { list-style: none; padding: 0; margin: 0; }
.tv-widget ul li { padding: 8px 0; border-bottom: 1px solid var(--tv-border); font-size: 14px; }
.tv-widget ul li:last-child { border-bottom: none; }

/* ==========================================
   SINGLE PAGE - Destination/Business
   ========================================== */
.tv-breadcrumb {
  display: flex; gap: 8px; font-size: 13px; color: var(--tv-text-muted);
  padding: 12px 0;
}
.tv-breadcrumb a { color: var(--tv-text-muted); }

.tv-place-hero {
  position: relative; border-radius: var(--tv-radius-lg); overflow: hidden;
  margin-bottom: 24px;
}
.tv-place-hero-img { aspect-ratio: 21/9; }
.tv-place-hero-img img { width: 100%; height: 100%; object-fit: cover; }

.tv-place-title-row { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.tv-place-rank-trophy {
  width: 64px; height: 64px; border-radius: 12px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  display: grid; place-items: center; font-size: 28px;
  box-shadow: var(--tv-shadow);
}
.tv-place-title h1 { font-size: 32px; margin: 0 0 8px; }
.tv-place-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--tv-text-muted); }

.tv-place-actions { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }

.tv-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--tv-border);
  margin-bottom: 20px; overflow-x: auto;
}
.tv-tab {
  padding: 12px 16px; font-weight: 600; font-size: 14px;
  border: none; background: none; color: var(--tv-text-muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tv-tab.active { color: var(--tv-primary); border-bottom-color: var(--tv-primary); }

.tv-gallery-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px;
  border-radius: var(--tv-radius); overflow: hidden;
  margin: 20px 0;
}
.tv-gallery-grid img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1; }
.tv-gallery-grid > :first-child { grid-row: span 2; aspect-ratio: 1; }
.tv-gallery-more {
  position: relative;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 18px;
}
.tv-gallery-more::before {
  content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.5);
}
.tv-gallery-more span { position: relative; z-index: 1; }

.tv-info-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin: 20px 0;
}
.tv-info-item {
  padding: 14px; background: var(--tv-bg-alt); border-radius: var(--tv-radius);
  display: flex; gap: 10px; align-items: center;
}
.tv-info-item .tv-icon { color: var(--tv-primary); font-size: 22px; }
.tv-info-item strong { display: block; font-size: 14px; }
.tv-info-item span { font-size: 12px; color: var(--tv-text-muted); }

/* ==========================================
   REVIEWS
   ========================================== */
.tv-review-summary {
  display: grid; grid-template-columns: 200px 1fr; gap: 24px;
  padding: 20px; background: var(--tv-bg-alt); border-radius: var(--tv-radius);
  margin: 20px 0;
}
.tv-review-score-big {
  text-align: center;
}
.tv-review-score-big .score {
  font-size: 56px; font-weight: 800; color: var(--tv-primary); line-height: 1;
}
.tv-review-score-big .label { color: var(--tv-success); font-weight: 600; }

.tv-review-item {
  display: grid; grid-template-columns: 48px 1fr; gap: 12px;
  padding: 16px 0; border-bottom: 1px solid var(--tv-border);
}
.tv-review-avatar { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; }
.tv-review-author { font-weight: 600; }
.tv-review-date { font-size: 12px; color: var(--tv-text-muted); }
.tv-review-content { margin-top: 8px; font-size: 14px; }

/* ==========================================
   USER PROFILE / BADGES
   ========================================== */
.tv-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 50px; font-size: 12px; font-weight: 600;
  background: var(--tv-primary-light); color: var(--tv-primary);
}
.tv-badge-gold { background: linear-gradient(135deg, #FFF5D6, #FFE08C); color: #B8860B; }
.tv-badge-silver { background: linear-gradient(135deg, #F0F0F0, #D0D0D0); color: #606060; }
.tv-badge-bronze { background: linear-gradient(135deg, #FFE4C4, #CD7F32); color: #8B4513; }

.tv-user-banner {
  position: relative; min-height: 280px;
  background-image: linear-gradient(rgba(0,0,0,.3), rgba(0,0,0,.4)), url('assets/images/profile-bg.jpg');
  background-size: cover; background-position: center;
  border-radius: var(--tv-radius-lg);
  padding: 60px 40px;
  color: #fff;
  display: flex; gap: 24px; align-items: center;
}
.tv-user-avatar-lg {
  width: 120px; height: 120px; border-radius: 50%;
  border: 4px solid #fff; overflow: hidden;
  box-shadow: var(--tv-shadow-lg);
}
.tv-user-stats { display: flex; gap: 24px; margin-top: 12px; }
.tv-user-stat strong { font-size: 24px; display: block; }
.tv-user-stat span { font-size: 12px; opacity: .8; }

/* ==========================================
   FOOTER
   ========================================== */
.tv-site-footer {
  background: var(--tv-bg-dark); color: #CBD5E0;
  padding: 60px 0 20px; margin-top: 60px;
}
.tv-footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.5fr; gap: 40px; margin-bottom: 40px; }
.tv-footer h4 { color: #fff; margin-bottom: 16px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
.tv-footer ul { list-style: none; padding: 0; margin: 0; }
.tv-footer ul li { padding: 4px 0; font-size: 14px; }
.tv-footer ul li a { color: #CBD5E0; }
.tv-footer ul li a:hover { color: #fff; }
.tv-footer-bottom {
  border-top: 1px solid #2D3748; padding-top: 20px;
  display: flex; justify-content: space-between; font-size: 13px;
}
.tv-social { display: flex; gap: 10px; margin-top: 16px; }
.tv-social a {
  width: 36px; height: 36px; border-radius: 50%; background: #2D3748;
  display: grid; place-items: center; color: #fff;
}

@media (max-width: 1024px) {
  .tv-footer-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================
   FORMS
   ========================================== */
.tv-form-group { margin-bottom: 14px; }
.tv-form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.tv-form-control {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--tv-border); border-radius: 8px;
  font-size: 14px; font-family: inherit;
  background: #fff;
}
.tv-form-control:focus { outline: none; border-color: var(--tv-primary); box-shadow: 0 0 0 3px var(--tv-primary-light); }

/* ==========================================
   UTILS
   ========================================== */
.tv-tag { display: inline-block; padding: 4px 10px; border-radius: 50px; background: var(--tv-bg-alt); font-size: 12px; color: var(--tv-text-muted); }
.tv-tag:hover { background: var(--tv-primary-light); color: var(--tv-primary); }
.tv-mt-0{margin-top:0}.tv-mt-2{margin-top:8px}.tv-mt-3{margin-top:12px}.tv-mt-4{margin-top:16px}
.tv-mb-0{margin-bottom:0}.tv-mb-2{margin-bottom:8px}.tv-mb-3{margin-bottom:12px}.tv-mb-4{margin-bottom:16px}
.tv-text-muted{color:var(--tv-text-muted)}
.tv-text-primary{color:var(--tv-primary)}
.tv-text-center{text-align:center}

/* Dark mode (auto via prefers-color-scheme) */
@media (prefers-color-scheme: dark) {
  body.tv-dark-mode-auto {
    --tv-bg: #1A202C; --tv-bg-alt: #2D3748; --tv-text: #F7FAFC;
    --tv-text-muted: #A0AEC0; --tv-border: #4A5568;
  }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes tv-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.tv-fade-up { animation: tv-fade-up .5s ease both; }

/* WordPress 7.0 block alignment support */
.alignwide { max-width: 1100px; margin-left: auto; margin-right: auto; }
.alignfull { width: 100%; }
