/* ==========================================================================
   HAZEFREE RESEARCH PORTAL - MODERN CLEAN AIR / FOREST THEME
   Design System & Styling matching approved specification & UI mockup
   ========================================================================== */

/* --- 1. CSS VARIABLES & DESIGN TOKENS --- */
:root {
  /* Nature & Forest Color Palette */
  --primary-forest: #087A5B;
  --dark-forest: #064E3B;
  --emerald: #10B981;
  --emerald-light: #D1FAE5;
  
  /* Accent & System Colors */
  --sky-blue: #3B82F6;
  --sky-blue-light: #EFF6FF;
  --pm-orange: #F97316;
  --pm-orange-light: #FFF7ED;
  --fire-red: #EF4444;
  --fire-red-light: #FEF2F2;
  --predict-purple: #7C3AED;
  --predict-purple-light: #F5F3FF;
  
  /* Backgrounds */
  --bg-main: #EAF7EF;
  --bg-soft: #F1FAF4;
  --bg-card: #FFFFFF;
  --bg-card-glass: rgba(255, 255, 255, 0.92);
  --bg-footer: #063B2D;
  
  /* Text Colors */
  --text-primary: #12372A;
  --text-secondary: #5B7168;
  --text-muted: #8AA097;
  --text-white: #FFFFFF;
  
  /* Borders & Shadows */
  --border-subtle: rgba(8, 122, 91, 0.1);
  --border-light: #E2E8F0;
  --shadow-sm: 0 2px 6px rgba(8, 122, 91, 0.04);
  --shadow-card: 0 4px 18px rgba(8, 122, 91, 0.07);
  --shadow-card-hover: 0 10px 28px rgba(8, 122, 91, 0.14);
  --shadow-glass: 0 8px 32px 0 rgba(8, 78, 59, 0.12);
  
  /* Border Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  
  /* Typography */
  --font-family: 'Prompt', 'Noto Sans Thai', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-handwritten: 'Caveat', cursive;
  
  /* Layout Transitions */
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- 2. BASE & RESET --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-fast);
}

button, select, input {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

img {
  max-width: 100%;
  display: block;
}

/* --- 3. HEADER & NAVIGATION --- */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #FFFFFF;
  border-bottom: 1px solid rgba(8, 122, 91, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  height: 68px;
}

.header-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 28px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logo */
.portal-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon-wrap {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.leaf-logo-icon {
  width: 100%;
  height: 100%;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: 'Outfit', var(--font-family);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--dark-forest);
  line-height: 1;
  letter-spacing: 0.3px;
}

.logo-title-accent {
  color: var(--primary-forest);
}

.logo-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

/* Navigation Links */
.portal-nav {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  list-style: none;
  align-items: center;
  gap: 24px;
}

.nav-item {
  position: relative;
  padding: 6px 0;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.nav-item:hover .nav-link,
.nav-item.active .nav-link {
  color: var(--primary-forest);
  font-weight: 600;
}

.active-indicator {
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--primary-forest);
  border-radius: var(--radius-pill);
  transform: scaleX(1);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Search Box */
.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background-color: #F4F7F5;
  border: 1px solid rgba(8, 122, 91, 0.12);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  width: 270px;
  transition: all var(--transition-fast);
}

.search-box-wrap:focus-within {
  background-color: #FFFFFF;
  border-color: var(--primary-forest);
  box-shadow: 0 0 0 3px rgba(8, 122, 91, 0.1);
  width: 310px;
}

.search-icon {
  color: var(--text-muted);
  margin-right: 8px;
  flex-shrink: 0;
}

.search-input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.search-input::placeholder {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.search-quick-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 8px 0;
  z-index: 100;
}

.search-quick-results.show {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.search-result-item:hover {
  background: var(--bg-soft);
  color: var(--primary-forest);
}

/* Language Dropdown */
.lang-dropdown-wrap {
  position: relative;
}

.lang-btn {
  background: #F4F7F5;
  border: 1px solid rgba(8, 122, 91, 0.12);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.lang-btn:hover {
  background: #FFFFFF;
  color: var(--primary-forest);
}

.lang-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  min-width: 140px;
  overflow: hidden;
  z-index: 100;
}

.lang-menu.show {
  display: block;
}

.lang-option {
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.lang-option:hover, .lang-option.active {
  background: var(--bg-soft);
  color: var(--primary-forest);
  font-weight: 600;
}

/* Notification & User Profile */
.notification-wrap {
  position: relative;
}

.icon-action-btn {
  background: #F4F7F5;
  border: 1px solid rgba(8, 122, 91, 0.12);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.icon-action-btn:hover {
  background: #FFFFFF;
  color: var(--primary-forest);
  transform: translateY(-1px);
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: var(--fire-red);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  width: 300px;
  z-index: 100;
  overflow: hidden;
}

.notif-dropdown.show {
  display: block;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border-subtle);
}

.notif-header h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-count {
  font-size: 0.75rem;
  color: var(--fire-red);
  background: var(--fire-red-light);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.notif-list {
  max-height: 260px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(8, 122, 91, 0.05);
  transition: background var(--transition-fast);
}

.notif-item:hover {
  background: #FAFAFA;
}

.notif-item.unread {
  background: rgba(16, 185, 129, 0.04);
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--emerald);
  margin-top: 5px;
  flex-shrink: 0;
}

.notif-dot.read {
  background-color: #CBD5E1;
}

.notif-text {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 4px;
}

.notif-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.user-avatar-wrap {
  cursor: pointer;
}

.avatar-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--emerald);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.mobile-toggle-btn .bar {
  width: 22px;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition-fast);
}

.mobile-nav-drawer {
  display: none;
  background: #FFFFFF;
  border-top: 1px solid var(--border-subtle);
  padding: 20px 24px;
}

/* --- 4. HERO SECTION --- */
.portal-hero {
  position: relative;
  width: 100%;
  min-height: 412px;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.hero-bg-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
}

.hero-overlay-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(
      90deg,
      rgba(3, 28, 22, 0.82) 0%,
      rgba(4, 36, 28, 0.66) 38%,
      rgba(5, 40, 32, 0.38) 70%,
      rgba(5, 40, 32, 0.25) 100%
    ),
    linear-gradient(180deg, rgba(3, 28, 22, 0.25) 0%, rgba(3, 28, 22, 0) 35%, rgba(3, 28, 22, 0.35) 100%);
}

.hero-content-wrapper {
  position: relative;
  z-index: 2;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 48px;
}

/* Hero Left */
.hero-left-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(236, 253, 245, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 5px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-forest);
  width: fit-content;
  backdrop-filter: blur(8px);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary-forest);
}

.hero-title {
  font-size: 2.6rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.25;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  letter-spacing: -0.5px;
}

.title-highlight {
  color: #FFFFFF;
}

.hero-description {
  font-size: 1.08rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
  max-width: 660px;
}

/* Hero Buttons */
.hero-actions-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.btn-primary {
  background-color: var(--primary-forest);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(8, 122, 91, 0.3);
}

.btn-primary:hover {
  background-color: var(--dark-forest);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(8, 122, 91, 0.4);
}

.hero-actions-row .btn {
  padding: 13px 26px;
  font-size: 1.02rem;
}

.btn-glass {
  background: rgba(255, 255, 255, 0.9);
  color: var(--dark-forest);
  border: 1.5px solid var(--primary-forest);
  backdrop-filter: blur(10px);
}

/* Outline button on the dark hero */
.portal-hero .btn-glass {
  background: rgba(3, 28, 22, 0.25);
  color: #FFFFFF;
  border: 1.5px solid #10B981;
}

.portal-hero .btn-glass:hover {
  background: rgba(16, 185, 129, 0.2);
  color: #FFFFFF;
  border-color: #34D399;
}

.btn-glass:hover {
  background: #FFFFFF;
  border-color: var(--primary-forest);
  color: var(--primary-forest);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Hero Right: 3 Vertical Portal Cards */
.hero-portals-column {
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: 70%;
  justify-self: end;
}

.portal-card {
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  padding: 13px 15px;
  min-height: 73px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #FFFFFF;
  box-shadow: 0 10px 28px rgba(6, 59, 45, 0.22);
  transition: all var(--transition-smooth);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Decorative network pattern on the right side of each card */
.portal-card::after {
  content: "";
  position: absolute;
  inset: 0 0 0 45%;
  z-index: -1;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 110'%3E%3Cg stroke='%23ffffff' stroke-width='0.8' fill='none' opacity='0.7'%3E%3Cpath d='M20 90 L80 60 L140 80 L200 30 L260 55 L295 20'/%3E%3Cpath d='M80 60 L110 15 L200 30 M140 80 L170 105 L260 55 M110 15 L170 5'/%3E%3C/g%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='20' cy='90' r='2.5'/%3E%3Ccircle cx='80' cy='60' r='3'/%3E%3Ccircle cx='140' cy='80' r='2.5'/%3E%3Ccircle cx='200' cy='30' r='3.5'/%3E%3Ccircle cx='260' cy='55' r='3'/%3E%3Ccircle cx='110' cy='15' r='2'/%3E%3Ccircle cx='170' cy='105' r='2.5'/%3E%3Ccircle cx='295' cy='20' r='2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  background-position: right center;
  pointer-events: none;
}

.portal-card.card-green {
  background: linear-gradient(120deg, #05483A 0%, #076650 55%, #0A7D61 100%);
}

.portal-card.card-blue {
  background: linear-gradient(120deg, #0B6683 0%, #0B87A6 50%, #1BA8C2 100%);
}

.portal-card.card-lime {
  background: linear-gradient(120deg, #2E8F3E 0%, #46A844 55%, #6DBE4F 100%);
}

.portal-card:hover {
  transform: translateX(-4px) translateY(-2px);
  box-shadow: 0 16px 34px rgba(6, 59, 45, 0.3);
  border-color: #FFFFFF;
}

.portal-card-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 4px 10px rgba(0, 0, 0, 0.12);
  transition: transform var(--transition-fast);
}

.portal-card-icon-box svg {
  width: 21px;
  height: 21px;
}

.portal-card:hover .portal-card-icon-box {
  transform: scale(1.06);
}

/* Card Themes: icon tiles */
.portal-card.card-green .portal-card-icon-box {
  background: linear-gradient(145deg, #34D399, #0E9F6E);
}

.portal-card.card-blue .portal-card-icon-box {
  background: linear-gradient(145deg, #67E8F9, #0EA5E9);
}

.portal-card.card-lime .portal-card-icon-box {
  background: linear-gradient(145deg, #A7F3D0, #4ADE80);
  color: #0E7490;
}

.portal-card-content {
  flex-grow: 1;
}

.portal-card-title {
  font-family: 'Outfit', var(--font-family);
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 3px;
  line-height: 1.15;
}

.portal-card-desc {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.4;
}

.portal-card-arrow {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all var(--transition-fast);
}

.portal-card.card-green .portal-card-arrow { background: #22C3B5; }
.portal-card.card-blue .portal-card-arrow { background: #38D0F0; }
.portal-card.card-lime .portal-card-arrow { background: #3FCB6B; }

.portal-card-arrow svg {
  width: 15px;
  height: 15px;
}

.portal-card:hover .portal-card-arrow {
  transform: translateX(4px);
}

/* --- 5. MAIN CONTENT AREA --- */
.portal-main-content {
  background-color: var(--bg-main);
  padding: 24px 0 40px;
}

.section-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 28px;
}

.content-section {
  margin-bottom: 24px;
}

.section-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-icon-leaf {
  font-size: 1.2rem;
}

.section-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark-forest);
  letter-spacing: -0.2px;
}

.section-timestamp {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pulse-live-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald);
  box-shadow: 0 0 6px var(--emerald);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

/* --- 6. KEY METRICS & WEATHER GRID --- */
.metrics-weather-layout {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.2fr;
  gap: 16px;
  align-items: stretch;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.kpi-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-icon-pill {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bg-green-light { background: rgba(16, 185, 129, 0.12); }
.bg-orange-light { background: rgba(249, 115, 22, 0.12); }
.bg-blue-light { background: rgba(59, 130, 246, 0.12); }
.bg-purple-light { background: rgba(124, 58, 237, 0.12); }

.kpi-label-box {
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.kpi-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.kpi-value {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-value-unit {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-trend {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-down { color: var(--emerald); }
.trend-up { color: var(--pm-orange); }

.trend-icon {
  font-size: 0.9rem;
  font-weight: 700;
}

.kpi-sparkline {
  margin-top: 8px;
  height: 24px;
}

.sparkline-svg {
  width: 100%;
  height: 100%;
}

.kpi-status-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.kpi-status-text {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-primary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
}

.status-pill-good {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary-forest);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.kpi-card-link {
  position: absolute;
  right: 14px;
  bottom: 14px;
  transition: transform var(--transition-fast);
}

.kpi-card:hover .kpi-card-link {
  transform: translateX(3px);
}

/* Regional Weather Card */
.weather-scenic-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  color: #FFFFFF;
}

.weather-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 1;
}

.weather-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.78) 0%, rgba(15, 23, 42, 0.82) 100%);
  z-index: 2;
}

.weather-card-inner {
  position: relative;
  z-index: 3;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  gap: 8px;
}

.weather-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weather-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.weather-temp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weather-temp-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weather-sun-icon {
  font-size: 1.3rem;
}

.weather-temp-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.weather-condition-text {
  font-size: 0.8rem;
  color: #E2E8F0;
  font-weight: 500;
}

.weather-stats-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.weather-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
}

.chip-label {
  color: #CBD5E1;
}

.chip-val {
  font-weight: 600;
  color: #FFFFFF;
}

.color-good {
  color: #34D399;
}

/* --- 7. MAIN DATA EXPLORER (2-COLUMN GRID) --- */
.data-explorer-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: stretch;
}

.explorer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-main-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Filter Pills Group */
.filter-pills-group {
  display: flex;
  align-items: center;
  background: #F1F5F3;
  padding: 3px;
  border-radius: var(--radius-pill);
  gap: 2px;
}

.pill-btn {
  background: transparent;
  border: none;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill-btn:hover {
  color: var(--primary-forest);
}

.pill-btn.active {
  background: var(--primary-forest);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(8, 122, 91, 0.25);
}

/* Map Panel Viewport */
.map-viewport-wrapper {
  position: relative;
  width: 100%;
  height: 480px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(8, 122, 91, 0.1);
  background: #E8F5EE;
}

.gis-map-iframe,
.map-viewport-wrapper iframe {
  width: 100% !important;
  height: 100% !important;
  min-height: 480px;
  border: none !important;
  display: block;
}

.gis-map-canvas {
  width: 100%;
  height: 100%;
  background: #C4E2D8;
}

/* Map Floating GIS Legend */
.gis-legend-card {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 500;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(8, 122, 91, 0.15);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-card);
  font-size: 0.75rem;
}

.legend-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

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

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-range {
  font-weight: 600;
  color: var(--text-primary);
  width: 48px;
}

.legend-label {
  color: var(--text-secondary);
}

/* Map Floating Bottom Right Action */
.map-action-pill-wrap {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 500;
}

.map-action-pill-btn {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(8, 122, 91, 0.2);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-forest);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-fast);
}

.map-action-pill-btn:hover {
  background: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  color: var(--dark-forest);
}

/* Analytics Right Panel */
.analytics-filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-select-pill select {
  background: #F1F5F3;
  border: 1px solid rgba(8, 122, 91, 0.12);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  margin-bottom: 20px;
}

/* Top 5 Province Ranking */
.province-ranking-section {
  border-top: 1px solid rgba(8, 122, 91, 0.08);
  padding-top: 16px;
}

.ranking-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--dark-forest);
  margin-bottom: 12px;
}

.ranking-pill-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.rank-item-pill {
  background: #F8FAF9;
  border: 1px solid rgba(8, 122, 91, 0.1);
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.rank-item-pill:hover {
  background: #FFFFFF;
  border-color: var(--primary-forest);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.rank-number-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rank-1 { background: #FEE2E2; color: #DC2626; }
.rank-2 { background: #FFEDD5; color: #EA580C; }
.rank-3 { background: #FEF3C7; color: #D97706; }
.rank-4 { background: #DBEAFE; color: #2563EB; }
.rank-5 { background: #CCFBF1; color: #0D9488; }

.rank-province-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-value-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.badge-high { background: #FEE2E2; color: #DC2626; }
.badge-elevated { background: #FFEDD5; color: #EA580C; }
.badge-moderate { background: #FEF3C7; color: #D97706; }
.badge-normal { background: #E0F2FE; color: #0284C7; }

/* --- 8. NEWS & UPDATES + ENVIRONMENTAL CTA --- */
.section-view-all {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-forest);
  transition: var(--transition-fast);
}

.section-view-all:hover {
  color: var(--dark-forest);
  transform: translateX(3px);
}

.news-cta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.25fr;
  gap: 16px;
  align-items: stretch;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-smooth);
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.news-thumbnail-wrap {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
}

.news-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth);
}

.news-card:hover .news-thumbnail {
  transform: scale(1.06);
}

.news-category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(8px);
}

.badge-article { background: rgba(8, 122, 91, 0.9); color: #FFFFFF; }
.badge-research { background: rgba(59, 130, 246, 0.9); color: #FFFFFF; }
.badge-event { background: rgba(124, 58, 237, 0.9); color: #FFFFFF; }
.badge-knowledge { background: rgba(16, 185, 129, 0.9); color: #FFFFFF; }

.news-content-box {
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
  gap: 10px;
}

.news-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.news-title a {
  color: inherit;
}

.news-title a:hover {
  color: var(--primary-forest);
}

.news-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.news-arrow-icon {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-forest);
  transition: transform var(--transition-fast);
}

.news-card:hover .news-arrow-icon {
  transform: translateX(4px);
}

/* Environmental CTA Card */
.environmental-cta-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px;
  color: #FFFFFF;
  min-height: 200px;
}

.cta-card-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 1;
}

.cta-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(6, 78, 59, 0.3) 0%, rgba(6, 59, 45, 0.92) 100%);
  z-index: 2;
}

.cta-card-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cta-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  color: #FFFFFF;
}

.cta-card-desc {
  font-size: 0.82rem;
  color: #E2E8F0;
  line-height: 1.4;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #087A5B;
  color: #FFFFFF;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 6px;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all var(--transition-fast);
}

.cta-button:hover {
  background-color: #10B981;
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* --- 9. FOOTER --- */
.portal-footer {
  background-color: var(--bg-footer);
  color: #FFFFFF;
  padding: 36px 0 20px;
}

.footer-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 28px;
}

.footer-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 24px;
  margin-bottom: 20px;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-leaf-icon {
  width: 32px;
  height: 32px;
}

.footer-logo-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.72rem;
  color: #A7F3D0;
  font-weight: 500;
}

.footer-nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 22px;
}

.footer-nav-list a {
  font-size: 0.88rem;
  color: #E2E8F0;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-nav-list a:hover {
  color: #34D399;
}

.footer-social-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.social-circle-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  transition: all var(--transition-fast);
}

.social-circle-btn:hover {
  background: #10B981;
  color: #FFFFFF;
  transform: translateY(-2px);
}

.footer-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #94A3B8;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-powered {
  font-weight: 500;
  color: #CBD5E1;
}

/* --- 10. RESPONSIVE BREAKPOINTS --- */
@media (max-width: 1200px) {
  .hero-content-wrapper {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  
  .metrics-weather-layout {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .weather-scenic-card {
    grid-column: span 2;
  }
  
  .data-explorer-grid {
    grid-template-columns: 1fr;
  }
  
  .news-cta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .environmental-cta-card {
    grid-column: span 2;
  }
  
  .ranking-pill-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .portal-nav {
    display: none;
  }
  
  .mobile-toggle-btn {
    display: flex;
  }
  
  .mobile-nav-drawer.show {
    display: block;
  }
  
  .search-box-wrap {
    width: 200px;
  }
  
  .hero-content-wrapper {
    grid-template-columns: minmax(0, 1fr);
    padding: 24px 20px;
  }
  
  .hero-title {
    font-size: 1.8rem;
  }
  
  .hero-portals-column {
    margin-top: 10px;
    width: 100%;
  }
  
  .ranking-pill-list {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .footer-main-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .header-container {
    padding: 0 16px;
    gap: 10px;
  }

  .logo-icon-wrap {
    width: 36px;
    height: 36px;
  }

  .logo-title {
    font-size: 1.4rem;
  }

  .user-avatar-wrap {
    display: none;
  }

  .hero-content-wrapper {
    padding: 24px 16px;
  }

  .hero-title {
    font-size: 1.55rem;
    word-break: break-word;
  }

  .hero-description {
    font-size: 0.98rem;
  }

  .hero-actions-row {
    flex-wrap: wrap;
  }

  .section-container {
    padding: 0 16px;
  }

  .section-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .search-box-wrap {
    display: none;
  }
  
  .metrics-weather-layout {
    grid-template-columns: 1fr;
  }
  
  .weather-scenic-card {
    grid-column: span 1;
  }
  
  .news-cta-grid {
    grid-template-columns: 1fr;
  }
  
  .environmental-cta-card {
    grid-column: span 1;
  }
  
  .ranking-pill-list {
    grid-template-columns: 1fr;
  }
  
  .footer-nav-list {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .footer-bottom-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
