/* ============================
   GLOBAL LAYOUT SYSTEM
============================ */
:root {
  --container: 1200px;
  --section-padding: clamp(3rem, 6vw, 6rem);
  --card-radius: 26px;
}

section {
  width: 100%;
  padding: var(--section-padding) 5%;
}

.section-header {
  max-width: var(--container);
  margin: 0 auto 3rem;
  text-align: center;
}

.section-header h2 {
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 0.6rem;
}

.section-header p {
  color: var(--text-light);
  font-size: 1.05rem;
}

/* ============================
   HERO SLIDER (Top Section)
============================ */
.hero-slider {
  position: relative;
  overflow: hidden;
  padding: 5rem 5% 6rem;
  background: linear-gradient(135deg, #fdfbfd, #f4ecf7);
}

.hero-slide {
  max-width: var(--container);
  margin: auto;
  text-align: center;
  display: none;
  animation: fadeInUp 1s ease;
}

.hero-slide.active {
  display: block;
}

.hero-slide h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(to right, #2c3e50, var(--primary), #e74c3c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-slide p {
  max-width: 720px;
  margin: 1rem auto 2rem;
  font-size: 1.15rem;
  color: var(--text-light);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Dots */
.hero-dots {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.hero-dots .dot {
  width: 10px;
  height: 10px;
  background: #ccc;
  border-radius: 50%;
  cursor: pointer;
}

.hero-dots .dot.active {
  background: var(--primary);
}

/* ============================
   CLASS GRID (Start Your Journey)
============================ */
.classes-section {
  background: linear-gradient(to bottom, #fdfbfd, #f4ecf7);
}

.class-grid {
  max-width: var(--container);
  margin: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px,1fr));
  gap: 2.2rem;
}

.class-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 320px;
}

.class-card h3 {
    margin-bottom: 0.6rem;
}

.class-card p {
    flex-grow: 1;
}

.card-action {
    margin-top: auto;
    font-weight: 600;
    color: var(--primary);
}


.class-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 25px 55px rgba(142,68,173,0.18);
}

/* ============================
   FEATURES GRID (Why Choose SJMaths)
============================ */
.feature-grid {
  max-width: var(--container);
  margin: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(260px,1fr));
  gap: 2.5rem;
}

/* ============================
   DARK MODE BASE LAYOUT
============================ */
body.dark-mode {
  background: #0b0b10;
}

body.dark-mode section {
  background: transparent;
}

body.dark-mode .class-card,
body.dark-mode .feature-card {
  background: #161622;
  color: #f3f4f6;
  box-shadow: 0 25px 50px rgba(0,0,0,0.6);
}

/* ============================
   FLOATING DARK TOGGLE (LEFT BOTTOM)
============================ */
.dark-toggle {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg,#8e44ad,#c0392b);
  color: #fff;
  border: none;
  box-shadow: 0 12px 35px rgba(142,68,173,0.5);
  cursor: pointer;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: 0.3s;
}

.dark-toggle:hover {
  transform: scale(1.08) rotate(8deg);
}

/* ============================
   FOOTER LAYOUT
============================ */
footer {
  background: #0f0f0f;
  color: #ecf0f1;
  padding: 5rem 5% 2rem;
  position: relative;
  overflow: hidden;
}

.footer-grid {
  max-width: var(--container);
  margin: auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid #333;
}

.footer-col h3,
.footer-brand h2 {
  color: white;
  margin-bottom: 1.2rem;
}

.footer-col a,
.footer-brand p {
  color: #bbb;
  font-size: 0.95rem;
  line-height: 1.6;
}

.footer-col a:hover {
  color: var(--primary);
  padding-left: 6px;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: .3s;
}

.social-links a:hover {
  background: var(--primary);
  transform: translateY(-3px);
}

.copyright {
  max-width: var(--container);
  margin: 2rem auto 0;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  color: #777;
  font-size: 0.85rem;
  gap: 1rem;
}

/* ============================
   BACK TO TOP (RIGHT BOTTOM)
============================ */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all .3s ease;
  z-index: 1500;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-5px);
}

/* ============================
   DARK MODE OVERRIDES
============================ */
body.dark-mode header,
body.dark-mode nav {
  background: rgba(20,20,30,.95);
}

body.dark-mode .hero-slider,
body.dark-mode .carousel-section {
  background: #0f0f1a;
}

body.dark-mode footer {
  background: #06060a;
}

body.dark-mode .section-header h2 {
  color: #f5f5f5;
}

body.dark-mode .section-header p {
  color: #aaa;
}

body.dark-mode .back-to-top {
  background: #7b2cbf;
}

/* ============================
   MOBILE RESPONSIVE
============================ */
@media (max-width: 992px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .hero-slide h1 { font-size: 2.2rem; }
  .hero-slide p { font-size: 1rem; }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .copyright {
    flex-direction: column;
    text-align: center;
  }
}

/* ============================
   ANIMATIONS
============================ */
@keyframes fadeInUp {
  from { opacity:0; transform: translateY(30px); }
  to   { opacity:1; transform: translateY(0); }
}

/* ============================
   SCROLL ANIMATION SUPPORT
============================ */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.22,1,0.36,1),
              transform 0.8s cubic-bezier(0.22,1,0.36,1);
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}
