/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Surfaces: white -> light green, matched to cropalliance.net (Apple Green brand) */
  --bg-2: #f7fbf0;
  /* Brand accent (site: Apple Green) */
  --accent-green: #77b200;
  --accent-green-dark: #5f8e00;
  --accent-glow: rgba(119, 178, 0, 0.22);
  /* Text */
  --text-main: #1a1a1a;
  --text-heading: #14210a;
  --text-muted: #686868;
  /* Cards */
  --glass-bg: rgba(255, 255, 255, 0.86);
  --glass-border: rgba(119, 178, 0, 0.20);
  --glass-border-hover: rgba(119, 178, 0, 0.60);
  --font-family: 'Plus Jakarta Sans', 'Noto Sans TC', -apple-system, sans-serif;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-2);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* Background: white -> light green gradient with subtle leaf grid */
.bg-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(45deg, rgba(119, 178, 0, 0.045) 0, rgba(119, 178, 0, 0.045) 1px, transparent 0, transparent 30px),
    repeating-linear-gradient(-45deg, rgba(119, 178, 0, 0.045) 0, rgba(119, 178, 0, 0.045) 1px, transparent 0, transparent 30px),
    linear-gradient(160deg, #ffffff 0%, #f7fbf0 42%, #e6f3d2 100%);
  z-index: -2;
}

.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.7;
  animation: floatOrb 12s ease-in-out infinite alternate;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(147, 194, 9, 0.22) 0%, rgba(255, 255, 255, 0) 70%);
  top: -100px;
  left: 20%;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(119, 178, 0, 0.16) 0%, rgba(255, 255, 255, 0) 70%);
  bottom: -150px;
  right: 15%;
  animation-delay: -6s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, 20px) scale(1.1); }
  100% { transform: translate(-20px, 40px) scale(0.95); }
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 1100px;
  min-height: 100vh;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

/* Header & Logo — logo sits directly on the light surface, like the reference nav */
.top-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.logo-wrapper {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
}

.logo-wrapper:hover {
  transform: translateY(-2px);
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

/* Hero Section */
.hero-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: auto 0;
  padding: 1.5rem 0;
}

.main-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 3rem;
}

.title-line {
  line-height: 1.25;
}

.title-tc {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #4d7f00 0%, #77b200 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-en,
.title-pt {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Site Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(310px, 390px));
  gap: 2rem;
  justify-content: center;
  width: 100%;
}

/* Card Styling */
.region-card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2rem 1.8rem;
  text-decoration: none;
  color: var(--text-main);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(60, 100, 0, 0.10);
}

.card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(119, 178, 0, 0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.region-card:hover {
  transform: translateY(-8px);
  border-color: var(--glass-border-hover);
  box-shadow: 0 18px 40px rgba(60, 100, 0, 0.16), 0 0 30px var(--accent-glow);
}

.region-card:hover .card-glow {
  opacity: 1;
}

/* Card Header */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.flag-container {
  width: 52px;
  height: 35px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(60, 100, 0, 0.18), 0 0 0 1px rgba(20, 33, 10, 0.08);
  display: flex;
}

.flag-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.region-badge {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--accent-green-dark);
  background: rgba(119, 178, 0, 0.12);
  padding: 0.35rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(119, 178, 0, 0.25);
  text-align: right;
  max-width: 70%;
}

/* Card Body */
.card-body {
  margin-bottom: 1.8rem;
  text-align: left;
}

.region-name {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 1.65rem;
  font-weight: 700;
}

.name-en {
  color: var(--text-heading);
}

.name-local {
  font-size: 1.4rem;
  color: var(--accent-green-dark);
  font-weight: 600;
}

/* Card Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(20, 33, 10, 0.08);
}

.visit-text {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.region-card:hover .visit-text {
  color: var(--accent-green);
}

.action-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(119, 178, 0, 0.12);
  border: 1px solid rgba(119, 178, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-green-dark);
  transition: all 0.3s ease;
}

.action-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.region-card:hover .action-btn {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(119, 178, 0, 0.45);
}

.region-card:hover .action-btn svg {
  transform: translateX(3px);
}

/* Footer Info */
.footer-info {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: #8a9384;
  text-align: center;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(24, 37, 11, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(119, 178, 0, 0.30);
  border-radius: 24px;
  padding: 2.2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(40, 70, 0, 0.25), 0 0 40px rgba(119, 178, 0, 0.12);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  position: relative;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(119, 178, 0, 0.12);
  border: 1px solid rgba(119, 178, 0, 0.30);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-green);
  margin: 0 auto 0.5rem auto;
}

.modal-icon svg {
  width: 28px;
  height: 28px;
}

.modal-x-btn {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: transparent;
  border: none;
  color: #9aa38f;
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
}

.modal-x-btn:hover {
  color: var(--accent-green-dark);
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1.4rem;
}

.modal-messages {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.8rem;
}

.msg-card {
  background: rgba(119, 178, 0, 0.06);
  border: 1px solid rgba(119, 178, 0, 0.14);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  text-align: left;
}

.msg-card p {
  font-size: 0.92rem;
  color: #4a5540;
  line-height: 1.4;
}

.modal-close-btn {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, #77b200, #5f8e00);
  border: none;
  border-radius: 14px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(119, 178, 0, 0.35);
  transition: all 0.25s ease;
}

.modal-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(119, 178, 0, 0.5);
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: 1fr;
    max-width: 380px;
  }
  
  .title-tc {
    font-size: 2rem;
  }
  
  .title-en,
  .title-pt {
    font-size: 1.15rem;
  }
  
  .top-header {
    justify-content: center;
  }
}