/* =========================================================
   NBCC DIGITAL LEARNING PORTAL - MASTER STYLESHEET
   ========================================================= */

:root {
  --primary-navy: #071e3d;
  --primary-blue: #0f355b;
  --accent-blue: #2563eb;
  --light-blue: #60a5fa;
  --gold: #f59e0b;
  --light-gold: #fde68a;
  --bg-dark: #071527;
  --bg-card: #ffffff;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  --border-glass: rgba(255, 255, 255, 0.18);
  --shadow-card: 0 16px 36px -10px rgba(7, 30, 61, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Prompt', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #f1f5f9;
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   1. TOP GLOBAL NAVIGATION
   ========================================================= */
.top-nav-bar {
  background: rgba(7, 30, 61, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.85rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.nav-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
}

.nav-inst-th {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.015em;
  line-height: 1.2;
}

.nav-inst-en {
  font-size: 0.68rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.online-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  display: inline-block;
  animation: pulseGreen 2s infinite;
}

.pulse-dot-sm {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 6px #22c55e;
  display: inline-block;
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.nav-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}

.nav-link-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

/* =========================================================
   2. HERO BANNER
   ========================================================= */
.portal-hero {
  background: linear-gradient(135deg, #071e3d 0%, #0f355b 50%, #1e3a8a 100%);
  color: #ffffff;
  padding: 4.5rem 1.5rem 5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.portal-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(253, 230, 138, 0.08) 0%, rgba(37, 99, 235, 0.15) 30%, transparent 70%);
  pointer-events: none;
}

.hero-container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--light-gold);
  background: rgba(217, 119, 6, 0.2);
  border: 1px solid rgba(253, 230, 138, 0.35);
  padding: 0.35rem 1.1rem;
  border-radius: 9999px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hero-title {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 1rem;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.hero-title-highlight {
  color: #ffffff;
  background: linear-gradient(180deg, #ffffff 0%, #fde68a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: #cbd5e1;
  font-weight: 400;
  line-height: 1.7;
  margin-bottom: 2.25rem;
}

.portal-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: 780px;
  margin: 0 auto;
}

.portal-stat-box {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 0.85rem 0.5rem;
  text-align: center;
  transition: transform 0.2s, background 0.2s;
}

.portal-stat-box:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.14);
}

.stat-number {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--light-gold);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-top: 0.2rem;
}

/* =========================================================
   3. SEARCH & FILTER SECTION
   ========================================================= */
.search-filter-section {
  position: relative;
  margin-top: -2.5rem;
  z-index: 10;
  padding: 0 1.5rem;
}

.section-container {
  max-width: 1280px;
  margin: 0 auto;
}

.search-filter-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 20px 45px -10px rgba(7, 30, 61, 0.15);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-box-wrap {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  gap: 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box-wrap:focus-within {
  border-color: var(--accent-blue);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-icon {
  font-size: 1.2rem;
  color: #94a3b8;
}

.search-box-wrap input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-family: 'Prompt', sans-serif;
  font-size: 1rem;
  color: var(--text-dark);
}

.clear-search-btn {
  background: #cbd5e1;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  transition: background 0.2s;
}

.clear-search-btn:hover {
  background: #94a3b8;
}

.category-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cat-tab {
  font-family: 'Prompt', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 1.15rem;
  border-radius: 9999px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.cat-tab:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.cat-tab.active {
  background: var(--primary-navy);
  color: #ffffff;
  border-color: var(--primary-navy);
  box-shadow: 0 4px 12px rgba(7, 30, 61, 0.2);
}

/* =========================================================
   4. COURSES SHOWCASE SECTION & HD SPOTLIGHT CARDS
   ========================================================= */
.courses-showcase-section {
  flex: 1;
  padding: 3.5rem 1.5rem 5rem;
}

.showcase-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
}

.showcase-heading {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--primary-navy);
  line-height: 1.2;
}

.showcase-subheading {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.course-count-pill {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 0.35rem 0.95rem;
  border-radius: 9999px;
}

/* Grid of Cards */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 2.25rem;
}

/* HD Spotlight Course Card */
.course-card {
  background: #ffffff;
  border-radius: 24px;
  border: 1.5px solid #e2e8f0;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s, border-color 0.3s;
  position: relative;
}

.course-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgba(7, 30, 61, 0.22), 0 0 20px rgba(37, 99, 235, 0.12);
  border-color: #93c5fd;
}

/* Large HD Portrait Stage Header (Height 310px) */
.card-portrait-stage {
  position: relative;
  width: 100%;
  height: 310px;
  background: linear-gradient(180deg, #071e3d 0%, #0f355b 60%, #1e3a8a 100%);
  overflow: hidden;
}

.card-portrait-hd-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform 0.5s ease;
  image-rendering: -webkit-optimize-contrast;
}

.course-card:hover .card-portrait-hd-img {
  transform: scale(1.04);
}

.portrait-gradient-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(7, 30, 61, 0.15) 0%,
    transparent 35%,
    rgba(7, 21, 39, 0.75) 75%,
    rgba(7, 21, 39, 0.95) 100%
  );
  pointer-events: none;
}

.portrait-badge-pill {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(253, 230, 138, 0.45);
  color: #fde68a;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.portrait-instructor-info {
  position: absolute;
  bottom: 1.15rem;
  left: 1.25rem;
  right: 1.25rem;
  z-index: 5;
}

.instructor-hd-name {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  margin: 0 0 0.15rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.015em;
}

.instructor-hd-dept {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fde68a;
  margin: 0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* Card Body */
.card-body {
  padding: 1.4rem 1.5rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-badge-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.badge-code {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
}

.badge-credit {
  font-size: 0.78rem;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
}

.badge-tag {
  font-size: 0.78rem;
  color: #475569;
  background: #f1f5f9;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
}

.course-title-th {
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--primary-navy);
  line-height: 1.3;
  margin-bottom: 0.2rem;
}

.course-title-en {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.95rem;
}

.course-brief {
  font-size: 0.92rem;
  line-height: 1.65;
  color: #475569;
  margin-bottom: 1.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 0.4rem;
  margin-top: auto;
}

.meta-item {
  text-align: center;
}

.meta-val {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-navy);
  line-height: 1.2;
}

.meta-lbl {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Card Footer */
.card-footer {
  padding: 1.15rem 1.5rem 1.4rem;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
}

.btn-enter-lms {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-family: 'Prompt', sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #071e3d 0%, #1e3a8a 100%);
  border: none;
  border-radius: 14px;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(7, 30, 61, 0.25);
  transition: all 0.2s;
  cursor: pointer;
}

.btn-enter-lms:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #0f355b 0%, #2563eb 100%);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.35);
}

/* No results state */
.no-results-box {
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 20px;
  padding: 3.5rem 1.5rem;
  text-align: center;
  margin: 2rem 0;
}

.no-results-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

.no-results-box h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-navy);
  margin-bottom: 0.5rem;
}

.no-results-box p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.btn-reset-search {
  font-family: 'Prompt', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent-blue);
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: 10px;
  cursor: pointer;
}

/* =========================================================
   5. FOOTER SECTION
   ========================================================= */
.portal-footer {
  background: #071527;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 4rem 1.5rem 2rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.4fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-logo-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.footer-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.footer-inst-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.footer-inst-sub {
  font-size: 0.82rem;
  color: #cbd5e1;
}

.footer-desc {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #94a3b8;
}

.footer-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1.25rem;
}

.footer-links {
  list-style: none;
  display: grid;
  gap: 0.65rem;
}

.footer-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-contact {
  display: grid;
  gap: 0.65rem;
  font-size: 0.88rem;
}

.footer-contact a {
  color: #60a5fa;
  text-decoration: none;
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 0.82rem;
}

.hidden {
  display: none !important;
}

/* =========================================================
   RESPONSIVE DESIGN
   ========================================================= */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .top-nav-bar {
    padding: 0.75rem 1rem;
  }
  .nav-inst-en {
    display: none;
  }
  .portal-hero {
    padding: 3rem 1rem 4rem;
  }
  .search-filter-section {
    margin-top: -2rem;
  }
  .portal-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .card-portrait-stage {
    height: 260px;
  }
  .courses-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .hide-mobile {
    display: none;
  }
}
