/* ---------- Base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #fdf2f8, #ede9fe, #dbeafe);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
  color: #222;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}
.container { max-width: 1100px; margin: auto; padding: 1.5rem; }

/* Gradient background animation */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Floating sparkles */
body::before {
  content: "";
  position: fixed;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle, rgba(255,255,255,0.5) 2px, transparent 3px);
  background-size: 80px 80px;
  animation: sparkle 12s linear infinite;
  z-index: -1;
}
@keyframes sparkle {
  from { background-position: 0 0; }
  to { background-position: 80px 80px; }
}

/* ---------- Header ---------- */
.site-header {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.3);
  position: sticky; top: 0; z-index: 1000;
}
.header-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand-mark { font-size: 1.6rem; margin-right: .5rem; animation: pulseIcon 2s infinite alternate; }
@keyframes pulseIcon {
  from { transform: scale(1); text-shadow: 0 0 5px rgba(147,51,234,0.6); }
  to { transform: scale(1.2); text-shadow: 0 0 15px rgba(236,72,153,0.8); }
}

/* Magical StudyGen Text */
.brand-text {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  background: linear-gradient(90deg, #9333ea, #ec4899, #3b82f6, #facc15);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textGlow 6s ease infinite;
}
@keyframes textGlow {
  0% { background-position: 0% 50%; text-shadow: 0 0 5px rgba(147,51,234,0.6); }
  50% { background-position: 100% 50%; text-shadow: 0 0 15px rgba(236,72,153,0.8); }
  100% { background-position: 0% 50%; text-shadow: 0 0 5px rgba(59,130,246,0.6); }
}
.brand-text:hover { animation: shimmer 2s linear infinite; }
@keyframes shimmer {
  0% { background-position: -100% 50%; }
  100% { background-position: 200% 50%; }
}

.nav { display: flex; gap: 1.2rem; }
.nav a { color: #444; text-decoration: none; font-weight: 500; transition: color 0.3s; }
.nav a:hover { color: #6d28d9; }

/* ---------- Buttons ---------- */
.cta { padding: 0.7rem 1.4rem; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.cta.primary { background: #6d28d9; color: #fff; }
.cta.primary:hover { background: #4c1d95; transform: scale(1.05); }
.cta.ghost { border: 1px solid #6d28d9; color: #6d28d9; background: transparent; }
.cta.ghost:hover { background: #ede9fe; }

/* ---------- Hero ---------- */
.hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 4rem 1.5rem; gap: 2rem; }
.hero-text h1 { font-size: 2.7rem; margin-bottom: 1rem; font-weight: 700; }
.gradient-text { background: linear-gradient(90deg, #9333ea, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sub { font-size: 1.1rem; color: #555; margin-bottom: 1.5rem; }

.hero-quick { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.chip { background: #ede9fe; color: #333; padding: .4rem .8rem; border-radius: 50px; font-size: .85rem; transition: transform 0.2s; }
.chip:hover { transform: scale(1.1); box-shadow: 0 3px 8px rgba(0,0,0,0.1); }

.hero-art .floating-card {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
  animation: float 4s ease-in-out infinite;
}
@keyframes float { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-10px);} }

/* ---------- Features (Magical Glow + Glass) ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px,1fr)); gap: 1.5rem; padding: 3rem 1.5rem; }
.feature {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  position: relative;
  box-shadow: 0 0 20px rgba(147,51,234,0.15);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.feature::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, #9333ea, #ec4899, #3b82f6, #facc15);
  background-size: 300% 300%;
  animation: borderGlow 6s ease infinite;
  z-index: -1;
}
@keyframes borderGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.feature:hover { transform: translateY(-8px) scale(1.03); box-shadow: 0 0 35px rgba(147,51,234,0.3); }
.feature .icon { font-size: 2.5rem; margin-bottom: 1rem; animation: pulse 2s infinite alternate; }
@keyframes pulse { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.2); opacity: 1; } }

/* ---------- Builder ---------- */
.builder {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}
.form .field { display: flex; flex-direction: column; margin-bottom: 1rem; }
input, textarea {
  padding: .75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.3s;
}
input:focus, textarea:focus {
  border-color: #6d28d9;
  box-shadow: 0 0 6px rgba(109,40,217,0.3);
  outline: none;
  transform: scale(1.02);
}
.actions { display: flex; gap: 1rem; margin-top: 1rem; }

/* ---------- Preview ---------- */
.preview {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}
.output-box {
  background: #0f0f0f;
  color: #e5e7eb;
  padding: 1.5rem;
  border-radius: 12px;
  font-family: "Inter", monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  min-height: 150px;
  margin-top: 1rem;
  white-space: pre-wrap;
  overflow-y: auto;
  max-height: 600px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Markdown styles */
.output-box h1, .output-box h2, .output-box h3 { color: #facc15; margin: 1rem 0 0.5rem; font-weight: 700; }
.output-box ul { padding-left: 1.5rem; list-style: disc; }
.output-box ol { padding-left: 1.5rem; list-style: decimal; }
.output-box strong { color: #38bdf8; }
.output-box em { color: #f472b6; }

/* ---------- Notes Section ---------- */
#notesInput { margin-bottom: 1rem; resize: vertical; }
.saved-notes { margin-top: 1.5rem; }
.saved-notes h3 { margin-bottom: .5rem; color: #6d28d9; }

/* ---------- Footer ---------- */
.site-footer { text-align: center; padding: 2rem; color: #eee; font-size: 0.9rem; }

/* ---------- Dark Mode ---------- */
body.dark { background: #0f172a; color: #f1f5f9; }
body.dark .site-header,
body.dark .builder,
body.dark .preview,
body.dark .feature { background: rgba(30,41,59,0.6); border-color: rgba(255,255,255,0.1); }
body.dark .output-box { background: #0f0f0f; color: #4ade80; }
body.dark .cta.ghost { border-color: #f1f5f9; color: #f1f5f9; }
body.dark .chip { background: #1e293b; color: #f1f5f9; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hero { flex-direction: column; text-align: center; }
  .header-inner { flex-wrap: wrap; gap: 1rem; }
  .actions { flex-direction: column; }
}

/* Dark Mode Toggle special */
#darkModeToggle {
  font-size: 1.2rem;
  transition: transform 0.3s ease, background 0.3s ease;
}
#darkModeToggle:hover {
  transform: rotate(20deg) scale(1.1);
  background: rgba(109,40,217,0.1);
}

/* ---------- Loading Dots ---------- */
.loading-dots { display:inline-block; font-weight:600; }
.loading-dots::after {
  content:"⏳";
  animation: dots 1.2s steps(1,end) infinite;
  margin-left:.4rem;
}
@keyframes dots {
  0%   { content:"⏳"; }
  33%  { content:"⏳."; }
  66%  { content:"⏳.."; }
  100% { content:"⏳..."; }
}
