/* ============================================================
   PROGRAM MODAL — Pop-up chi tiết ngành học
   Drop-in CSS. Phụ thuộc CSS variables --haui-* đã có sẵn trong index.html.
   ============================================================ */

/* Click affordance for major cards */
.major-card[data-program-id] {
  cursor: pointer;
  user-select: none;
}
.major-card[data-program-id]:focus-visible {
  outline: 3px solid var(--haui-yellow);
  outline-offset: 4px;
}

/* Backdrop */
.prog-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 37, 71, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow-y: auto;
}
.prog-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Modal container */
.prog-modal {
  background: var(--haui-cream, #FDFAF3);
  border-radius: 24px;
  max-width: 880px;
  width: 100%;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 24px 64px rgba(15, 37, 71, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.2);
  transform: scale(0.94) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.prog-modal-backdrop.open .prog-modal {
  transform: scale(1) translateY(0);
}

/* Method modal variant - red gradient header for visual distinction */
.prog-modal.prog-modal-method .prog-modal-header {
  background: linear-gradient(135deg, var(--haui-dark-blue-deep, #0F2547) 0%, var(--haui-dark-blue, #1B3A6F) 50%, #B91C1C 100%);
}
.prog-modal.prog-modal-method .prog-modal-icon {
  background: var(--haui-yellow, #FFCC4E);
}
.prog-modal.prog-modal-method .prog-modal-icon svg {
  stroke: var(--haui-dark-blue-deep, #0F2547);
}
/* For method, the "code" field is the badge text - style as pill */
.prog-modal.prog-modal-method .prog-modal-code {
  display: inline-block;
  background: var(--haui-yellow, #FFCC4E);
  color: var(--haui-dark-blue-deep, #0F2547);
  padding: 3px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 8px;
}

/* Header (sticky) */
.prog-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 28px 32px 24px;
  background: linear-gradient(135deg, var(--haui-dark-blue, #1B3A6F) 0%, #2C5494 100%);
  color: #fff;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border-radius: 24px 24px 0 0;
}
.prog-modal-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--haui-yellow, #FFCC4E) 0%, var(--haui-red, #DC2A2A) 100%);
}
.prog-modal-icon {
  flex-shrink: 0;
  width: 56px; height: 56px;
  background: var(--haui-yellow, #FFCC4E);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.prog-modal-icon svg {
  width: 28px; height: 28px;
  stroke: var(--haui-dark-blue-deep, #0F2547);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.prog-modal-title-wrap {
  flex: 1;
  min-width: 0;
  padding-right: 40px;
}
.prog-modal-tag {
  display: inline-block;
  background: rgba(255, 204, 78, 0.15);
  color: var(--haui-yellow, #FFCC4E);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 204, 78, 0.3);
}
.prog-modal-title {
  font-family: var(--font-display, 'Montserrat', sans-serif);
  font-size: clamp(20px, 3.4vw, 26px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #fff;
  margin: 0;
}
.prog-modal-code {
  font-size: 12px;
  margin-top: 6px;
  color: var(--haui-yellow, #FFCC4E);
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Close button */
.prog-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 18px;
}
.prog-modal-close:hover {
  background: var(--haui-red, #DC2A2A);
  border-color: var(--haui-red, #DC2A2A);
  transform: rotate(90deg);
}
.prog-modal-close:focus-visible {
  outline: 3px solid var(--haui-yellow, #FFCC4E);
  outline-offset: 2px;
}

/* Body (scrollable) */
.prog-modal-body {
  padding: 32px;
  overflow-y: auto;
  flex: 1;
  scroll-behavior: smooth;
}
.prog-modal-body::-webkit-scrollbar { width: 8px; }
.prog-modal-body::-webkit-scrollbar-track { background: transparent; }
.prog-modal-body::-webkit-scrollbar-thumb {
  background: rgba(27, 58, 111, 0.2);
  border-radius: 4px;
}
.prog-modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(27, 58, 111, 0.35);
}

/* Section blocks */
.prog-section {
  margin-bottom: 28px;
}
.prog-section:last-child { margin-bottom: 0; }
.prog-section-title {
  font-family: var(--font-display, 'Montserrat', sans-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--haui-red, #DC2A2A);
  margin: 0 0 14px;
  padding-left: 28px;
  position: relative;
}
.prog-section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 2px;
  background: var(--haui-red, #DC2A2A);
}
.prog-section-content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--haui-text, #1F2937);
}
.prog-section-content p {
  margin: 0 0 12px;
}
.prog-section-content p:last-child { margin-bottom: 0; }

.prog-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prog-list li {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(27, 58, 111, 0.08);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--haui-text, #1F2937);
  transition: all 0.2s;
}
.prog-list li:hover {
  border-color: rgba(255, 204, 78, 0.6);
  transform: translateX(2px);
}
.prog-list .prog-list-marker {
  flex-shrink: 0;
  width: 24px; height: 24px;
  background: var(--haui-yellow, #FFCC4E);
  color: var(--haui-dark-blue-deep, #0F2547);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-display, 'Montserrat', sans-serif);
  margin-top: 2px;
}

/* Footer */
.prog-modal-footer {
  padding: 20px 32px;
  border-top: 1px solid rgba(27, 58, 111, 0.08);
  background: #fff;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.prog-modal-footer .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none;
  cursor: pointer;
}
.prog-modal-footer .btn-primary {
  background: var(--haui-dark-blue, #1B3A6F);
  color: #fff;
}
.prog-modal-footer .btn-primary:hover {
  background: var(--haui-red, #DC2A2A);
  transform: translateY(-1px);
}
.prog-modal-footer .btn-outline {
  background: transparent;
  color: var(--haui-dark-blue, #1B3A6F);
  border: 1.5px solid rgba(27, 58, 111, 0.2);
}
.prog-modal-footer .btn-outline:hover {
  border-color: var(--haui-dark-blue, #1B3A6F);
  background: rgba(27, 58, 111, 0.04);
}

/* Loading & error states */
.prog-modal-loading,
.prog-modal-error {
  padding: 48px 32px;
  text-align: center;
  color: var(--haui-text-soft, #4B5563);
  font-size: 14px;
}
.prog-modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.prog-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(27, 58, 111, 0.1);
  border-top-color: var(--haui-dark-blue, #1B3A6F);
  border-radius: 50%;
  animation: prog-spin 0.8s linear infinite;
}
@keyframes prog-spin {
  to { transform: rotate(360deg); }
}

/* Body scroll lock */
body.prog-modal-open {
  overflow: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .prog-modal-backdrop,
  .prog-modal,
  .prog-modal-close,
  .prog-list li {
    transition: none !important;
  }
  .prog-spinner { animation: none; }
}

/* Mobile */
@media (max-width: 640px) {
  .prog-modal-backdrop { padding: 0; align-items: flex-end; }
  .prog-modal {
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
  }
  .prog-modal-header { padding: 24px 20px 20px; border-radius: 24px 24px 0 0; }
  .prog-modal-icon { width: 48px; height: 48px; }
  .prog-modal-icon svg { width: 24px; height: 24px; }
  .prog-modal-body { padding: 24px 20px; }
  .prog-modal-footer { padding: 16px 20px; }
  .prog-modal-footer .btn { flex: 1; justify-content: center; }
  .prog-modal-title-wrap { padding-right: 32px; }
}
