:root {
  --bg-base: #f6f9f7;
  --bg-mint: #eef7f2;
  --bg-sky: #f0f6fb;
  --ink: #152a38;
  --ink-soft: #4a6272;
  --ink-muted: #6b8494;
  --primary: #0a8f62;
  --primary-hover: #087a54;
  --primary-soft: rgba(10, 143, 98, 0.1);
  --secondary: #1a7ab8;
  --secondary-soft: rgba(26, 122, 184, 0.1);
  --accent: #c4842a;
  --accent-soft: rgba(196, 132, 42, 0.12);
  --surface: #ffffff;
  --surface-elevated: rgba(255, 255, 255, 0.92);
  --border: rgba(21, 42, 56, 0.08);
  --border-strong: rgba(21, 42, 56, 0.14);
  --shadow-sm: 0 2px 8px rgba(21, 42, 56, 0.04);
  --shadow-md: 0 12px 40px rgba(21, 42, 56, 0.08);
  --shadow-lg: 0 24px 64px rgba(21, 42, 56, 0.1);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --font-display: "Roboto", "Segoe UI", sans-serif;
  --font-body: "Roboto", "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.7;
  background-color: var(--bg-base);
  background-image:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(10, 143, 98, 0.06), transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 10%, rgba(26, 122, 184, 0.05), transparent 45%),
    linear-gradient(180deg, var(--bg-mint) 0%, var(--bg-base) 40%, var(--bg-sky) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1140px, calc(100% - 2.5rem));
  margin: 0 auto;
}

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  background: rgba(246, 249, 247, 0.75);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.9rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: opacity 0.2s ease;
}

.brand:hover {
  opacity: 0.85;
}

.brand-logo-frame {
  background: var(--surface);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.brand-logo {
  display: block;
  height: 40px;
  width: auto;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.nav-toggle:hover {
  background: var(--primary-soft);
  border-color: rgba(10, 143, 98, 0.2);
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  margin: 4.5px auto;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.main-nav a {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.main-nav a:hover {
  color: var(--ink);
  background: rgba(21, 42, 56, 0.05);
}

.main-nav a.active {
  color: white;
  background: var(--primary);
  box-shadow: none;
}

/* —— Hero —— */
.hero {
  padding: 3.5rem 0 2rem;
}

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: clamp(1.75rem, 1.5rem + 2vw, 2.75rem);
}

.hero-card::before {
  content: "BK GREEN ACTIVITY";
  display: block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--primary);
  margin-bottom: 1rem;
}

.hero-card::after {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-soft) 0%, transparent 70%);
  pointer-events: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 {
  font-weight: 800;
  font-size: clamp(1.65rem, 1.3rem + 1.8vw, 2.35rem);
  max-width: 28ch;
}

h2 {
  font-weight: 700;
  font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.55rem);
}

h3 {
  font-weight: 700;
  font-size: 1.05rem;
}

.hero p {
  color: var(--ink-soft);
  margin: 1rem 0 0;
  max-width: 58ch;
  font-size: 1.02rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.pill {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* —— Sections & cards —— */
.section {
  padding: 0.5rem 0 3.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
}

.card {
  grid-column: span 12;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.4rem;
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s var(--ease-out),
    border-color 0.35s ease;
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.25rem;
  bottom: 1.25rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(10, 143, 98, 0.15);
}

.card:hover::before {
  opacity: 1;
}

.card h3 {
  margin-bottom: 0.75rem;
  padding-left: 0;
  line-height: 1.35;
  text-wrap: balance;
}

.card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.card ul {
  margin: 0.85rem 0 0;
  padding-left: 0;
  list-style: none;
}

.card li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.7;
}

.card .tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0.4rem 0;
  border-bottom: 1px solid transparent;
  transition: gap 0.25s ease, border-color 0.25s ease, color 0.2s ease;
}

.card .tag::after {
  content: "→";
  font-size: 0.9em;
  transition: transform 0.25s var(--ease-out);
}

.card:hover .tag {
  border-bottom-color: rgba(10, 143, 98, 0.35);
}

.card:hover .tag::after {
  transform: translateX(3px);
}

.col-4 {
  grid-column: span 4;
}

.col-6 {
  grid-column: span 6;
}

.col-5 {
  grid-column: span 5;
}

.col-7 {
  grid-column: span 7;
}

.col-8 {
  grid-column: span 8;
}

.col-12 {
  grid-column: span 12;
}

.note {
  border: 1px solid rgba(196, 132, 42, 0.25);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  color: #6b5420;
  margin-top: 1.1rem;
  font-size: 0.9375rem;
}

/* —— Badges —— */
.badge-list {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.badge {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.badge.basic {
  background: #ecfdf3;
  color: #047857;
  border-color: rgba(4, 120, 87, 0.2);
}

.badge.plus {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.2);
}

.badge.excellent {
  background: #fffbeb;
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.2);
}

/* —— Timeline —— */
.timeline {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--border-strong);
  margin-left: 0.35rem;
}

.timeline li {
  padding: 0 0 1rem 1.35rem;
  position: relative;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -0.42rem;
  top: 0.45em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.timeline li:last-child {
  padding-bottom: 0;
}

/* —— Tables —— */
.table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  min-width: 760px;
}

.ranking-table thead {
  background: var(--bg-mint);
}

.ranking-table th,
.ranking-table td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.ranking-table th {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.ranking-table tbody tr {
  transition: background 0.15s ease;
}

.ranking-table tbody tr:hover {
  background: var(--primary-soft);
}

.ranking-table tbody tr:last-child td {
  border-bottom: 0;
}

.level-tag {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid rgba(10, 143, 98, 0.2);
  color: var(--primary);
  background: var(--primary-soft);
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* —— Dashboard stats —— */
.stat-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-mint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.1rem;
  min-width: 0;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
  border-color: rgba(10, 143, 98, 0.2);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  text-wrap: balance;
}

.stat-value {
  margin: 0.5rem 0 0.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 0.8vw, 1.75rem);
  line-height: 1.15;
  font-weight: 800;
  color: var(--ink);
}

.stat-delta {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

.stat-delta.up {
  color: var(--primary);
  font-weight: 600;
}

.map-wrap {
  margin-top: 1rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.green-map {
  width: 100%;
  height: 400px;
  z-index: 1;
}

.map-wrap .leaflet-container {
  font-family: var(--font-body);
  background: var(--bg-mint);
}

.map-wrap .leaflet-popup-content-wrapper {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.map-wrap .leaflet-popup-content {
  margin: 0.65rem 0.85rem;
  font-size: 0.875rem;
  line-height: 1.45;
}

/* Chấm xanh nhấp nháy trên bản đồ (Leaflet) */
.map-pulse-marker {
  background: transparent !important;
  border: none !important;
}

.map-pulse-marker .map-pulse-ring,
.map-pulse-marker .map-pulse-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
}

.map-pulse-marker--green .map-pulse-core {
  width: 12px;
  height: 12px;
  background: #0a8f62;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(10, 143, 98, 0.45);
  animation: map-dot-blink 2s ease-in-out infinite;
}

.map-pulse-marker--green .map-pulse-ring {
  width: 12px;
  height: 12px;
  background: rgba(10, 143, 98, 0.45);
  animation: map-dot-pulse 2s ease-out infinite;
}

.map-pulse-marker--campus .map-pulse-core {
  width: 14px;
  height: 14px;
  background: #1a7ab8;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(26, 122, 184, 0.4);
  animation: map-dot-blink 2.8s ease-in-out infinite;
}

.map-pulse-marker--campus .map-pulse-ring {
  width: 14px;
  height: 14px;
  background: rgba(26, 122, 184, 0.35);
  animation: map-dot-pulse 2.8s ease-out infinite;
}

@keyframes map-dot-pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0.75;
  }
  70%,
  100% {
    transform: translate(-50%, -50%) scale(2.4);
    opacity: 0;
  }
}

@keyframes map-dot-blink {
  0%,
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.45;
    transform: translate(-50%, -50%) scale(0.88);
  }
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.map-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(21, 42, 56, 0.12);
}

.map-legend-dot--green {
  background: #0a8f62;
  animation: map-legend-blink 2s ease-in-out infinite;
}

@keyframes map-legend-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.map-legend-dot--campus {
  background: #1a7ab8;
  width: 14px;
  height: 14px;
}

/* Phân bố chứng nhận (dashboard) */
.cert-stats {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cert-stats-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr 2.5rem;
  align-items: center;
  gap: 0.75rem;
}

.cert-stats-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.cert-stats-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(21, 42, 56, 0.06);
  overflow: hidden;
  min-width: 0;
}

.cert-stats-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  min-width: 4px;
}

.cert-stats-row--basic .cert-stats-bar > span {
  background: #16a34a;
}

.cert-stats-row--plus .cert-stats-bar > span {
  background: #0284c7;
}

.cert-stats-row--excellent .cert-stats-bar > span {
  background: #d97706;
}

.cert-stats-value {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

/* Top đơn vị (dashboard) */
.top-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.top-list li {
  display: grid;
  grid-template-columns: 2.25rem 1fr auto;
  align-items: center;
  column-gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.top-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.top-list-rank {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(10, 143, 98, 0.35);
}

.top-list-name {
  min-width: 0;
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.4;
  font-weight: 500;
}

.top-list-score {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .cert-stats-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.35rem 0.75rem;
  }

  .cert-stats-label {
    grid-column: 1;
    grid-row: 1;
  }

  .cert-stats-value {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  .cert-stats-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .top-list li {
    grid-template-columns: 2.25rem 1fr;
    row-gap: 0.35rem;
  }

  .top-list-score {
    grid-column: 2;
    justify-self: start;
  }
}

/* —— Footer —— */
.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  color: var(--ink-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* —— Reveal animation —— */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.6s var(--ease-out),
    transform 0.6s var(--ease-out);
}

.reveal.on {
  opacity: 1;
  transform: translateY(0);
}

.grid .reveal:nth-child(2) {
  transition-delay: 0.05s;
}

.grid .reveal:nth-child(3) {
  transition-delay: 0.1s;
}

.grid .reveal:nth-child(4) {
  transition-delay: 0.15s;
}

.grid .reveal:nth-child(5) {
  transition-delay: 0.2s;
}

.grid .reveal:nth-child(6) {
  transition-delay: 0.25s;
}

/* —— Responsive —— */
@media (max-width: 1040px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .green-map {
    height: 280px;
  }

  .col-4,
  .col-5,
  .col-6,
  .col-7,
  .col-8 {
    grid-column: span 12;
  }

  .main-nav {
    display: none;
    width: 100%;
    padding: 0.5rem 0 0.25rem;
    justify-content: flex-start;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
  }

  .main-nav.open {
    display: flex;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .header-row {
    flex-wrap: wrap;
  }

  .brand-logo {
    height: 34px;
  }

  .brand-title {
    font-size: 0.85rem;
  }

  h1 {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .container {
    width: min(1080px, calc(100% - 1.5rem));
  }

  .hero {
    padding: 2.5rem 0 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal.on,
  .card,
  .main-nav a,
  .card .tag::after {
    transition: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .map-pulse-marker .map-pulse-ring,
  .map-pulse-marker .map-pulse-core,
  .map-legend-dot--green {
    animation: none;
  }
}
