/* =========================
   RESET & BASE
========================= */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 16px 0;
  font-family: 'Outfit', sans-serif;
  background-color: #F2F2F2;
  color: #121212;
}

@media (min-width: 768px) {
  body {
    padding: 24px 0;
  }
}

@media (min-width: 1024px) {
  body {
    padding: 40px 0;
  }
}

/* =========================
   CONTAINER
========================= */
.container {
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .container {
    padding: 0 24px;
  }
}

/* =========================
   HERO CARD
========================= */
/* =========================
   HERO CARD
========================= */
.card.hero-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 768px) {
  .card.hero-card {
    padding: 16px;
  }
}

/* =========================
   CARD HEADER
========================= */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.full-logo { display: block; height: 32px; width: auto; }
.icon-logo { display: none;  height: 32px; width: auto; }

@media (max-width: 1024px) {
  .full-logo { display: none; }
  .icon-logo { display: block; }
}

.button-group { display: flex; gap: 12px; align-items: center; }

.primary-btn {
  height: 40px;
  padding: 0 20px;
  background: #121212;
  color: #FFFFFF;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s ease;
}
.primary-btn:hover  { background: #404040; }
.primary-btn:active { background: #7A7A7A; }

.secondary-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #E6E6E6;
  background: #F2F2F2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.secondary-btn:hover  { background: #CFCFCF; border-color: transparent; }
.secondary-btn:active { background: #7A7A7A; border-color: transparent; }

/* =========================
   HERO STATS
========================= */
.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.overall-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.overall-group h3,
.overall-group p { margin: 0; padding: 0; }

.overall-percentage {
  font-weight: 700;
  font-size: 36px;
  line-height: 44px;
  color: #121212;
}

.overall-text {
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #5C5C5C;
}

/* =========================
   STACKED BAR
========================= */
.bar-container {
  height: 12px;
  border-radius: 9999px;
  overflow: hidden;
  background: transparent;
}

.stacked-bar {
  display: flex;
  height: 100%;
  border-radius: 9999px;
}

/* Region / prefecture bars (thinner) */
.region-bar,
.prefecture-bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 9999px;
  overflow: hidden;
  background: transparent;
}

/* =========================
   CHIPS
========================= */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.chip-text {
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #5C5C5C;
}

.chip-text strong { font-weight: 700; color: #121212; }

/* =========================
   BREADCRUMBS (index)
========================= */
.breadcrumb {
  display: inline-block;
  background: #F2F2F2;
  color: #111111;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 15px;
  line-height: 24px;
}

/* =========================
   BREADCRUMBS (prefecture)
========================= */
.breadcrumb-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 16px;
}

.breadcrumb-link {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 8px;
  background: #F2F2F2;
  color: #121212;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.breadcrumb-link:hover { background: #CFCFCF; }

.breadcrumb-separator {
  display: flex;
  align-items: center;
}

.breadcrumb-active {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 8px;
  background: #E6E6E6;
  color: #121212;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
}

.section-title {
  font-weight: 700;
  font-size: 20px;
  line-height: 28px;
  color: #121212;
  margin: 0 0 16px 0;
  padding: 0;
}

/* =========================
   REGIONS SECTION
========================= */
.regions-section {
  margin-top: 24px;
}

.regions-grid {
  margin-top: 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1279px) { .regions-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 767px)  { .regions-grid { grid-template-columns: 1fr; } }

/* =========================
   REGION CARD
========================= */
.region-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s ease, box-shadow 0.15s ease;
}

.region-card:hover {
  outline-color: #121212;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.region-title {
  font-weight: 700;
  font-size: 20px;
  line-height: 28px;
  margin: 0;
  padding: 0;
}

.region-text {
  margin: 0;
  padding: 0;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #5C5C5C;
}

/* =========================
   REGION TITLE CARD (prefecture page)
========================= */
.card.region-title-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

/* =========================
   PREFECTURES SECTION
========================= */
.prefectures-section {
  margin-top: 24px;
}

.prefectures-grid {
  margin-top: 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1279px) { .prefectures-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 767px)  { .prefectures-grid { grid-template-columns: 1fr; } }

/* =========================
   PREFECTURE CARD
========================= */
.prefecture-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s ease, box-shadow 0.15s ease;
}

.prefecture-card:hover {
  outline-color: #121212;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.prefecture-card h6 {
  font-weight: 700;
  font-size: 18px;
  line-height: 26px;
  margin: 0;
  color: #121212;
}

/* =========================
   MUNICIPALITIES SECTION
========================= */
.municipalities-section {
  margin-top: 24px;
}

.municipalities-grid {
  margin-top: 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1279px) { .municipalities-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 767px)  { .municipalities-grid { grid-template-columns: 1fr; } }

/* =========================
   MUNICIPALITY CARD
========================= */
.municipality-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 16px;
}

.municipality-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.municipality-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.municipality-name {
  font-weight: 700;
  font-size: 16px;
  line-height: 24px;
  color: #121212;
}

/* =========================
   SCHOOL CHIPS
========================= */
.school-chips-container {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;
}

.school-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.school-chip img {
  flex-shrink: 0;
}

.school-chip-text {
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #5C5C5C;
}

.school-chip-text strong {
  font-weight: 700;
}

/* =========================
   TOGGLE GROUP
========================= */
.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  /* Toggle-on by default */
  background: #121212;
  color: #FFFFFF;
  border: 2px solid #121212;
}

.toggle-btn.off {
  background: transparent;
  color: #121212;
  border: 2px solid #121212;
}

/* =========================
   MODAL OVERLAY
========================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 18, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 24px;
}

.modal-overlay.open {
  opacity: 1;
}

/* =========================
   MODAL
========================= */
.modal {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transform: translateY(8px);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }
}

/* =========================
   MODAL HEADER
========================= */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-weight: 700;
  font-size: 24px;
  line-height: 32px;
  color: #121212;
  margin: 0;
}

.modal-close {
  flex-shrink: 0;
}

/* =========================
   MODAL FORM
========================= */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.01em;
  color: #121212;
}

/* =========================
   FORM INPUT
========================= */
.form-input {
  height: 40px;
  padding: 0 12px;
  border: 2px solid #737373;
  border-radius: 8px;
  background: #FFFFFF;
  font-family: 'Outfit', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: #737373;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.form-input::placeholder {
  color: #A0A0A0;
}

.form-input:focus {
  border-color: #121212;
  color: #737373;
}

.form-input.disabled,
.custom-select.disabled {
  background: #F2F2F2;
  border-color: #A0A0A0;
  color: #A0A0A0;
  cursor: not-allowed;
  pointer-events: none;
}

/* =========================
   CUSTOM SELECT
========================= */
.custom-select-wrapper {
  position: relative;
}

.custom-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.custom-select.active {
  border-color: #121212;
}

.select-text {
  flex: 1;
}

/* =========================
   SELECT DROPDOWN
========================= */
.select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #FFFFFF;
  border: 2px solid #737373;
  border-radius: 8px;
  padding: 12px;
  z-index: 100;
  box-sizing: border-box;
}

.select-dropdown.open {
  display: block;
}

.dropdown-option {
  padding: 8px;
  border-radius: 4px;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  line-height: 24px;
  color: #121212;
  cursor: pointer;
  transition: background 0.1s ease;
}

.dropdown-option:hover {
  background: #E6E6E6;
}

.dropdown-option.selected {
  background: #F2F2F2;
}

/* =========================
   MUNICIPALITY SEARCH
========================= */
.search-input-wrapper {
  position: relative;
}

.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #FFFFFF;
  border: 2px solid #737373;
  border-radius: 8px;
  padding: 12px;
  z-index: 200;
  box-sizing: border-box;
  max-height: 280px;
  overflow-y: auto;
}

.search-dropdown.open {
  display: block;
}

.search-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 4px;
  background: #F2F2F2;
  cursor: pointer;
  transition: background 0.1s ease;
  margin-bottom: 4px;
}

.search-result-row:last-child {
  margin-bottom: 0;
}

.search-result-row:hover {
  background: #E6E6E6;
}

.result-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: #121212;
  white-space: nowrap;
}

.result-sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #121212;
  flex-shrink: 0;
}

.result-sub {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: #737373;
  white-space: nowrap;
}

/* =========================
   SUBMIT BUTTON
========================= */
.modal-submit {
  width: 100%;
  height: 40px;
  margin-top: 8px;
}

/* =========================
   REJECT BUTTON
========================= */
.reject-btn {
  height: 40px;
  padding: 0 20px;
  background: #F2F2F2;
  color: #121212;
  border: 2px solid #E6E6E6;
  border-radius: 9999px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.reject-btn:hover  { background: #CFCFCF; border-color: #CFCFCF; }
.reject-btn:active { background: #A0A0A0; border-color: #A0A0A0; }