:root {
  --color-bg: #232946;
  --color-bg-alt: #1a1f33;
  --color-primary: #2196f3;
  --color-secondary: #3e497a;
  --color-card: #232946;
  --color-card-alt: #1a1f33;
  --color-text: #fff;
  --color-label: #bfc8e6;
  --color-footer: #232946;
  --color-footer-alt: #3e497a;
  --color-gradient: linear-gradient(120deg, #232946 0%, #3e497a 100%);
  --color-gradient-info: linear-gradient(120deg, #2196f3 0%, #3e497a 100%);
  --color-shadow: 0 8px 40px rgba(35, 41, 70, 0.13);
  --color-shadow-hover: 0 16px 64px rgba(35, 41, 70, 0.18);
}
body.light-mode {
  --color-bg: #f4f6fb;
  --color-bg-alt: #fff;
  --color-primary: #1976d2;
  --color-secondary: #bfc8e6;
  --color-card: #fff;
  --color-card-alt: #f4f6fb;
  --color-text: #232946;
  --color-label: #3e497a;
  --color-footer: #e0e6f8;
  --color-footer-alt: #bfc8e6;
  --color-gradient: linear-gradient(120deg, #e0e6f8 0%, #bfc8e6 100%);
  --color-gradient-info: linear-gradient(120deg, #e3f0ff 0%, #bfc8e6 100%);
  --color-shadow: 0 8px 40px rgba(180, 200, 240, 0.13);
  --color-shadow-hover: 0 16px 64px rgba(180, 200, 240, 0.18);
}
body {
  background: var(--color-gradient);
  min-height: 100vh;
  font-family: 'Montserrat', Arial, sans-serif;
  color: var(--color-text);
  transition: background 0.3s, color 0.3s;
}

.page-wrapper {
  /* This wrapper helps isolate stacking contexts */
}

.hero {
  /* position: relative; */
  padding: 20px 16px 80px 16px;
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.25), rgba(35, 41, 70, 0.7));
}
body.light-mode .hero {
  background: linear-gradient(135deg, #e8f3ff, #f9fbff);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 55%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}
.hero-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.hero-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--color-secondary);
  box-shadow: 0 12px 36px rgba(33, 150, 243, 0.25);
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}
body.light-mode .hero-brand {
  background: rgba(25, 118, 210, 0.12);
  color: var(--color-primary);
  border: 1px solid var(--color-label);
  box-shadow: 0 8px 26px rgba(25, 118, 210, 0.18);
}
.hero-title {
  font-size: clamp(2.1rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  color: #fff;
}
body.light-mode .hero-title {
  color: #0d1b2a;
}
.hero-lead {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.12rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.86);
}
body.light-mode .hero-lead {
  color: #4a5568;
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.hero-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(33, 150, 243, 0.22);
  background: var(--color-primary);
}
body.light-mode .hero-link {
  background: rgba(25, 118, 210, 0.08);
  border-color: rgba(25, 118, 210, 0.18);
  color: var(--color-primary);
}
body.light-mode .hero-link:hover {
  color: #fff;
}
.hero-note {
  font-size: 0.95rem;
  color: var(--color-label);
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 820px;
  line-height: 1.6;
}
body.light-mode .hero-note {
  color: #5c6672;
  background-color: rgba(25, 118, 210, 0.05);
  border-color: rgba(25, 118, 210, 0.15);
}

.page-shell {
  max-width: 1100px;
  margin: -60px auto 60px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
@media (max-width: 900px) {
  .page-shell {
    margin-top: -60px;
    padding: 0 12px;
  }
}
@media (max-width: 600px) {
  .page-shell {
    margin-top: -50px;
    padding: 0 8px;
  }
}

.surface {
  background: var(--color-card);
  border-radius: 28px;
  padding: 20px;
  box-shadow: var(--color-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.surface:hover {
  transform: translateY(-6px);
  box-shadow: var(--color-shadow-hover);
}
body.light-mode .surface {
  background: #fff;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}
.card-title {
  font-size: 1.55rem;
  font-weight: 800;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text);
}
.card-title i {
  color: var(--color-primary);
  font-size: 1.4rem;
}
body.light-mode .card-title {
  color: #0d1b2a;
}
.card-subtitle {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-label);
}

.dashboard-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 992px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }
}

.info-card {
  display: flex;
  flex-direction: column;
  padding-bottom: 16px;
}

.result-panel {
  margin-top: 24px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}
.field-group {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group-full {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.convert-card {
  gap: 24px;
}
.convert-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.convert-grid {
  display: grid;
  gap: 16px 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stat-items-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stat-item {
  display: flex;
  align-items: center;
  gap: 18px;
  border-radius: 22px;
  padding: 16px;
  background: var(--color-card-alt);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border 0.22s ease;
}
.stat-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(33, 150, 243, 0.18);
  border-color: rgba(33, 150, 243, 0.35);
}
body.light-mode .stat-item {
  background: #f7f9ff;
  border: 1px solid rgba(25, 118, 210, 0.14);
}
.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(33, 150, 243, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 1.3rem;
}
body.light-mode .stat-icon {
  background: rgba(25, 118, 210, 0.12);
}
.stat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-content > span:first-child {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text);
}
.stat-label {
  font-size: 0.95rem;
  color: var(--color-label);
  font-weight: 600;
}
.stat-note {
  font-size: 0.85rem;
  color: var(--color-primary);
  font-style: italic;
}

.convert-result {
  background: var(--color-card-alt);
  border-radius: 22px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  margin-top: 24px; /* Thêm khoảng cách với phần tử bên trên */
  gap: 18px;
}
body.light-mode .convert-result {
  background: #f7f9ff;
  border: 1px solid rgba(25, 118, 210, 0.14);
}
.result-cols {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.result-code {
  color: var(--color-label);
  font-weight: 500;
}

.selected-info-inline {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

a, a:hover, a:visited, a:active, a:focus {
  text-decoration: none !important;
}

.theme-toggle {
  position: relative;
  background: var(--color-card);
  color: var(--color-primary);
  border: none;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 6px 24px rgba(33, 150, 243, 0.15);
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}
.theme-toggle:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(33, 150, 243, 0.22);
}
.main-header {
  max-width: 1200px;
  margin: 8px auto 0 auto;
  background: var(--color-card);
  color: var(--color-text);
  border-radius: 32px;
  box-shadow: var(--color-shadow);
  padding: 6px;
  transition: box-shadow 0.3s, background 0.3s, color 0.3s;
  box-sizing: border-box;
  margin-bottom: 48px;
}
.main-header:hover {
  box-shadow: var(--color-shadow-hover);
}
.header-content {
  display: flex;
  flex-direction: column;
}
.header-top {
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  text-align: center;
  padding: 8px 0 6px 0;
  margin: 0 auto 6px auto;
  max-width: 900px;
}
.header-title {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  letter-spacing: 1px;
  margin-bottom: 10px;
  text-shadow: 0 2px 8px var(--color-shadow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-title i {
  color: var(--color-primary);
  font-size: 2.1rem;
  filter: drop-shadow(0 2px 8px var(--color-shadow));
}
.header-desc {
  color: var(--color-label);
  font-size: 1.08rem;
  margin-top: 0;
  margin-bottom: 0;
  font-weight: 500;
  opacity: 0.92;
}
.header-source {
  margin-top: 8px;
  margin-bottom: 0;
}
.header-source a {
  color: var(--color-primary);
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.9;
  transition: opacity 0.3s, color 0.3s;
}
.header-source a:hover {
  opacity: 1;
  color: var(--color-primary);
  text-shadow: 0 0 8px rgba(33, 150, 243, 0.3);
}
.header-source i {
  margin-right: 6px;
}
.form-box {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  margin-top: 0;
  background: transparent;
  color: var(--color-text);
  border: none;
  padding: 10px 6px 6px 6px;
  transition: box-shadow 0.3s, background 0.3s, color 0.3s;
}
.form-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
}
.form-title i {
  color: var(--color-primary);
  font-size: 1.5rem;
}
.form-label {
  font-weight: 600;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1.08rem;
}
.form-label i {
  font-size: 1.1rem;
}
.form-select, .form-control {
  background: var(--color-card-alt);
  color: var(--color-text);
  border-radius: 16px;
  box-shadow: none;
  border: 1.5px solid var(--color-secondary);
  font-size: 1.12rem;
  padding: 8px 12px;
  transition: border 0.2s, background 0.3s, color 0.3s;
}
.form-select:focus, .form-control:focus {
  border: 1.5px solid var(--color-primary);
  outline: none;
  background: var(--color-bg-alt);
}
.search-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  position: relative;
}
.search-group input {
  flex: 1;
  min-width: 0;
  border-radius: 16px;
  background: var(--color-card);
  color: var(--color-text);
  border: 1.5px solid var(--color-secondary);
  font-size: 1.12rem;
  padding: 8px 12px;
  transition: border 0.2s, background 0.3s, color 0.3s;
}
.search-group input:focus {
  border: 1.5px solid var(--color-primary);
  background: var(--color-bg-alt);
}
.clear-btn {
  background: var(--color-secondary);
  border: none;
  border-radius: 14px;
  color: #fff;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.clear-btn:hover {
  background: var(--color-primary);
  transform: translateY(-1px);
}
.search-btn {
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border: none;
  border-radius: 14px;
  color: #fff;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 2px 12px rgba(35, 41, 70, 0.13);
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
}
.search-btn:hover {
  background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-primary) 100%);
  box-shadow: 0 6px 24px rgba(35, 41, 70, 0.18);
  transform: translateY(-2px) scale(1.07);
}
#result {
  min-height: 0;
  padding: 0;
  margin: 0;
}
#result .alert-info {
  margin: 16px auto 0 auto;
  max-width: 340px;
  font-size: 1.01rem;
  background: rgba(33,150,243,0.08);
  color: var(--color-primary);
  border-radius: 12px;
  padding: 10px 8px;
  box-shadow: 0 2px 8px rgba(33,150,243,0.07);
}
#result ul.list-group {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(35, 41, 70, 0.08);
  background: var(--color-card);
  color: var(--color-text);
  transition: background 0.3s, color 0.3s;
}
#result .list-group-item {
  white-space: normal !important;
  word-break: break-word;
  font-size: 1.13rem;
  color: var(--color-text);
  background: var(--color-card);
  border: none;
  border-bottom: 1px solid var(--color-secondary);
  padding: 12px 16px;
  transition: background 0.3s, color 0.3s;
}
#result .list-group-item:last-child {
  border-bottom: none;
}
@media (max-width: 900px) {
  .main-header {
    padding: 18px 14px;
  }
  .header-content, .stat-box {
    width: 100%;
    max-width: 100%;
  }
  .form-box, .stat-box {
    max-width: 100vw;
    margin-left: 0;
    margin-right: 0;
  }
}
@media (max-width: 600px) {
  html, body {
    font-size: 14px;
  }
  .main-header {
    padding: 16px !important;
    border-radius: 0 !important;
    margin: 0 !important;
    max-width: 100vw !important;
    background: var(--color-card) !important;
    color: var(--color-text) !important;
    box-shadow: var(--color-shadow) !important;
    margin-bottom: 32px;
  }
  .header-top {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .theme-toggle {
    position: static;
    align-self: flex-end;
    margin-bottom: 4px;
    margin-right: 0;
    top: auto;
    right: auto;
    margin-left: auto;
  }
  .header-title {
    font-size: 0.95rem;
    color: var(--color-primary);
  }
  .selected-info-title {
    font-size: 1.05rem;
    margin-bottom: 12px;
  }
  .selected-info-label {
    font-size: 0.82rem;
  }
  .selected-info-value {
    font-size: 0.98rem;
    padding: 0 2px;
  }
  .selected-info-group {
    padding: 6px;
    border-radius: 10px;
    margin-bottom: 8px;
  }
  .info-icon-wrapper {
    width: 32px;
    height: 32px;
    margin-right: 8px;
  }
  .info-icon-wrapper i {
    font-size: 1rem;
  }
}
.custom-footer {
  background: var(--color-gradient);
  color: var(--color-text);
  border-radius: 32px;
  margin: 12px auto 0 auto;
  max-width: 1100px;
  padding: 4px 6px 2px 6px;
  font-family: 'Montserrat', Arial, sans-serif;
  box-shadow: 0 4px 24px rgba(35, 41, 70, 0.10);
  font-size: 0.95rem;
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  padding-bottom: 10px;
  margin-bottom: 8px;
  gap: 8px;
}
.footer-col {
  font-size: 1.05rem;
  font-weight: 600;
  opacity: 0.97;
  color: var(--color-label);
}
.footer-col.right {
  text-align: right;
  font-size: 0.92rem;
  color: var(--color-primary);
  font-weight: 500;
}
.footer-col.center {
  text-align: center;
  flex: 2;
  color: var(--color-label);
}
.footer-col.left {
  flex: 1;
}
.footer-col.right, .footer-col.left {
  flex: 1;
}
.footer-col i {
  margin-right: 6px;
  color: var(--color-primary);
}
@media (max-width: 900px) {
  .custom-footer {
    padding: 6px 4px 2px 4px;
    border-radius: 0;
    max-width: 100vw;
  }
  .footer-row {
    flex-direction: column;
    align-items: stretch;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
    gap: 4px;
  }
  .footer-col {
    text-align: center !important;
    margin-bottom: 2px;
  }
  .footer-col.right {
    font-size: 0.95rem;
  }
}
.form-control::placeholder, .form-select::placeholder, input::placeholder {
  color: var(--color-label) !important;
  opacity: 1;
}
.form-control, .form-select, input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.selected-info {
  background: var(--color-card-alt);
  border-radius: 22px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border 0.3s ease, box-shadow 0.3s ease;
}
body.light-mode .selected-info {
  background: #f7f9ff;
  border: 1px solid rgba(25, 118, 210, 0.14);
}

.selected-info-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  gap: 10px;
}
.selected-info-title i {
  color: var(--color-primary);
}

.selected-info-group {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.selected-info-group:last-of-type {
  margin-bottom: 0;
}
.selected-info-group:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(33, 150, 243, 0.18);
}
body.light-mode .selected-info-group {
  background: #fff;
  border: 1px solid rgba(25, 118, 210, 0.12);
}

.info-icon-wrapper {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: rgba(33, 150, 243, 0.16);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 1.2rem;
}
body.light-mode .info-icon-wrapper {
  background: rgba(25, 118, 210, 0.12);
}

.info-text-wrapper {
  flex-grow: 1;
}

.selected-info-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-label);
  margin: 0;
}

.selected-info-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
  word-break: break-word;
}

#mergerInfoContainer .selected-info-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
}

.suggestion-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 100;
  background: var(--color-card);
  color: var(--color-text);
  border-radius: 0 0 14px 14px;
  box-shadow: 0 4px 24px rgba(35, 41, 70, 0.10);
  max-height: 320px;
  overflow-y: auto;
  margin-top: 2px;
  padding: 0;
  list-style: none;
  border: 1.5px solid var(--color-label);
  border-top: none;
}
.suggestion-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-bg-alt);
  transition: background-color 0.2s;
}
.suggestion-item:last-child {
  border-bottom: none;
}
.suggestion-item:hover, .suggestion-item.active {
  background-color: var(--color-primary);
}
.suggestion-item:hover .suggestion-title,
.suggestion-item:hover .suggestion-sub,
.suggestion-item:hover .suggestion-type-label,
.suggestion-item:hover .suggestion-match-hint {
  color: #fff;
}
.suggestion-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.suggestion-title {
  font-size: 1.13rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0;
}
.suggestion-sub {
  font-size: 0.9em;
  opacity: 0.7;
  margin-top: 2px;
}
.suggestion-type-label {
  font-size: 0.92em;
  font-weight: 700;
  border-radius: 12px;
  padding: 2px 8px;
  background: var(--color-bg-alt);
  color: var(--color-secondary);
  margin-left: 8px;
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 2px;
}
.suggestion-type-label.ward {
  background: var(--color-text);
  color: var(--color-primary);
}
.suggestion-type-label.province {
  background: var(--color-label);
  color: var(--color-primary);
}
.suggestion-match-hint {
  display: block;
  font-size: 0.85em;
  font-style: italic;
  opacity: 0.75;
  color: var(--color-primary);
  margin-top: 2px;
}
@media (max-width: 600px) {
  .suggestion-list {
    font-size: 0.98rem;
    border-radius: 0 0 10px 10px;
  }
  .suggestion-item {
    padding: 6px;
    gap: 7px;
  }
  .suggestion-title {
    font-size: 1.01rem;
  }
}
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -12px;
  margin-right: -12px;
}
.row > * {
  box-sizing: border-box;
  padding-left: 12px;
  padding-right: 12px;
  margin-bottom: 24px;
  flex: 0 0 auto;
  width: 100%;
}
@media (min-width: 992px) {
  .main-header > .row > * {
    padding: 0 12px;
  }
  .col-lg-7 { flex: 0 0 auto; width: 58.333333%; }
  .col-lg-5 { flex: 0 0 auto; width: 41.666667%; }
  .col-lg-8 { flex: 0 0 auto; width: 66.666667%; }
  .col-lg-12 { flex: 0 0 auto; width: 100%; }
  .col-lg-4 {
    flex: 0 0 auto;
    width: 33.333333%;
  }
}
@media (min-width: 768px) {
  .col-md-6 { flex: 0 0 auto; width: 50%; }
}
#selectedMergerDetails {
  display: block;
  font-weight: 600;
  background: rgba(33, 150, 243, 0.15);
  border-radius: 12px;
  padding: 4px 8px;
  margin-top: 6px;
  color: var(--color-text);
  word-break: break-word;
}
body.light-mode #selectedMergerDetails {
  background: rgba(25, 118, 210, 0.12);
  color: var(--color-primary);
}

#oldUnitsCountLabel {
  font-style: normal !important;
  font-weight: 600;
  color: var(--color-label);
  opacity: 0.9;
}

.search-result-sub-note {
  font-size: 0.9em;
  opacity: 0.8;
}
.search-result-old-unit-note {
  font-size: 0.9em;
  opacity: 0.8;
  font-style: italic;
  color: var(--color-primary);
}

.info-text-wrapper {
  flex-grow: 1;
}

.stat-note {
  font-size: 0.8em;
  font-style: italic;
  opacity: 0.8;
  margin-top: 2px;
}

#provinceMergedWithGroup .selected-info-value#selectedProvinceMergedWith {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-left: 2px;
} 

#adminCenterGroup .selected-info-value#selectedAdministrativeCenter {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-left: 2px;
}

body:not(.light-mode) #adminCenterGroup .selected-info-value#selectedAdministrativeCenter,
body:not(.light-mode) #provinceMergedWithGroup .selected-info-value#selectedProvinceMergedWith {
  color: var(--color-text);
  font-weight: 700;
}

#selectedProvinceLabel, #selectedProvince {
  display: inline-block;
  vertical-align: middle;
}
#selectedProvinceLabel {
  margin-right: 8px;
}

/* ==== CSS cho form chuyển đổi địa chỉ ==== */
.address-full-box {
  background: rgba(33, 150, 243, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.05rem;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  font-family: inherit;
}
body.light-mode .address-full-box {
  background: #e3f2fd;
}

.copy-btn {
  background: var(--color-card);
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  border-radius: 8px;
  padding: 3px 12px;
  font-size: 1rem;
  font-weight: 700;
  margin-left: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(33,150,243,0.07);
  outline: none;
  font-family: inherit;
}

.copy-btn:hover, .copy-btn:focus {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(33,150,243,0.13);
}

.form-actions {
  display: flex;
  gap: 18px;
  margin-top: 22px;
}

.convert-btn {
  background: var(--color-gradient-info);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 0;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  display: flex; /* Thêm display flex */
  align-items: center; /* Căn giữa theo chiều dọc */
  justify-content: center; /* Căn giữa theo chiều ngang */
  flex: 1 1 0;
  transition: background 0.3s, color 0.3s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(33,150,243,0.10);
  letter-spacing: 0.01em;
}

.convert-btn:hover, .convert-btn:focus {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(33,150,243,0.18);
}

body.light-mode .convert-btn {
  background: var(--color-primary);
  color: #fff;
  border: 2px solid var(--color-primary);
  box-shadow: 0 2px 8px rgba(33,150,243,0.18);
}
body.light-mode .convert-btn:hover, body.light-mode .convert-btn:focus {
  background: #1769aa;
  color: #fff;
  border-color: #1769aa;
}

.initial-info-image-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}


.reset-btn {
  background: var(--color-footer);
  color: var(--color-text);
  border: none;
  border-radius: 12px;
  padding: 10px 0;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  display: flex; /* Thêm display flex */
  align-items: center; /* Căn giữa theo chiều dọc */
  justify-content: center; /* Căn giữa theo chiều ngang */
  flex: 1 1 0;
  transition: background 0.3s, color 0.3s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(33,150,243,0.07);
  letter-spacing: 0.01em;
}

.reset-btn:hover, .reset-btn:focus {
  background: var(--color-footer-alt);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(33,150,243,0.13);
}
.convert-btn i, .reset-btn i {
  margin-right: 8px; /* Khoảng cách giữa icon và chữ */
  margin-left: 0;
  font-size: 1.1em;
}
.convert-btn i, .reset-btn i {
  margin-right: 8px; /* Khoảng cách giữa icon và chữ */
  margin-left: 0;
  font-size: 1.1em;
}

.result-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--color-primary);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: -0.5px;
}

.result-address-box {
  background: rgba(76, 175, 80, 0.15);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
  color: #2e7d32;
  font-size: 1.18rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1.5px solid #a5d6a7;
  font-family: inherit;
}
body.light-mode .result-address-box {
  background: #e8f5e9;
}

.result-col {
  background: var(--color-bg-alt);
  border-radius: 12px;
  padding: 14px;
  color: var(--color-text);
  border: 1px solid var(--color-secondary);
  font-family: inherit;
}

.result-col-title {
  font-weight: 700;
  font-size: 1.08rem;
  margin-bottom: 8px;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
}

/* Responsive styles for copy buttons on mobile */
@media (max-width: 600px) {
  .copy-btn {
    font-size: 0; /* Ẩn văn bản bên trong nút */
    width: 30px;  /* Đặt chiều rộng cố định */
    height: 30px; /* Đặt chiều cao cố định */
    padding: 0;   /* Xóa padding */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    flex-shrink: 0; /* Ngăn nút bị co giãn không đồng đều */
  }

  .copy-btn i {
    font-size: 1rem; /* Khôi phục kích thước cho icon */
    flex-shrink: 0;  /* Ngăn icon bị co giãn không đồng đều */
  }
}

@media (max-width: 600px) {
  .surface,
  .stat-item,
  .selected-info,
  .convert-result {
    padding: 12px;
  }
}

/* ==== TAB NAVIGATION ==== */
.convert-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--color-secondary);
  justify-content: center;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-label);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==== TAB NAVIGATION ==== */
.convert-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--color-secondary);
  justify-content: center;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-label);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

/* ==== TAB NAVIGATION ==== */
.convert-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--color-secondary);
  justify-content: center;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-label);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

/* ==== TAB NAVIGATION ==== */
.convert-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--color-secondary);
  justify-content: center;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-label);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

/* ==== Donate Card (in-form) ==== */
.donate-wrapper {
  margin-top: 24px; /* Thêm khoảng cách với phần tử bên trên */
}

.donate-card {
  background: var(--color-card);
  border: 1px dashed rgba(33, 150, 243, 0.35);
  border-radius: 22px;
  padding: 14px 18px;
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  box-sizing: border-box; /* Đảm bảo padding không làm tăng chiều rộng */
}
body.light-mode .donate-card {
  background: #fef8e7;
  border-color: rgba(255, 193, 7, 0.45);
}
.donate-toggle {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s ease, color 0.2s ease;
}
.donate-toggle:hover, .donate-toggle.active {
  transform: translateY(-2px);
  color: #f06292;
}
.donate-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--color-label);
  align-items: center;
  max-width: 360px;
  text-align: center;
}
.donate-thanks { color: #f06292; font-weight: 600; }
.paypal-donate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #0070ba; /* PayPal blue */
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  margin-top: 15px; /* Space from QR code */
  transition: background-color 0.2s ease, transform 0.2s ease;
  width: fit-content; /* Adjust width to content */
}
.paypal-donate-btn:hover {
  background-color: #005ea6; /* Darker blue on hover */
  transform: translateY(-2px);
}