html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body,
html {
  max-width: 100%;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

/* Global, careful transitions for interactive elements */
a,
button,
input,
select,
.percent-box,
.results-item,
.form-section,
.results-container,
.navbar,
.site-footer {
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease), transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}

/* Smooth page entrance for main sections */
@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeScale {
  from {
    opacity: 0;
    transform: scale(.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

:root {
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --border: #e5e7eb;
  --input-border: #ced4da;
  --input-border-hover: #b6c3d1;
  --ring: rgba(37, 99, 235, 0.18);
  --ring-strong: rgba(37, 99, 235, 0.24);
  --card: #f9fbff;
  --card-border: #e5eefc;
  --accent: #f1f5ff;
  --accent-border: #dfe8ff;
  --accent-text: #1e3a8a;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #b91c1c;
  --scroll-track: #e5e7eb;
  --scroll-thumb: #64748b;
  --scroll-thumb-light: #94a3b8;
  --nav-bg: #0b1f44;
  /* dark navy for accents and Apply button */
  --nav-text: #0b1f44;
  /* desktop link text navy */
  --nav-yellow: #f2b210;
  /* highlight/underline yellow */
  --footer-bg: #082044;
  --footer-dark: #061a36;
  --header-h: 64px;
  /* animation + transition */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --t-fast: 160ms;
  --t-med: 220ms;
  --t-slow: 360ms;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  padding: 0 16px 16px;
  max-width: 1000px;
  width: 95%;
  margin: 0 auto;
  text-align: center;
}

/* ========== NAVBAR ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Full-width navbar without negative margins */
.navbar {
  background: #ffffff;
  color: var(--nav-text);
  height: var(--header-h);
  display: grid;
  align-items: center;
  border-radius: 0;
  margin: 0;
  width: 100%;
  padding: 0 16px;
  position: relative;
  border-bottom: 2px solid var(--nav-yellow);
  box-shadow: 0 6px 22px rgba(2, 6, 23, 0.06);
}

/* Constrain inner width */
.nav-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.logo-dot {
  width: 12px;
  height: 12px;
  background: #ffd34d;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 211, 77, 0.2);
}

#brandLogo {
  display: block;
  height: 41px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  display: inline-block;
}

.brand-text {
  font-size: 1.05rem;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0;
  padding: 0;
  margin: 0;
  justify-self: end;
  align-items: stretch;
}

.nav-links>li {
  display: grid;
  align-items: center;
  border-left: 1px solid #e9eef5;
}

.nav-links>li:first-child {
  border-left: 0;
}

.nav-links a {
  color: var(--nav-text);
  text-decoration: none;
  font-weight: 700;
  padding: 0 16px;
  height: var(--header-h);
  display: inline-grid;
  place-items: center;
  letter-spacing: .2px;
}

.nav-links a:hover {
  color: var(--nav-yellow);
}

.nav-links a.active {
  color: var(--nav-yellow);
}

.nav-links .apply a {
  background: var(--nav-bg);
  color: #fff;
  height: calc(var(--header-h) - 12px);
  padding: 0 16px;
  border-radius: 4px;
  margin: 6px 0 6px 12px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.nav-links .apply a:hover {
  filter: brightness(1.05);
}

.hamburger {
  display: none;
  width: 40px;
  background: transparent;
  border: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 2px;
  justify-self: end;
  color: var(--nav-yellow);
  box-shadow: none;
}

.hamburger:hover {
  opacity: .9;
  background: none;
}


@media (max-width: 768px) {
  .hamburger {
    display: inline-flex;
  }

  /* Dropdown panel under navbar */
  .nav-links {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--header-h);
    background: #ffffff;
    display: grid;
    gap: 0;
    padding: 8px 8px 10px;
    border-bottom: 1px solid #eef2f7;
    transform-origin: top;
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;
    transition: transform .18s ease, opacity .18s ease;
    box-shadow: 0 16px 28px rgba(2, 6, 23, .16);
    z-index: 60;
  }

  .nav-links.open {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links>li {
    border-left: 0;
  }

  .nav-links li a {
    color: var(--nav-text);
    height: auto;
    padding: 14px 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border-radius: 8px;
  }
}

/* Backdrop for drawer */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .42);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 55;
}

.nav-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

h1 {
  color: var(--primary-700);
  margin: 12px 0 18px;
  padding-top: 10px;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* h1::after {
    content: "";
    display: block;
    width: 180px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-600) 100%);
} */

.form-group {
  margin-bottom: 12px;
  text-align: left;
}

/* Grouped sections (fieldset/legend) */
.form-section {
  grid-column: 1 / -1;
  padding: 0px 20px 5px 20px;
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
}

.form-section+.form-section {
  margin-top: 10px;
}

.section-title {
  grid-column: 1 / -1;
  margin: 0 0 8px;
  font-size: 0.85rem;
  /* color: var(--accent-text); */
  font-weight: 700;
  letter-spacing: .2px;
}

.section-title .kmcc {
  color: #15803d;
}

.section-title .ceea {
  color: #b45309;
}

.section-title .schoolb {
  color: cadetblue;
}

.form-section legend.section-title {
  padding: 0 10px;
  text-align: left;
}

.form-section legend {
  width: auto;
}

.form-section .form-group {
  margin-bottom: 10px;
}

/* Make fields inside section responsive grid */
.form-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

/* School section specific column modes */
#schoolSection.grid-3cols {
  grid-template-columns: repeat(3, minmax(230px, 1fr));
}

@media (max-width: 900px) {
  #schoolSection.grid-3cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width:500px) {
  #mphComingSoon {
    grid-column:1;
  }
}

#schoolSection.grid-2cols {
  grid-template-columns: repeat(2, minmax(230px, 1fr));
}

/* Let inner wrappers not create extra grid; flow children into parent grid */
#plusTwoFields,
#pclFields {
  display: contents;
}

/*  note banner */
.form-note {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  padding: 10px 12px;
  background: #f1f5ff;
  border: 1px solid #dfe8ff;
  color: #1e3a8a;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
}

/* Compact, responsive grid to reduce scrolling */
#scholarshipForm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  align-items: end;
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 3px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  font-size: 14px;
  /* keep label to one line */
  text-overflow: ellipsis;
  /* avoid wrapping without clipping hard */
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  box-sizing: border-box;
  /* Ensures padding doesn't increase width */
  font-size: 1em;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 120ms ease, background-color 180ms ease;
  background-color: #fff;
}

/* Modern dropdown styling */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%23677' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  padding-right: 36px;
}

select:hover {
  border-color: var(--input-border-hover);
  background-color: #fbfdff;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 4px var(--ring);
  transform: translateY(-1px);
}

input[type="text"]:focus-visible,
input[type="number"]:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring-strong);
}

.hint {
  display: block;
  font-size: 0.85em;
  color: var(--muted);
  margin-top: 6px;
}

button {
  background-color: var(--nav-bg);
  color: white;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.05em;
  width: 100%;
  margin-top: 6px;
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(8, 32, 68, 0.25);
}

button:hover {
  background-color: var(--footer-dark);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

/* Make submit button span full grid width */
#predictBtn {
  grid-column: 1 / -1;
  margin-bottom: 16px;
}

.results-container {
  margin-top: 20px;
  padding: 25px;
  background-color: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  text-align: left;
  display: none;
  /* Initially hidden */
  animation: fadeInUp 260ms ease both;
}

.results-container h1 {
  text-align: center;
  margin-bottom: 0;
}

/* Results heading themed colors */
.res-congrats {
  color: var(--primary-700);
}

.res-eligible {
  color: #15803d; /* success green used elsewhere */
  font-weight: 700;
}

.res-welcome {
  color: #e2ab1e; /* brand yellow */
  font-weight: 700;
}

.res-choose {
  color: var(--accent-text); /* deep accent navy */
  font-weight: 600;
}

.results-container h3 {
  color: var(--primary-700);
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.3rem;
  text-align: center;
}

.results-container p {
  margin-bottom: 10px;
  font-size: 1em;
}

.results-container p strong {
  color: var(--primary-700);
}

/* Results highlight section */
.results-highlight {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 12px 0 18px;
}

.percent-box {
  display: grid;
  place-items: center;
  padding: 18px 16px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.06);
}

.icon-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.percent-box.primary {
  border-color: #c7d2fe;
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
}

.percent-box.success {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
}

/* Emphasis style for Total Scholarship */
.percent-box.emphasis {
  border-color: var(--primary-600);
  background: linear-gradient(180deg, #ffffff 0%, #e8f0ff 100%);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.percent-icon {
  width: 28px;
  height: 28px;
  /* margin-bottom: 8px; */
  opacity: 0.9;
}

.percent-value {
  font-size: 2.3rem;
  font-weight: 900;
  color: var(--primary-700);
  letter-spacing: -0.5px;
}

.percent-box.success .percent-value {
  color: #15803d;
}

.percent-sub {
  margin-top: 6px;
  font-size: 0.95rem;
  color:#252525;
  font-weight: 800;
}

/* Results list (no boxes) after highlights */
.results-list {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.results-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--border);
  
}

.results-item:last-child {
  border-bottom: 0;
}

.results-item .label {
  color: var(--muted);
  font-size: 0.96rem;
}

.results-item .value {
  font-weight: 500;
  font-size: 1.02rem;
  color: var(--text);
}

.results-item .old {
  text-decoration: line-through;
  opacity: 0.7;
}

.results-item .good {
  color: #15803d;
}

.results-item .warn {
  color: #b45309;
}

.results-item .accent {
  color: var(--primary-700);
}

.item-icon {
  width: 22px;
  height: 22px;
  opacity: 0.9;
}

.error-message {
  color: var(--error-text);
  background-color: var(--error-bg);
  border: 1px solid var(--error-border);
  padding: 15px;
  border-radius: 10px;
  margin-top: 20px;
  font-weight: 500;
  text-align: left;
  display: block;
  /* Ensure it's block level for padding */
}

.error-message ul {
  margin-top: 5px;
  margin-bottom: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.error-message li {
  margin-bottom: 5px;
}

/* Nice rounded scrollbar (darker) */
/* WebKit */
*::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb-light);
  border-radius: 999px;
  border: 2px solid var(--scroll-track);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb);
}

/* Firefox */
body {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb-light) var(--scroll-track);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Subtle staggered entrance for form fields */
#scholarshipForm>* {
  opacity: 0;
  animation: fadeInUp 260ms ease both;
}

#scholarshipForm>*:nth-child(1) {
  animation-delay: 20ms;
}

#scholarshipForm>*:nth-child(2) {
  animation-delay: 40ms;
}

#scholarshipForm>*:nth-child(3) {
  animation-delay: 60ms;
}

#scholarshipForm>*:nth-child(4) {
  animation-delay: 80ms;
}

#scholarshipForm>*:nth-child(5) {
  animation-delay: 100ms;
}

#scholarshipForm>*:nth-child(6) {
  animation-delay: 120ms;
}

#scholarshipForm>*:nth-child(7) {
  animation-delay: 140ms;
}

#scholarshipForm>*:nth-child(8) {
  animation-delay: 160ms;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ========== FOOTER ========== */
.site-footer {
  margin-top: 28px;
  background: var(--footer-bg);
  color: #dbe7ff;
  border-radius: 0;
  overflow: hidden;
  width: 100%;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1.3fr 1.2fr;
  gap: 24px;
  padding: 26px 20px;
}

.footer-title {
  margin: 0 0 10px;
  color: #fff;
  font-weight: 700;
}

.footer-text {
  margin: 0 0 12px;
  color: #cfe1ff;
}

.socials {
  display: flex;
  gap: 10px;
}

.social-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 9px;
  text-decoration: none;
  transition: transform .18s ease, background .2s ease;
}

.social-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.14);
}

.footer-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
}

.footer-links,
.footer-info {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.footer-links a {
  color: #dbe7ff;
  text-decoration: none;
  position: relative;
  transition: color .2s ease, transform .15s ease;
}

.footer-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 60%;
  bottom: -2px;
  height: 2px;
  background: rgba(255, 255, 255, .25);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .2s ease;
}

.footer-links a:hover {
  color: #fff;
  transform: translateX(2px);
}

.footer-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.footer-bottom {
  background: var(--footer-dark);
  text-align: center;
  padding: 12px 10px;
  font-size: 0.92rem;
  display: grid;
  place-items: center;
}

@media (max-width: 900px) {
  .footer-top {
    grid-template-columns: 1fr;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }

  .footer-links-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  #schoolSection {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #schoolSection label {
    white-space: normal;
  }
}