/* =====================================================================
   Study Sphere AI  -  style.css  (global + landing page)
   Dark theme by default · Glassmorphism · Responsive
   ===================================================================== */

/* ===== DARK THEME (default) ===== */
:root,
:root[data-theme='dark'] {
  --bg-0: #060814;
  --bg-1: #0b1022;
  --bg-2: #11173a;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --text: #e8ecff;
  --text-dim: #9aa3c7;
  --primary: #6d7bff;
  --primary-2: #a855f7;
  --accent: #22d3ee;
  --success: #34d399;
  --danger: #fb7185;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --grad: linear-gradient(135deg, #6d7bff 0%, #a855f7 50%, #22d3ee 100%);
  --nav-bg: rgba(6, 8, 20, 0.55);
  --menu-bg: rgba(11, 16, 34, 0.96);
  --page-bg:
    radial-gradient(1200px 800px at 15% -10%, rgba(109, 123, 255, 0.18), transparent 55%),
    radial-gradient(1000px 700px at 110% 10%, rgba(168, 85, 247, 0.16), transparent 55%),
    var(--bg-0);
}

/* ===== LIGHT THEME ===== */
:root[data-theme='light'] {
  --bg-0: #eef1fb;
  --bg-1: #ffffff;
  --bg-2: #f4f6ff;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --border: rgba(20, 30, 80, 0.12);
  --text: #16203f;
  --text-dim: #5a648a;
  --primary: #5b67ff;
  --primary-2: #9333ea;
  --accent: #0891b2;
  --success: #059669;
  --danger: #e11d48;
  --shadow: 0 20px 50px rgba(60, 70, 130, 0.18);
  --nav-bg: rgba(255, 255, 255, 0.7);
  --menu-bg: rgba(255, 255, 255, 0.97);
  --page-bg:
    radial-gradient(1200px 800px at 15% -10%, rgba(109, 123, 255, 0.20), transparent 55%),
    radial-gradient(1000px 700px at 110% 10%, rgba(168, 85, 247, 0.16), transparent 55%),
    var(--bg-0);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
}
body.nav-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* Particles canvas behind everything */
#particles-js {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.container { width: min(1200px, 92%); margin: 0 auto; position: relative; z-index: 2; }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--grad);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  color: #fff;
  background: var(--b);
  box-shadow: 0 10px 30px rgba(109, 123, 255, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  overflow: hidden;
  isolation: isolate;
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(109, 123, 255, 0.5); }
.btn:active { transform: translateY(-1px) scale(0.99); }
.btn.ghost {
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: blur(12px);
}
.btn.ghost:hover { background: var(--glass-strong); box-shadow: 0 10px 24px rgba(0,0,0,0.35); }
.btn.primary {
  background: var(--primary);
  box-shadow: 0 10px 30px rgba(109, 123, 255, 0.4);
}
.btn.primary:hover { box-shadow: 0 16px 40px rgba(109, 123, 255, 0.6); }
.btn.small {
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
}
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Ripple effect */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.45);
  animation: ripple 0.6s linear;
  pointer-events: none;
  z-index: -1;
}
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* ---------- Glass card ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.glass:hover {
  border-color: rgba(109, 123, 255, 0.4);
}

/* ---------- Navbar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.9rem 0;
  backdrop-filter: blur(14px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.4s ease;
}
.nav .container { display: flex; align-items: center; justify-content: space-between; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  backdrop-filter: blur(10px);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.theme-toggle:hover { transform: translateY(-2px) rotate(12deg); background: var(--glass-strong); box-shadow: 0 8px 20px rgba(109,123,255,0.3); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle .fa-sun { display: none; }
:root[data-theme='light'] .theme-toggle .fa-sun { display: block; }
:root[data-theme='light'] .theme-toggle .fa-moon { display: none; }

/* Floating toggle for pages without a full navbar (auth pages) */
.theme-toggle.floating {
  position: fixed; top: 1.1rem; right: 1.1rem; z-index: 60;
}

/* Wide toggle used inside the dashboard sidebar */
.theme-toggle.side-theme {
  width: 100%; height: auto; border-radius: 12px;
  justify-content: flex-start; gap: 0.85rem;
  padding: 0.7rem 0.95rem; font-size: 1rem;
  margin-bottom: 0.4rem;
}
.theme-toggle.side-theme:hover { transform: translateY(-2px); }
.theme-toggle.side-theme .lbl { font-weight: 600; font-size: 0.95rem; }

.nav-actions { display: flex; align-items: center; gap: 0.9rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.25rem; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.brand .logo img {
  width: 100%; height: 100%; object-fit: contain;
}
.brand .grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; align-items: center; gap: 1.6rem; }
.nav-links a.link { 
  color: var(--text-dim); 
  font-weight: 500; 
  transition: color 0.2s, transform 0.2s; 
  position: relative;
}
.nav-links a.link:hover { color: var(--text); transform: translateY(-1px); }
.nav-links a.link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--grad);
  transition: width 0.3s ease;
}
.nav-links a.link:hover::after { width: 100%; }
/* ---------- Hamburger toggle ---------- */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  position: relative;
  backdrop-filter: blur(10px);
  transition: background 0.2s ease;
}
.nav-toggle:hover { background: var(--glass-strong); }
.nav-toggle .bar {
  position: absolute;
  left: 50%; top: 50%;
  width: 22px; height: 2.5px;
  background: var(--text);
  border-radius: 4px;
  transform: translate(-50%, -50%);
  transition: transform 0.3s ease, opacity 0.2s ease;
}
.nav-toggle .bar:nth-child(1) { transform: translate(-50%, -8px); }
.nav-toggle .bar:nth-child(3) { transform: translate(-50%, 8px); }
.nav-toggle.active .bar:nth-child(1) { transform: translate(-50%, 0) rotate(45deg); }
.nav-toggle.active .bar:nth-child(2) { opacity: 0; }
.nav-toggle.active .bar:nth-child(3) { transform: translate(-50%, 0) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { padding: 5.5rem 0 4rem; text-align: center; }
.hero .badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 1rem; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 0.85rem; margin-bottom: 1.6rem;
  backdrop-filter: blur(10px);
}
.hero h1 {
  font-size: clamp(1.8rem, 5vw, 4.6rem);
  font-weight: 800; line-height: 1.05; letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
}
.hero h1 .grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.typed-wrap { font-size: clamp(0.95rem, 2.2vw, 1.6rem); color: var(--accent); font-weight: 600; min-height: 2.2rem; margin-bottom: 1.2rem; }
.typed-cursor { display: inline-block; width: 3px; background: var(--accent); animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.hero p.lead { max-width: 640px; margin: 0 auto 2.2rem; color: var(--text-dim); font-size: clamp(0.95rem, 2vw, 1.1rem); }
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.hero-stats { display: flex; gap: 2.5rem; justify-content: center; flex-wrap: wrap; margin-top: 3.5rem; }
.hero-stats .stat { text-align: center; }
.hero-stats .stat b { display: block; font-size: 2rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-stats .stat span { color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Section ---------- */
.section { padding: 4.5rem 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 3rem; }
.section-head .eyebrow { color: var(--accent); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.8rem; }
.section-head h2 { font-size: clamp(1.5rem, 3.5vw, 2.8rem); font-weight: 800; margin: 0.6rem 0; }
.section-head p { color: var(--text-dim); }

/* ---------- Feature grid ---------- */
.grid { display: grid; gap: 1.4rem; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.feature {
  padding: 1.8rem;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.feature:hover { transform: translateY(-8px); border-color: rgba(109,123,255,0.5); }
.feature .icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.4rem; color: #fff;
  background: var(--grad); margin-bottom: 1.1rem;
  box-shadow: 0 10px 26px rgba(109,123,255,0.4);
}
.feature h3 { font-size: clamp(1rem, 2.5vw, 1.2rem); margin-bottom: 0.5rem; }
.feature p { color: var(--text-dim); font-size: clamp(0.85rem, 1.8vw, 0.96rem); }

/* ---------- Testimonials ---------- */
.testimonial { padding: 1.8rem; }
.testimonial .stars { color: #fbbf24; margin-bottom: 0.8rem; }
.testimonial p { color: var(--text); font-style: italic; margin-bottom: 1.2rem; }
.testimonial .who { display: flex; align-items: center; gap: 0.8rem; }
.testimonial .avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 700; }
.testimonial .who b { display: block; }
.testimonial .who span { color: var(--text-dim); font-size: 0.85rem; }

/* ---------- FAQ ---------- */
.faq { max-width: 760px; margin: 0 auto; display: grid; gap: 1rem; }
.faq-item { padding: 0; overflow: hidden; }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; color: var(--text);
  font-size: clamp(0.95rem, 2vw, 1.05rem); font-weight: 600; padding: 1.3rem 1.5rem; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq-q i { transition: transform 0.3s; color: var(--accent); }
.faq-item.open .faq-q i { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.35s ease, padding 0.35s ease; color: var(--text-dim); padding: 0 1.5rem; }
.faq-item.open .faq-a { max-height: 320px; padding: 0 1.5rem 1.3rem; }

/* ---------- CTA band ---------- */
.cta-band { text-align: center; padding: 3.5rem; margin: 2rem 0; }
.cta-band h2 { font-size: clamp(1.4rem, 3.5vw, 2.6rem); margin-bottom: 1rem; }
.cta-band p { color: var(--text-dim); margin-bottom: 1.8rem; }
.cta-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.cta-buttons .btn { padding: 0.9rem 1.8rem; font-size: 1rem; }

/* ---------- Footer ---------- */
.footer { padding: 3rem 0 2rem; border-top: 1px solid var(--border); margin-top: 3rem; }
.footer .container { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; align-items: center; }
.footer .muted { color: var(--text-dim); font-size: 0.9rem; }
.footer .socials { display: flex; gap: 1rem; font-size: 1.2rem; }
.footer .socials a { color: var(--text-dim); transition: color 0.2s, transform 0.2s; }
.footer .socials a:hover { color: var(--accent); transform: translateY(-3px); }

/* ---------- Floating card animation ---------- */
.float { animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 1.2rem; right: 1.2rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.6rem; }
.toast {
  padding: 0.9rem 1.2rem; border-radius: 12px; background: var(--glass-strong);
  border: 1px solid var(--border); backdrop-filter: blur(14px); color: var(--text);
  box-shadow: var(--shadow); animation: toastIn 0.3s ease; max-width: 340px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* ---------- Mobile nav backdrop ---------- */
.nav-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(2, 4, 14, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.nav-backdrop.show { opacity: 1; visibility: visible; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 880px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: calc(100% + 0.6rem); right: 4%; left: 4%;
    flex-direction: column; align-items: stretch; gap: 0.9rem;
    background: var(--menu-bg); border: 1px solid var(--border);
    border-radius: 16px; padding: 1.2rem;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    transform-origin: top right;
    transform: translateY(-12px) scale(0.96);
    opacity: 0; visibility: hidden;
    transition: transform 0.28s cubic-bezier(.2,.9,.3,1), opacity 0.22s ease, visibility 0.28s ease;
  }
  .nav-links a.link { padding: 0.4rem 0.2rem; border-bottom: 1px solid var(--border); }
  .nav-links a.link:last-of-type { border-bottom: none; }
  .nav-links a.link::after { display: none; }
  .nav-links .btn { justify-content: center; margin-top: 0.3rem; }
  .nav-links.open {
    transform: translateY(0) scale(1);
    opacity: 1; visibility: visible;
  }
  .hero-stats { gap: 1.6rem; }
  .section { padding: 3rem 0; }
  .hero { padding: 4rem 0 2rem; }
}

@media (max-width: 480px) {
  .hero { padding: 3rem 0 1.5rem; }
  .hero .badge { font-size: 0.75rem; padding: 0.35rem 0.8rem; }
  .hero-stats { flex-direction: column; gap: 1rem; }
  .hero-stats .stat b { font-size: 1.6rem; }
  .hero-stats .stat span { font-size: 0.8rem; }
  .hero-cta { flex-direction: column; width: 100%; gap: 0.8rem; }
  .hero-cta .btn { width: 100%; justify-content: center; padding: 0.9rem 1.2rem; font-size: 0.95rem; }
  .section { padding: 2.5rem 0; }
  .section-head { margin: 0 auto 2rem; }
  .feature { padding: 1.4rem; }
  .feature .icon { width: 48px; height: 48px; font-size: 1.2rem; }
  .feature h3 { font-size: 1rem; }
  .testimonial { padding: 1.4rem; }
  .testimonial p { font-size: 0.9rem; }
  .faq-q { padding: 1rem 1.2rem; font-size: 0.95rem; }
  .faq-a { padding: 0 1.2rem !important; }
  .cta-band { padding: 2.5rem 1.5rem; margin: 1.5rem 0; }
  .cta-band p { font-size: 0.9rem; margin-bottom: 1.4rem; }
  .footer .container { flex-direction: column; gap: 1.2rem; text-align: center; }
}
