/* Import Modern Typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --font-title: 'Outfit', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  /* Color Palette (Premium Dark Mode with HSL) */
  --bg-primary: #0b0f19;
  --bg-secondary: #131a2c;
  --bg-tertiary: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --color-active: #10b981;      /* Emerald Green for Active */
  --color-pending: #84cc16;     /* Lime/Diagonal Green for Pending */
  --color-ended: #ef4444;       /* Rose Red for Ended */
  --color-unknown: #475569;     /* Slate for Unknown */
  
  --border-color: #334155;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Header Area */
header {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 2.5rem 2rem;
  text-align: center;
  position: relative;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--color-active), var(--color-pending));
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
}

.logo-container {
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: center;
}

.site-logo {
  height: 38px;
  width: auto;
  display: block;
}

h1 {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Main Container Layout */
.main-container {
  display: flex;
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 2rem;
  gap: 2.5rem;
  min-height: calc(100vh - 200px);
}

.left-panel {
  flex: 1.2;
  position: sticky;
  top: 2rem;
  height: fit-content;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Legend Styles */
.legend {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 2rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  flex-wrap: wrap;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-color.active {
  background-color: var(--color-active);
}

.legend-color.pending {
  background-color: var(--color-pending);
  background-image: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(0,0,0,0.3) 2px, rgba(0,0,0,0.3) 4px);
}

.legend-color.ended {
  background-color: var(--color-ended);
}

.legend-color.unknown {
  background-color: var(--color-unknown);
}

/* Map Styling */
.map-container {
  width: 100%;
  max-width: 600px;
  position: relative;
}

svg.japan-map {
  width: 100%;
  height: auto;
  display: block;
}

svg.japan-map path {
  stroke: var(--bg-secondary);
  stroke-width: 1px;
  transition: var(--transition-smooth);
  cursor: pointer;
}

svg.japan-map path:hover {
  filter: brightness(1.2) drop-shadow(0 0 8px rgba(255,255,255,0.2));
  transform: translateY(-2px);
}

/* Dynamic Classes for Prefectures */
.pref-active {
  fill: var(--color-active) !important;
}

.pref-pending {
  fill: url(#pending-stripe) !important;
}

.pref-ended {
  fill: var(--color-ended) !important;
}

.pref-unknown {
  fill: var(--color-unknown) !important;
}

/* Red Accent Link Banner Styling */
.link-banner-red {
  width: 100%;
  margin-top: 2rem;
  background: linear-gradient(135deg, #22080c 0%, #110305 100%);
  border: 1px solid #dc2626;
  border-left: 5px solid #dc2626;
  box-shadow: 0 10px 30px rgba(220, 38, 38, 0.15);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.banner-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fca5a5;
  line-height: 1.35;
}

.banner-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.video-container {
  width: 100%;
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid #450a0a;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.banner-text-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.banner-highlight {
  font-weight: 700;
  color: #ffffff;
  font-size: 0.95rem;
}

.banner-link-button {
  margin-top: 0.5rem;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  padding: 0.8rem 1.25rem;
  border-radius: 0.5rem;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.banner-link-button:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
}

.banner-link-button svg {
  transition: transform 0.2s ease;
}

.banner-link-button:hover svg {
  transform: translateX(3px);
}

/* Tooltip */
.tooltip {
  position: absolute;
  background-color: rgba(19, 26, 44, 0.95);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 100;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  width: 280px;
}

.tooltip-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tooltip-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}

.tooltip-badge.active {
  background-color: rgba(16, 185, 129, 0.2);
  color: var(--color-active);
  border: 1px solid var(--color-active);
}

.tooltip-badge.pending {
  background-color: rgba(132, 204, 22, 0.2);
  color: var(--color-pending);
  border: 1px solid var(--color-pending);
}

.tooltip-badge.ended {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--color-ended);
  border: 1px solid var(--color-ended);
}

.tooltip-badge.unknown {
  background-color: rgba(71, 85, 105, 0.2);
  color: var(--text-secondary);
  border: 1px solid var(--color-unknown);
}

.tooltip-row {
  display: flex;
  margin-bottom: 0.35rem;
}

.tooltip-label {
  color: var(--text-secondary);
  width: 90px;
  flex-shrink: 0;
}

.tooltip-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Right Panel: Accordions */
.region-group {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: var(--transition-smooth);
}

.region-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.02);
  user-select: none;
}

.region-header:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.region-title {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.region-count {
  font-size: 0.8rem;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}

.region-arrow {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
}

.region-group.active .region-arrow {
  transform: rotate(180deg);
}

.region-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: rgba(0, 0, 0, 0.1);
}

.region-group.active .region-content {
  max-height: 1200px; /* Large enough to fit content */
}

/* Pref Cards Inside Region */
.pref-list {
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pref-row {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-smooth);
}

.pref-row:hover {
  transform: translateX(4px);
  border-color: var(--text-muted);
}

.pref-info-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pref-badge-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pref-badge-status.active {
  background-color: var(--color-active);
  box-shadow: 0 0 6px var(--color-active);
}

.pref-badge-status.pending {
  background-color: var(--color-pending);
  box-shadow: 0 0 6px var(--color-pending);
}

.pref-badge-status.ended {
  background-color: var(--color-ended);
}

.pref-badge-status.unknown {
  background-color: var(--color-unknown);
}

.pref-name {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 600;
  width: 80px;
}

.pref-dates {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pref-details {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.pref-limit {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  min-width: 70px;
}

.pref-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.pref-link-btn:hover {
  background-color: var(--color-active);
  color: #000000;
  border-color: var(--color-active);
}

/* Responsive Rules */
@media (max-width: 1024px) {
  .main-container {
    flex-direction: column;
    padding: 0 1rem;
    gap: 1.5rem;
  }
  
  .left-panel {
    position: static;
    width: 100%;
    padding: 1.5rem;
  }
  
  .right-panel {
    width: 100%;
  }

  .link-banner-red {
    margin-top: 1.5rem;
  }
}

footer {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: 4rem;
}
