/* ============================================
   Mathematics & Statistics Resources - Stylesheet
   Author: Indra B. Kshattry PhD
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  color: #1e293b;
  background: #f0f4ff;
  line-height: 1.6;
  padding-top: 140px; /* offset for fixed banner + menu */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Fixed Banner --- */
.site-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b52c7 40%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 0 30px;
  box-shadow: 0 2px 12px rgba(30, 58, 138, 0.25);
}

.banner-title {
  color: #fff;
  font-size: clamp(0.9rem, 2.2vw, 1.4rem);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.banner-title .subtitle {
  font-weight: 400;
  font-style: italic;
  opacity: 0.9;
}

.banner-author {
  position: absolute;
  right: 30px;
  color: #e0e7ff;
  font-size: clamp(0.7rem, 1.2vw, 0.9rem);
  font-weight: 500;
  white-space: nowrap;
}

/* --- Fixed Menu Bar --- */
.site-navbar {
  position: fixed;
  top: 70px;
  left: 0;
  width: 100%;
  height: 60px;
  background: #fff;
  border-bottom: 2px solid #e0e7ff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.08);
}

.nav-logo img {
  height: 40px;
  width: auto;
  margin-right: 10px;
}

.nav-links {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0;
}

.nav-links a {
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  border-radius: 8px;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.nav-links a:hover {
  color: #3b52c7;
  background: #eef2ff;
}

.nav-links a.active {
  color: #fff;
  background: linear-gradient(135deg, #3b52c7, #6366f1);
}

.nav-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  position: relative;
}

.nav-search input {
  padding: 8px 14px 8px 36px;
  border: 2px solid #c7d2fe;
  border-radius: 25px;
  font-size: 0.9rem;
  outline: none;
  width: 200px;
  transition: all 0.3s ease;
  background: #f8faff;
}

.nav-search input:focus {
  border-color: #6366f1;
  width: 260px;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.nav-search .search-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  font-size: 0.9rem;
  pointer-events: none;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.hamburger:hover {
  background: #eef2ff;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: #334155;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

/* --- Main Layout --- */
.main-wrapper {
  flex: 1;
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  gap: 24px;
  width: 100%;
}

/* --- Course Sidebar --- */
.course-sidebar {
  width: 260px;
  flex-shrink: 0;
}

.sidebar-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(30, 58, 138, 0.08);
  overflow: hidden;
  position: sticky;
  top: 150px;
  border: 1px solid #e0e7ff;
}

.sidebar-header {
  background: linear-gradient(135deg, #1e3a8a, #3b52c7);
  color: #fff;
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.3px;
}

.course-tabs {
  padding: 10px;
}

.course-tab {
  display: block;
  padding: 12px 16px;
  margin-bottom: 4px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  width: 100%;
}

.course-tab:hover {
  background: #eef2ff;
  color: #3b52c7;
  transform: translateX(4px);
}

.course-tab.active {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  color: #1e3a8a;
  border-left: 4px solid #6366f1;
}

.course-tab .tab-icon {
  margin-right: 8px;
  font-size: 1rem;
}

.course-tab-group {
  padding: 6px 10px 2px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  margin-top: 6px;
}

/* --- Content Area --- */
.content-area {
  flex: 1;
  min-width: 0;
}

.content-area.gradient-bg {
  background: linear-gradient(135deg, #f0f4ff 0%, #e8ecff 50%, #f5f0ff 100%);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(30, 58, 138, 0.06);
  border: 1px solid #e0e7ff;
}

.content-area img.intro-image {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(30, 58, 138, 0.12);
}

/* --- Page Header (for inner pages) --- */
.page-header {
  text-align: center;
  margin-bottom: 36px;
  padding: 30px 20px;
  background: linear-gradient(135deg, #eef2ff, #f5f0ff);
  border-radius: 16px;
  border: 1px solid #e0e7ff;
}

.page-header h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: #1e3a8a;
  margin-bottom: 8px;
}

.page-header p {
  color: #64748b;
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* --- Course Cards Grid --- */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  padding: 10px 0;
}

.course-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  border: 1px solid #e0e7ff;
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.06);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.course-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b52c7, #6366f1, #a78bfa);
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(30, 58, 138, 0.14);
}

.course-card .card-icon {
  font-size: 2.2rem;
  margin-bottom: 14px;
}

.course-card h3 {
  font-size: 1.2rem;
  color: #1e3a8a;
  margin-bottom: 10px;
}

.course-card p {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

.course-card .card-link {
  display: inline-block;
  padding: 8px 20px;
  background: linear-gradient(135deg, #3b52c7, #6366f1);
  color: #fff;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.course-card .card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.course-card .badge {
  display: inline-block;
  padding: 4px 12px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.course-card .badge.available {
  background: #d1fae5;
  color: #065f46;
}

/* --- Forms (Login, Signup, Contact) --- */
.form-container {
  max-width: 500px;
  margin: 0 auto;
  background: #fff;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(30, 58, 138, 0.08);
  border: 1px solid #e0e7ff;
}

.form-container.contact-form {
  max-width: 700px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #334155;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all 0.25s ease;
  background: #f8faff;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, #3b52c7, #6366f1);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
  background: #eef2ff;
  color: #3b52c7;
}

.btn-secondary:hover {
  background: #e0e7ff;
}

.form-footer {
  text-align: center;
  margin-top: 20px;
  color: #64748b;
  font-size: 0.9rem;
}

.form-footer a {
  color: #3b52c7;
  font-weight: 600;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* --- About Page --- */
.about-content {
  max-width: 900px;
  margin: 0 auto;
}

.about-hero {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 50px;
  background: #fff;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(30, 58, 138, 0.06);
  border: 1px solid #e0e7ff;
}

.about-avatar {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #c7d2fe, #e0e7ff);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: #3b52c7;
}

.about-text h2 {
  font-size: 1.6rem;
  color: #1e3a8a;
  margin-bottom: 8px;
}

.about-text .title-line {
  color: #6366f1;
  font-weight: 600;
  margin-bottom: 16px;
  font-size: 1rem;
}

.about-text p {
  color: #475569;
  line-height: 1.8;
  margin-bottom: 12px;
}

.about-mission {
  background: #fff;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(30, 58, 138, 0.06);
  border: 1px solid #e0e7ff;
}

.about-mission h2 {
  font-size: 1.4rem;
  color: #1e3a8a;
  margin-bottom: 16px;
  text-align: center;
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.mission-item {
  text-align: center;
  padding: 20px;
  border-radius: 12px;
  background: #f8faff;
  border: 1px solid #e0e7ff;
}

.mission-item .icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.mission-item h4 {
  color: #1e3a8a;
  margin-bottom: 6px;
}

.mission-item p {
  color: #64748b;
  font-size: 0.85rem;
}

/* --- Contact Info --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  max-width: 900px;
  margin: 0 auto;
}

.contact-info-card {
  background: #fff;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(30, 58, 138, 0.06);
  border: 1px solid #e0e7ff;
}

.contact-info-card h3 {
  color: #1e3a8a;
  margin-bottom: 20px;
  font-size: 1.2rem;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.contact-item .icon {
  font-size: 1.3rem;
  color: #6366f1;
  margin-top: 2px;
}

.contact-item .info h4 {
  font-size: 0.9rem;
  color: #334155;
  margin-bottom: 2px;
}

.contact-item .info p {
  color: #64748b;
  font-size: 0.85rem;
}

/* --- Footer --- */
.site-footer {
  background: linear-gradient(135deg, #1e293b 0%, #1e3a5f 100%);
  color: #cbd5e1;
  padding: 40px 20px 20px;
  margin-top: 40px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
}

.footer-section h4 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 16px;
  font-weight: 700;
}

.footer-section p {
  font-size: 0.85rem;
  line-height: 1.8;
  color: #94a3b8;
}

.footer-section a {
  display: block;
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 3px 0;
  transition: color 0.2s;
}

.footer-section a:hover {
  color: #e0e7ff;
}

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid #334155;
  font-size: 0.8rem;
  color: #64748b;
}

.social-links {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #334155;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 1rem;
  transition: all 0.25s ease;
}

.social-links a:hover {
  background: #6366f1;
  color: #fff;
}

/* --- Module Tabs (Elementary Math page) --- */
.module-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 20px;
  padding: 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.06);
  border: 1px solid #e0e7ff;
}

.module-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 24px;
  border: 2px solid #e0e7ff;
  border-radius: 14px;
  background: #f8faff;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
  min-width: 110px;
}

.module-tab:hover {
  border-color: #a5b4fc;
  background: #eef2ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.12);
}

.module-tab.active {
  background: linear-gradient(135deg, #3b52c7, #6366f1);
  border-color: #6366f1;
  color: #fff;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.module-tab .tab-emoji {
  font-size: 1.8rem;
}

.module-tab .tab-label {
  font-size: 0.85rem;
  font-weight: 700;
}

/* Module Info Box */
.module-info {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #eef2ff, #f5f0ff);
  border-radius: 12px;
  border: 1px solid #e0e7ff;
}

.module-info h3 {
  color: #1e3a8a;
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.module-info p {
  color: #64748b;
  font-size: 0.9rem;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Module Iframe */
.module-frame-wrapper {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(30, 58, 138, 0.12);
  border: 2px solid #e0e7ff;
  background: #fff;
}

.module-frame-wrapper iframe {
  width: 100%;
  height: 700px;
  border: none;
  display: block;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) {
  .footer-content {
    grid-template-columns: 1fr 1fr;
  }

  .about-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .about-avatar {
    max-width: 200px;
    margin: 0 auto;
  }

  .banner-author {
    display: none;
  }
}

/* Mobile: below 768px */
@media (max-width: 768px) {
  body {
    padding-top: 130px;
  }

  .site-banner {
    height: 60px;
    padding: 0 15px;
  }

  .banner-title {
    font-size: 0.85rem;
  }

  .site-navbar {
    top: 60px;
    height: 55px;
    padding: 0 15px;
  }

  /* Show hamburger, hide nav links */
  .hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 55px;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(30, 58, 138, 0.12);
    border-bottom: 2px solid #e0e7ff;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
  }

  .nav-search {
    margin-left: auto;
    margin-right: 10px;
  }

  .nav-search input {
    width: 140px;
    font-size: 0.85rem;
    padding: 6px 12px 6px 32px;
  }

  .nav-search input:focus {
    width: 180px;
  }

  /* Sidebar becomes horizontal scroll on mobile */
  .main-wrapper {
    flex-direction: column;
    padding: 12px;
    gap: 16px;
  }

  .course-sidebar {
    width: 100%;
  }

  .sidebar-card {
    position: static;
  }

  .course-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px;
    scrollbar-width: thin;
  }

  .course-tab {
    white-space: nowrap;
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 10px 16px;
    background: #f1f5f9;
    border-radius: 25px;
    font-size: 0.85rem;
  }

  .course-tab.active {
    border-left: none;
    background: linear-gradient(135deg, #3b52c7, #6366f1);
    color: #fff;
  }

  .course-tab-group {
    display: none;
  }

  .module-tabs {
    gap: 6px;
    padding: 10px;
  }

  .module-tab {
    padding: 10px 14px;
    min-width: 80px;
    border-radius: 10px;
  }

  .module-tab .tab-emoji {
    font-size: 1.3rem;
  }

  .module-tab .tab-label {
    font-size: 0.7rem;
  }

  .module-frame-wrapper iframe {
    height: 500px;
  }

  .content-area.gradient-bg {
    padding: 16px;
  }

  /* Grid adjustments */
  .courses-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .social-links {
    justify-content: center;
  }

  .form-container {
    padding: 24px;
  }

  .page-header {
    padding: 20px 16px;
  }
}

/* Small mobile: below 480px */
@media (max-width: 480px) {
  .site-banner {
    height: 55px;
  }

  .banner-title {
    font-size: 0.75rem;
  }

  .site-navbar {
    top: 55px;
  }

  body {
    padding-top: 125px;
  }

  .nav-search input {
    width: 110px;
  }

  .nav-search input:focus {
    width: 150px;
  }
}
