/* Academic Portal & STEM Library Stylesheet */
:root {
  --bg-dark: #080c14;
  --bg-surface: #0f172a;
  --bg-card: #111a2e;
  --bg-card-hover: #17233d;
  --border-color: #1e293d;
  --border-focus: #38bdf8;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-indigo: #818cf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html {
  scroll-padding-top: 85px;
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

/* Global Navigation Header */
.portal-navbar {
  height: 72px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3rem;
}

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

.brand-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
  display: block;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.portal-nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #fff;
}

.btn-contact-nav {
  background-color: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-contact-nav:hover {
  background-color: var(--accent-cyan);
  color: #0b0f19;
}

.btn-discord-nav {
  background-color: rgba(88, 101, 242, 0.18);
  border: 1px solid rgba(88, 101, 242, 0.4);
  color: #c7d2fe;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-discord-nav:hover {
  background-color: #5865f2;
  border-color: #5865f2;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.35);
}

/* Hero Section */
.hero-section {
  padding: 4.5rem 2rem 3rem;
  text-align: center;
  background: radial-gradient(circle at 50% 20%, rgba(56, 189, 248, 0.1) 0%, transparent 60%);
  border-bottom: 1px solid var(--border-color);
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: #fff;
  max-width: 900px;
  margin: 0 auto 1.25rem;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

/* Search & Filter Bar */
.search-filter-wrapper {
  max-width: 780px;
  margin: 0 auto 2rem;
}

.search-input-box {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.6rem 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s;
}

.search-input-box:focus-within {
  border-color: var(--accent-cyan);
}

.search-icon {
  font-size: 1.25rem;
  margin-right: 0.75rem;
}

.main-search-input {
  flex: 1;
  background: none;
  border: none;
  color: #fff;
  font-size: 1rem;
  outline: none;
}

.main-search-input::placeholder {
  color: #64748b;
}

/* Department Filter Tabs */
.dept-filter-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.dept-pill-btn {
  background-color: #111a2e;
  border: 1px solid #1e293d;
  color: var(--text-muted);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.dept-pill-btn:hover {
  background-color: #1e293b;
  color: #fff;
}

.dept-pill-btn.active {
  background-color: var(--accent-cyan);
  color: #080c14;
  border-color: var(--accent-cyan);
}

/* Container */
.portal-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 3rem 2rem;
  flex: 1;
  width: 100%;
}

/* Department Section Block */
.department-block {
  margin-bottom: 4rem;
}

.department-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.department-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.dept-icon {
  font-size: 2rem;
}

.dept-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
}

.dept-count-badge {
  font-size: 0.75rem;
  background-color: #1e293b;
  color: var(--accent-cyan);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-weight: 700;
}

.dept-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 700px;
}

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

.course-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  scroll-margin-top: 85px;
}

.course-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.6);
}

.course-card.available {
  border-color: rgba(56, 189, 248, 0.3);
  background: linear-gradient(180deg, #111a2e 0%, #0d1527 100%);
}

.course-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.course-code-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.status-badge.available {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.coming-soon {
  background-color: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.course-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.course-description {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  flex: 1;
}

.course-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: #cbd5e1;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.course-topics-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.topic-tag {
  font-size: 0.72rem;
  background-color: #0b1120;
  color: #94a3b8;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #1e293d;
}

.btn-open-course {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-open-course.primary {
  background-color: var(--accent-cyan);
  color: #080c14;
}

.btn-open-course.primary:hover {
  background-color: #7dd3fc;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

.btn-open-course.disabled {
  background-color: #1e293b;
  color: #64748b;
  cursor: not-allowed;
}

/* See More / View All Textbooks Controller */
.dept-see-more-wrap {
  margin-top: 2.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1.5rem 1rem;
  border-top: 1px dashed rgba(56, 189, 248, 0.25);
  background: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.05) 0%, transparent 70%);
  border-radius: 12px;
}

.dept-showing-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dept-showing-meta strong {
  color: #f1f5f9;
}

.btn-see-more {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(129, 140, 248, 0.15));
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  padding: 0.8rem 2rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-see-more:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(129, 140, 248, 0.3));
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(56, 189, 248, 0.35);
}

.btn-see-more:active {
  transform: translateY(0);
}

.btn-see-more-icon {
  font-size: 1.1rem;
}

.btn-see-more-arrow {
  transition: transform 0.25s ease;
  font-weight: 800;
}

.course-card-extra.card-extra-hidden {
  display: none !important;
}

.course-card-extra {
  animation: cardFadeIn 0.35s ease-out forwards;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Monetization: AdSense Hero & Mid Banner */
.portal-ad-banner {
  background-color: #0a0f1d;
  border: 1px dashed #334155;
  border-radius: 12px;
  padding: 1rem;
  margin: 2.5rem 0;
  text-align: center;
}

.portal-ad-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.portal-ad-box {
  background: linear-gradient(135deg, #111a2f, #0d1424);
  border: 1px solid #1e293d;
  border-radius: 8px;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.ad-sponsor-info {
  text-align: left;
}

.ad-sponsor-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.ad-sponsor-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ad-sponsor-btn {
  background-color: var(--accent-cyan);
  color: #080c14;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.5rem 1.15rem;
  border-radius: 6px;
  text-decoration: none;
}

/* Contact & Author Box */
/* Academic Collaboration & Global STEM Initiatives */
.academic-collab-section {
  margin: 4.5rem 0 3rem;
}

.collab-header-wrap {
  text-align: center;
  max-width: 820px;
  margin: 0 auto 2.5rem;
}

.collab-badge {
  font-size: 0.78rem;
  font-weight: 700;
  background-color: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
  display: inline-block;
}

.collab-title {
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.collab-subtitle {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* 6-Card Initiatives Grid */
.collab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.collab-card {
  background: #0d1527;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.75rem 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.collab-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 12px 25px -8px rgba(0, 0, 0, 0.5);
}

.collab-card.available {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, #0d1629, #0f1c33);
}

.collab-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
}

.collab-icon {
  font-size: 2rem;
  display: inline-block;
}

.collab-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.collab-status-badge.live {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.collab-status-badge.soon {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.collab-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.65rem;
  line-height: 1.35;
}

.collab-card-desc {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.65;
  margin-bottom: 1.35rem;
  flex-grow: 1;
}

.collab-card-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 1rem;
}

.collab-btn-active {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-cyan);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: gap 0.2s;
}

.collab-btn-active:hover {
  gap: 0.65rem;
  color: #7dd3fc;
}

.collab-note-soon {
  font-size: 0.78rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.collab-btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(88, 101, 242, 0.16);
  border: 1px solid rgba(88, 101, 242, 0.45);
  color: #c7d2fe;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.collab-btn-discord:hover {
  background: #5865f2;
  border-color: #5865f2;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(88, 101, 242, 0.4);
}

.discord-cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: #5865f2;
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(88, 101, 242, 0.35);
}

.discord-cta-link:hover {
  background-color: #4752c4;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(88, 101, 242, 0.5);
}

/* Contact & Collaboration Box */
.collab-contact-box {
  background: linear-gradient(135deg, #0e172a, #111e38);
  border: 1px solid #1f2d4d;
  border-radius: 16px;
  padding: 3rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.5);
}

.collab-contact-text {
  max-width: 650px;
}

.collab-contact-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.75rem;
}

.collab-contact-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.collab-contact-action {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Legacy Contact & Author Box */
.author-contact-section {
  background: linear-gradient(135deg, #0e172a, #111e38);
  border: 1px solid #1f2d4d;
  border-radius: 16px;
  padding: 3rem 2.5rem;
  margin: 4rem 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.5);
}

.contact-left-col {
  max-width: 650px;
}

.contact-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  display: inline-block;
}

.contact-headline {
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.75rem;
}

.contact-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.contact-action-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.email-display-card {
  background-color: #090e1a;
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: 'Fira Code', monospace;
  font-size: 0.95rem;
  color: #38bdf8;
}

.btn-copy-email {
  background-color: #1e293b;
  border: 1px solid #334155;
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-email:hover {
  background-color: #334155;
}

.email-mailto-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--accent-emerald);
  color: #064e3b;
  padding: 0.85rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s;
}

.email-mailto-link:hover {
  opacity: 0.9;
}

/* Footer */
.portal-footer {
  border-top: 1px solid var(--border-color);
  background-color: #060911;
  padding: 2.5rem 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.35rem;
  max-width: 1100px;
  margin: 0 auto 1.5rem;
  line-height: 1.8;
}

.footer-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.82rem;
  transition: color 0.2s ease;
  display: inline-block;
}

.footer-link:hover {
  color: var(--accent-cyan);
}

/* Responsive */
@media (max-width: 860px) {
  .portal-navbar {
    padding: 0 1.25rem;
  }
  .hero-title {
    font-size: 2.2rem;
  }
  .courses-grid {
    grid-template-columns: 1fr;
  }
  .author-contact-section,
  .collab-contact-box {
    flex-direction: column;
    text-align: center;
  }
  .contact-action-col,
  .collab-contact-action {
    width: 100%;
  }
  .footer-links {
    gap: 0.5rem 0.85rem;
    font-size: 0.8rem;
  }
}
