/* ==========================================================================
   DESIGN SYSTEM - ĐẠI HỘI ĐẠI BIỂU TOÀN QUỐC LIÊN MINH HTX VIỆT NAM LẦN THỨ VII
   Chủ đề: 19 THÔNG ĐIỆP – CHUNG MỘT TINH THẦN HỢP TÁC
   ========================================================================== */

:root {
  /* Bảng màu Chính luận - Ngoại giao - Cao cấp */
  --color-red-primary: #C8102E;
  /* Đỏ son cờ Tổ quốc */
  --color-red-deep: #8A0E17;
  /* Đỏ thắm ngoại giao */
  --color-red-burgundy: #4E0A0F;
  /* Đỏ Burgundy quyền quý */
  --color-red-darkest: #2A0508;
  /* Đỏ sẫm nền chiều sâu */

  --color-gold-champagne: #D4AF37;
  /* Vàng hoàng gia / champagne */
  --color-gold-light: #F3E5AB;
  /* Vàng ánh kim sáng */
  --color-gold-dark: #997A15;
  /* Vàng kim đậm viền */
  --color-gold-glow: rgba(212, 175, 55, 0.4);

  --color-cream-bg: #FAF7F0;
  /* Trắng ngà giấy cao cấp */
  --color-cream-card: #FFFFFF;
  /* Trắng tinh letter sheet */
  --color-paper-texture: #F4EFE6;
  /* Giấy vân mây */

  --color-text-main: #1F1919;
  /* Chữ đen mun chính luận */
  --color-text-muted: #5C5252;
  /* Chữ ghi trầm đọc dịu mắt */
  --color-text-light: #EFE9E7;
  /* Chữ sáng trên nền đỏ */
  --color-text-gold: #E5C365;
  /* Chữ vàng kim điểm nhấn */

  /* Typography */
  --font-encode: 'Encode Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-sans-ui: 'Encode Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-decorative: 'Encode Sans', sans-serif;
  --font-serif-title: 'Encode Sans', sans-serif;
  --font-serif-body: 'Lora', 'Georgia', serif;

  /* Shadows & Glassmorphism */
  --shadow-letter: 0 20px 50px rgba(0, 0, 0, 0.35), 0 5px 15px rgba(0, 0, 0, 0.1);
  --shadow-gold: 0 0 25px rgba(212, 175, 55, 0.35);
  --shadow-node: 0 8px 20px rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(42, 5, 8, 0.75);
  --glass-border: rgba(212, 175, 55, 0.25);

  --transition-smooth: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base Setup */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--color-red-darkest);
  color: var(--color-text-light);
}

body {
  font-family: var(--font-sans-ui);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  background: radial-gradient(circle at 50% 30%, #700c14 0%, #3d050a 60%, #1a0204 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Background Texture & Ornaments */
.bg-overlay-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(rgba(212, 175, 55, 0.08) 1px, transparent 0),
    radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: 40px 40px, 80px 80px;
  background-position: 0 0, 20px 20px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
}

.bg-radial-vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 1;
}

/* Header & Institutional Branding */
.site-header {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2.5rem 1.5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.header-national-emblem {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--color-gold-champagne);
  padding: 6px 18px;
  border-radius: 40px;
  font-size: 0.85rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-gold-light);
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-national-emblem svg {
  width: 18px;
  height: 18px;
  fill: var(--color-gold-champagne);
}

.main-title {
  font-family: var(--font-decorative);
  font-size: clamp(1.4rem, 3.2vw, 2.5rem);
  font-weight: 700;
  color: var(--color-gold-light);
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1.3;
  text-shadow: 0 3px 12px rgba(241, 54, 54, 0.6);
  margin-bottom: 0.5rem;
}

.main-title span {
  display: block;
  font-size: clamp(1.6rem, 3.8vw, 2.8rem);
  background: linear-gradient(135deg, #FFF6D5 0%, #D4AF37 50%, #F5DEB3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.congress-term {
  display: inline-block;
  font-family: var(--font-serif-title);
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  letter-spacing: 4px;
  color: #FFFFFF;
  margin-bottom: 1rem;
  position: relative;
  padding: 0 20px;
}

.congress-term::before,
.congress-term::after {
  content: "♦";
  color: var(--color-gold-champagne);
  font-size: 0.8rem;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.congress-term::before {
  left: 0;
}

.congress-term::after {
  right: 0;
}

.main-tagline {
  font-family: var(--font-serif-title);
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  font-style: italic;
  font-weight: 600;
  color: #FFF2CD;
  margin-bottom: 0.75rem;
  letter-spacing: 1px;
}

.intro-lead {
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  color: rgba(255, 255, 255, 0.85);
  max-width: 820px;
  margin: 0 auto 1.5rem;
  font-weight: 300;
}

/* Category Filter Bar */
.filter-bar-container {
  position: relative;
  z-index: 5;
  max-width: 980px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  background: rgba(40, 5, 8, 0.65);
  border: 1px solid var(--glass-border);
  padding: 8px 12px;
  border-radius: 50px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.8);
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-btn:hover {
  color: var(--color-gold-light);
  border-color: rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.1);
}

.filter-btn.active {
  background: linear-gradient(135deg, #D4AF37 0%, #B8860B 100%);
  color: #1A0508;
  font-weight: 700;
  border-color: var(--color-gold-champagne);
  box-shadow: 0 2px 10px var(--color-gold-glow);
}

/* Reading Layer (Modal / Letter Overlay) */
.letter-reader-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(18, 2, 4, 0.92);
  backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  overflow-y: auto;
  padding: 1.5rem;
}

.letter-reader-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.letter-container {
  width: 100%;
  max-width: 1100px;
  margin: auto;
  position: relative;
  animation: modalScaleUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalScaleUp {
  0% {
    transform: scale(0.92) translateY(30px);
    opacity: 0;
  }

  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Top Navigation Bar of Reader */
.reader-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(50, 6, 10, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: 40px;
  backdrop-filter: blur(10px);
}

.nav-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--color-gold-champagne);
  color: var(--color-gold-light);
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  text-transform: uppercase;
  transition: var(--transition-smooth);
}

.nav-back-btn:hover {
  background: var(--color-gold-champagne);
  color: var(--color-red-darkest);
  box-shadow: var(--shadow-gold);
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Language Mode Switcher */
.lang-mode-toggle {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  padding: 3px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 25px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.lang-btn.active {
  background: var(--color-gold-champagne);
  color: var(--color-red-darkest);
  font-weight: 700;
}

.nav-counter {
  font-family: var(--font-decorative);
  color: var(--color-gold-light);
  font-size: 0.9rem;
  letter-spacing: 1.5px;
}

/* The Diplomatic Letter Card */
.diplomatic-letter-card {
  background-color: var(--color-cream-bg);
  background-image:
    radial-gradient(#E8E0D2 1px, transparent 0),
    linear-gradient(to bottom, #FFFDF9, #FAF5EA);
  background-size: 24px 24px, 100% 100%;
  color: var(--color-text-main);
  border-radius: 8px;
  box-shadow: var(--shadow-letter);
  border: 12px solid #FFFFFF;
  outline: 2px solid var(--color-gold-champagne);
  padding: 3.5rem 3.5rem 3rem;
  position: relative;
  overflow: hidden;
}

.diplomatic-letter-card::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  pointer-events: none;
}

/* Watermark Seal */
.letter-watermark-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 320px;
  opacity: 0.035;
  pointer-events: none;
  z-index: 0;
}

/* Letter Header */
.letter-header {
  position: relative;
  z-index: 1;
  border-bottom: 2px solid rgba(212, 175, 55, 0.4);
  padding-bottom: 1.8rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.letter-badge-col {
  display: flex;
  align-items: center;
  gap: 15px;
}

.letter-number-emblem {
  width: 58px;
  height: 58px;
  background: var(--color-red-primary);
  border: 2px solid var(--color-gold-champagne);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold-light);
  font-family: var(--font-decorative);
  font-size: 1.3rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(181, 18, 27, 0.3);
}

.letter-org-info h2 {
  font-family: var(--font-serif-title);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 700;
  color: var(--color-red-deep);
  line-height: 1.3;
}

.letter-org-info .org-sub {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.letter-meta-col {
  text-align: right;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.letter-meta-col .flag-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  color: #6B4E08;
  margin-bottom: 4px;
}

/* Letter Body Columns */
.letter-content-wrapper {
  position: relative;
  z-index: 1;
}

/* 2-Column Split Mode */
.letter-content-wrapper.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.letter-column {
  font-family: var(--font-serif-body);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--color-text-main);
  text-align: justify;
}

.letter-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans-ui);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-red-primary);
  margin-bottom: 1.2rem;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.5);
}

.letter-text p {
  margin-bottom: 1.25rem;
  text-indent: 1.5em;
}

.letter-text p:first-of-type {
  text-indent: 0;
}

.letter-text .letter-salutation {
  font-weight: 600;
  text-indent: 0;
  margin-bottom: 1.2rem;
}

.letter-sign-off {
  margin-top: 2rem;
  text-indent: 0 !important;
  font-style: normal;
  border-top: 1px solid rgba(212, 175, 55, 0.3);
  padding-top: 1rem;
}

.letter-sign-off .signer-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-red-deep);
}

.letter-sign-off .signer-title {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Single View Mode (when toggled on mobile/tablet or selected) */
.letter-content-wrapper.single-vi .col-en {
  display: none;
}

.letter-content-wrapper.single-en .col-vi {
  display: none;
}

.letter-content-wrapper.single-vi,
.letter-content-wrapper.single-en {
  grid-template-columns: 1fr;
  max-width: 820px;
  margin: 0 auto;
}

/* Bottom Letter Navigation (Prev / Next) */
.reader-bottom-nav {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(212, 175, 55, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-direction-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--color-red-primary);
  color: #FFFFFF;
  border: 1px solid var(--color-gold-champagne);
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-direction-btn:hover {
  background: var(--color-red-deep);
  box-shadow: 0 4px 15px rgba(181, 18, 27, 0.4);
  transform: translateY(-2px);
}

.nav-direction-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Quick Dock Floating Minimap */
.minimap-dock {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(30, 4, 6, 0.85);
  padding: 10px 6px;
  border-radius: 30px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.minimap-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(212, 175, 55, 0.4);
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}

.minimap-dot:hover {
  background: var(--color-gold-champagne);
  transform: scale(1.3);
}

.minimap-dot.active {
  background: var(--color-gold-champagne);
  border-color: #FFFFFF;
  box-shadow: 0 0 10px var(--color-gold-champagne);
  transform: scale(1.4);
}

.minimap-dot.read {
  background: var(--color-red-primary);
  border-color: var(--color-gold-champagne);
}

.minimap-dot::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 25px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: #1F0306;
  border: 1px solid var(--color-gold-champagne);
  color: var(--color-gold-light);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.minimap-dot:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Closing Section */
.closing-section {
  position: relative;
  z-index: 10;
  max-width: 1100px;
  margin: 4rem auto;
  padding: 3.5rem 2rem;
  text-align: center;
  background: radial-gradient(circle at 50% 50%, rgba(138, 14, 23, 0.8) 0%, rgba(42, 5, 8, 0.95) 100%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.closing-emblem {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
}

.closing-title {
  font-family: var(--font-decorative);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  color: var(--color-gold-light);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

.closing-text {
  font-family: var(--font-serif-body);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: rgba(255, 255, 255, 0.9);
  max-width: 750px;
  margin: 0 auto 2rem;
  line-height: 1.8;
}

.closing-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.closing-stat-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.25);
  padding: 1.5rem 1rem;
  border-radius: 10px;
}

.closing-stat-number {
  font-family: var(--font-decorative);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-gold-champagne);
}

.closing-stat-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Site Footer */
.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2.5rem 1rem;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(20, 2, 4, 0.9);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
}

.site-footer p {
  margin-bottom: 0.4rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .diplomatic-letter-card {
    padding: 2.5rem 2rem;
  }

  .letter-content-wrapper.split-view {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .minimap-dock {
    display: none;
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 1.5rem 1rem 1rem;
  }

  .diplomatic-letter-card {
    padding: 1.8rem 1.2rem;
    border-width: 6px;
  }

  .letter-header {
    flex-direction: column;
    gap: 1rem;
  }

  .letter-meta-col {
    text-align: left;
  }

  .reader-top-nav {
    flex-direction: column;
    gap: 10px;
    border-radius: 16px;
    padding: 0.8rem;
  }

  .reader-actions {
    width: 100%;
    justify-content: space-between;
  }

  .letter-column {
    font-size: 1rem;
    line-height: 1.75;
  }
}