/* ═══════════════════════════════════════════════════════
   Clarity for College — Modal System (Design System v2)
   Drop-in replacement for modal.css
   ═══════════════════════════════════════════════════════ */

/* ── Overlay / Backdrop ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 28, 62, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.35s ease;
}

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

/* ── SLIDE MODAL (page info — right side panel) ── */
.modal-content {
  background-color: white;
  position: fixed;
  top: 6rem;
  right: -600px;
  width: 90%;
  max-width: 520px;
  height: calc(100vh - 8.5rem);
  overflow-y: auto;
  padding: 0;
  border-radius: 20px 0 0 20px;
  box-shadow:
    -8px 0 30px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1001;
}

.modal-overlay.show .modal-content {
  right: 0;
}

.modal-overlay.closing .modal-content {
  animation: slideToIcon 0.4s ease-in-out forwards;
}

@keyframes slideToIcon {
  0% {
    right: 0;
    opacity: 1;
    transform: scale(1);
  }
  100% {
    right: -300px;
    opacity: 0;
    transform: scale(0.3) translateY(-200px);
  }
}

/* ── Close Button ── */
.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: #6b7280;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 1002;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.12);
  color: #111827;
}

/* On dark backgrounds (intro hero), make close button light */
.modal-center .modal-close {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
}
.modal-center .modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ── Modal Body (shared wrapper — provides padding for legacy content) ── */
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 2rem 2.5rem 2.5rem;
}

/* ═══════════════════════════════════
   INTRO MODAL — Hero banner + body
   ═══════════════════════════════════ */

/* Dark hero banner at top of intro modals */
.modal-hero-banner {
  background: linear-gradient(160deg, #0a1c3e 0%, #10274E 100%);
  border-radius: 0.5rem 0.5rem 0 0;
  padding: 2.75rem 2.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle grid texture */
.modal-hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 117, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 117, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Decorative orb */
.modal-hero-orb {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.2;
  background: #0075FF;
  top: -60px;
  right: -40px;
}

/* Eyebrow pill */
.modal-hero-eyebrow {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 117, 255, 0.15);
  border: 1px solid rgba(0, 117, 255, 0.25);
  border-radius: 100px;
  padding: 0.35rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #3d9aff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  font-family: 'Roboto', sans-serif;
}

.modal-hero-eyebrow .dot {
  width: 5px;
  height: 5px;
  background: #F5A623;
  border-radius: 50%;
  animation: dotPulse 2s ease infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Hero title */
.modal-hero-banner h1,
.modal-hero-banner .modal-headline {
  position: relative;
  z-index: 1;
  font-family: 'Roboto', sans-serif;
  font-size: 2.75rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
  margin-bottom: 0.4rem;
  border: none;
  padding: 0;
  text-align: center;
}

/* Page count subtitle */
.modal-hero-banner .page-count {
  position: relative;
  z-index: 1;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  font-family: 'Roboto', sans-serif;
}

/* Intro modal body section (below the banner) */
.modal-intro-body {
  padding: 2rem 2.5rem 2.5rem;
}

.modal-intro-body p {
  font-size: 1rem;
  line-height: 1.7;
  color: #374151;
  margin-bottom: 1rem;
  font-family: 'Roboto', sans-serif;
}

/* Highlighted hint box */
.modal-path-hint {
  display: flex;
  gap: 0.75rem;
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.modal-path-hint .hint-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(0, 117, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.modal-path-hint .hint-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #374151;
  font-family: 'Roboto', sans-serif;
}

/* Inline highlight chip */
.inline-chip {
  display: inline;
  background: rgba(0, 117, 255, 0.15);
  color: #0075FF;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 1rem;
}

/* Blue callout text */
.modal-callout {
  color: #0075FF;
  font-weight: 600;
  font-size: 1.05rem;
}

/* CTA button (replaces modal-attention-box) */
.modal-cta {
  display: block;
  width: 100%;
  padding: 1rem;
  margin-top: 1.75rem;
  background: #0075FF;
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-family: 'Roboto', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0, 117, 255, 0.3);
  text-align: center;
  text-decoration: none;
}

.modal-cta:hover {
  background: #0066dd;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 117, 255, 0.4);
}

/* ═══════════════════════════════════════
   PAGE INFO MODAL — Right-side panel
   ═══════════════════════════════════════ */

/* Info header area */
.modal-info-header {
  padding: 2.5rem 2.5rem 0;
}

.modal-info-header .info-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0075FF;
  margin-bottom: 0.5rem;
  font-family: 'Roboto', sans-serif;
}

.modal-info-header h2,
.modal-info-header .modal-headline {
  font-family: 'Roboto', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  border: none;
  padding: 0;
  margin: 0;
}

/* Info body area */
.modal-info-body {
  padding: 1.5rem 2.5rem 1.5rem;
}

.modal-info-body p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #374151;
  margin-bottom: 1rem;
  font-family: 'Roboto', sans-serif;
}

/* Feature pills */
.info-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0;
}

.info-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  font-family: 'Roboto', sans-serif;
}

/* Footer takeaway */
.modal-info-footer {
  padding: 1.25rem 2.5rem 2.25rem;
  border-top: 1px solid #f3f4f6;
}

.modal-info-footer .takeaway,
.modal-info-footer .modal-footer-headline {
  font-family: 'Roboto', sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
  color: #0a1c3e;
  line-height: 1.5;
  text-align: center;
  font-style: italic;
  border: none;
  padding: 0;
  margin: 0;
}

/* ═══════════════════════════════
   LEGACY CLASS COMPATIBILITY
   (keeps old content strings working
   until you migrate them)
   ═══════════════════════════════ */

/* Old headline style — still works but now styled better */
.modal-headline {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0a1c3e;
  margin-bottom: 1rem;
  text-align: left;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
  font-family: 'Roboto', sans-serif;
}

/* Old body p — still works */
.modal-body p {
  line-height: 1.7;
  color: #374151;
  margin-bottom: 0.75rem;
  font-family: 'Roboto', sans-serif;
  font-size: 0.95rem;
}

/* Old footer headline — still works */
.modal-footer-headline {
  font-size: 1.15rem;
  font-weight: 500;
  color: #0a1c3e;
  text-align: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f3f4f6;
  font-family: 'Roboto', sans-serif;
  font-style: italic;
}

/* Old attention box — still works but styled as new CTA */
.modal-attention-box {
  display: block;
  width: 100%;
  padding: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  background: #0075FF;
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-family: 'Roboto', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0, 117, 255, 0.3);
  text-align: center;
}

.modal-attention-box:hover {
  background: #0066dd;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 117, 255, 0.4);
}

/* Old data points — still works */
.modal-data-points {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.modal-data-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-data-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0a1c3e;
  font-family: 'Roboto', sans-serif;
}

.modal-data-description {
  font-size: 0.875rem;
  font-style: italic;
  color: #374151;
  line-height: 1.5;
  font-family: 'Roboto', sans-serif;
}


/* ═══════════════════════════════
   CENTER MODAL (Intro modals)
   ═══════════════════════════════ */
.modal-overlay.modal-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-overlay.modal-center .modal-content {
  position: relative !important;
  right: auto !important;
  top: auto !important;
  width: 90%;
  max-width: 640px;
  height: auto;
  border-radius: 20px;
  padding: 0;
  transform: scale(0.95) translateY(12px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
  opacity: 0;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

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

.modal-overlay.modal-center.closing .modal-content {
  animation: centerFadeOut 0.3s ease-in-out forwards;
}

@keyframes centerFadeOut {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0;
  }
}


/* ═══════════════════════════════
   Responsive
   ═══════════════════════════════ */
@media (max-width: 768px) {
  .modal-content {
    width: 100%;
    max-width: 100%;
    right: -100%;
    border-radius: 0;
  }

  .modal-overlay.modal-center .modal-content {
    max-width: 95%;
    border-radius: 16px;
  }

  .modal-hero-banner {
    padding: 2.25rem 1.75rem 1.5rem;
  }

  .modal-hero-banner h1,
  .modal-hero-banner .modal-headline {
    font-size: 2.25rem;
  }

  .modal-intro-body,
  .modal-info-header,
  .modal-info-body,
  .modal-info-footer {
    padding-left: 1.75rem;
    padding-right: 1.75rem;
  }

  /* Modal body padding — reduce horizontal on tablet/mobile */
  .modal-body {
    padding: 1.5rem 1.75rem 2rem;
  }

  /* Slide modal — reduce top gap on mobile */
  .modal-content {
    top: 4rem;
    height: calc(100vh - 5rem);
  }

  /* Center modal — add max-height and scroll for long content */
  .modal-overlay.modal-center .modal-content {
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Close button — enlarge touch target for mobile */
  .modal-close {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
    top: 1rem;
    right: 1rem;
  }

  /* Dark stat rows — allow wrapping on narrow screens */
  .modal-dark-stat {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
}

/* ── Small phones (<=480px) ── */
@media (max-width: 480px) {
  /* Slide modal — full screen on small phones */
  .modal-content {
    top: 0;
    height: 100vh;
    border-radius: 0;
  }

  /* Center modal — nearly full width, tighter radius */
  .modal-overlay.modal-center .modal-content {
    max-width: 98%;
    max-height: 92vh;
    border-radius: 12px;
  }

  /* Hero banner — compact padding and smaller title */
  .modal-hero-banner {
    padding: 2rem 1.25rem 1.25rem;
  }

  .modal-hero-banner h1,
  .modal-hero-banner .modal-headline {
    font-size: 1.75rem;
  }

  .modal-hero-eyebrow {
    font-size: 0.65rem;
    padding: 0.25rem 0.75rem;
  }

  /* Reduce all section horizontal padding */
  .modal-body {
    padding: 1.25rem 1.25rem 1.5rem;
  }

  .modal-intro-body,
  .modal-info-header,
  .modal-info-body,
  .modal-info-footer {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .modal-info-header {
    padding-top: 1.75rem;
  }

  /* Smaller heading in info panel */
  .modal-info-header h2,
  .modal-info-header .modal-headline {
    font-size: 1.35rem;
  }

  /* Legacy headline — scale down */
  .modal-headline {
    font-size: 1.25rem;
  }

  /* Body text — slightly smaller */
  .modal-body p,
  .modal-info-body p,
  .modal-intro-body p {
    font-size: 0.9rem;
  }

  /* CTA button — slightly smaller text, less shadow */
  .modal-cta,
  .modal-attention-box {
    font-size: 1rem;
    padding: 0.85rem;
    border-radius: 12px;
  }

  /* Info pills — ensure they don't overflow */
  .info-pill {
    font-size: 0.8rem;
    padding: 0.3rem 0.65rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Path hint box — stack vertically on small screens */
  .modal-path-hint {
    flex-direction: column;
    padding: 0.85rem 1rem;
  }

  /* Dark stat rows — stack label above value */
  .modal-dark-stat {
    flex-direction: column;
    gap: 0.15rem;
  }

  /* Footer text — smaller */
  .modal-info-footer .takeaway,
  .modal-info-footer .modal-footer-headline,
  .modal-footer-headline {
    font-size: 0.95rem;
  }

  /* Hide decorative orb on very small screens to avoid any bleed */
  .modal-hero-orb {
    display: none;
  }
}


/* ═══════════════════════════════════════════════════════
   DARK MODAL VARIANT — for dark-theme pages
   e.g. College Hour Calculator (tool_black_sidebar_design)
   Triggered by passing 'slide-dark' to showModal()
   ═══════════════════════════════════════════════════════ */

/* Dark backdrop — deeper black instead of navy */
.modal-overlay.modal-dark {
  background-color: rgba(0, 0, 0, 0.75);
}

/* Dark panel */
.modal-overlay.modal-dark .modal-content {
  background-color: #161616;
  border-left: 1px solid #2a2a2a;
  box-shadow:
    -8px 0 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* Dark close button */
.modal-overlay.modal-dark .modal-close {
  background: rgba(255, 255, 255, 0.06);
  color: #666;
}
.modal-overlay.modal-dark .modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e8e8e8;
}

/* ── Dark Info Header ── */
.modal-dark .modal-info-header {
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 1.5rem;
}

.modal-dark .modal-info-header .info-eyebrow {
  color: #f5c842;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.15em;
}

.modal-dark .modal-info-header h2,
.modal-dark .modal-info-header .modal-headline {
  color: #e8e8e8;
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
}

/* ── Dark Info Body ── */
.modal-dark .modal-info-body p {
  color: #999;
  font-family: 'IBM Plex Sans', sans-serif;
}

.modal-dark .modal-info-body strong {
  color: #e8e8e8;
}

/* Dark pills */
.modal-dark .info-pill {
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  color: #e8e8e8;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
}

/* Dark stat rows — for calculator-specific data callouts */
.modal-dark-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid #1e1e1e;
  font-family: 'IBM Plex Mono', monospace;
}
.modal-dark-stat:last-child { border-bottom: none; }

.modal-dark-stat .ds-label {
  font-size: 0.8rem;
  color: #666;
  letter-spacing: 0.05em;
}
.modal-dark-stat .ds-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f5c842;
}
.modal-dark-stat .ds-value.good { color: #4ecb71; }
.modal-dark-stat .ds-value.bad  { color: #e05a3a; }

/* ── Dark Info Footer ── */
.modal-dark .modal-info-footer {
  border-top: 1px solid #2a2a2a;
}

.modal-dark .modal-info-footer .takeaway,
.modal-dark .modal-info-footer .modal-footer-headline {
  color: #f5c842;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

/* ── Dark info icon (for dark-theme pages) ── */
.modal-info-icon.dark-icon {
  background-color: #1e1e1e;
  color: #666;
  border: 1px solid #2a2a2a;
}
.modal-info-icon.dark-icon:hover {
  background-color: #2a2a2a;
  color: #f5c842;
  border-color: #f5c842;
  transform: scale(1.1);
}
.modal-info-icon.dark-icon.icon-glow {
  background-color: #f5c842 !important;
  color: #000 !important;
  border-color: #f5c842 !important;
  box-shadow: 0 0 15px rgba(245, 200, 66, 0.5);
}

