/* ============================================
   ICT Pappa — style.css  (Complete Final)
   Dark navy + purple | Mobile responsive
   ============================================ */

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

:root {
  --navy:          #0a0d1a;
  --navy2:         #0d1025;
  --navy3:         #111428;
  --navy4:         #161b35;
  --purple:        #7c4dff;
  --purple2:       #6633ff;
  --purple3:       #9c6fff;
  --purple-dim:    rgba(124,77,255,0.15);
  --purple-glow:   rgba(124,77,255,0.25);
  --purple-border: rgba(124,77,255,0.3);
  --text:          #ffffff;
  --text2:         #c8cde8;
  --muted:         #6b7299;
  --border:        rgba(255,255,255,0.07);
  --border2:       rgba(124,77,255,0.2);
  --font:          'Plus Jakarta Sans', sans-serif;
  --mono:          'Fira Code', monospace;
  --sidebar-w:     260px;
  --nav-h:         64px;
  --footer-h:      44px;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  background: var(--navy);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(124,77,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,77,255,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 40% at 15% 15%, rgba(124,77,255,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 50% at 85% 80%, rgba(100,60,255,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Stars ───────────────────────────────────── */
.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.star {
  position: absolute;
  width: 4px; height: 4px;
  background: var(--purple3);
  clip-path: polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);
  animation: twinkle 3s infinite;
}
@keyframes twinkle {
  0%,100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.3); }
}

/* ── Mobile overlay ──────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  backdrop-filter: blur(2px);
}

/* ── Navbar ──────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  background: rgba(10,13,26,0.95);
  backdrop-filter: blur(20px);
  position: relative;
  z-index: 150;
  flex-shrink: 0;
}

.nav-left { display: flex; align-items: center; gap: 12px; }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 8px;
}
.hamburger span {
  display: block;
  height: 2px;
  background: var(--text2);
  border-radius: 2px;
  transition: all 0.2s;
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 12px; right: 12px;
  background: var(--navy4);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  z-index: 10;
}

.nav-logo { display: flex; align-items: center; gap: 10px; }
.nav-logo-box {
  width: 34px; height: 34px;
  background: var(--purple);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  box-shadow: 0 0 16px var(--purple-glow);
}
.nav-brand { font-size: 16px; font-weight: 800; letter-spacing: -0.5px; }
.nav-brand span { color: var(--purple3); }

.nav-links { display: flex; align-items: center; gap: 6px; }

.nav-link {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font);
  transition: all 0.2s;
  text-decoration: none;
}
.nav-link:hover { color: var(--text); background: var(--navy4); }

.nav-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  border: none;
  background: var(--purple);
  font-family: var(--font);
  transition: all 0.2s;
  text-decoration: none;
  display: flex; align-items: center; gap: 5px;
  box-shadow: 0 0 16px var(--purple-glow);
}
.nav-btn:hover { background: var(--purple2); transform: translateY(-1px); }

/* ── App Layout ──────────────────────────────── */
.app {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  z-index: 1;
  height: calc(100vh - var(--nav-h) - var(--footer-h));
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 201;
  transition: transform 0.3s ease;
}

.sidebar-top { padding: 16px 14px 10px; border-bottom: 1px solid var(--border); }

.new-btn {
  width: 100%;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--purple-border);
  background: var(--purple-dim);
  color: var(--purple3);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s;
}
.new-btn:hover { background: rgba(124,77,255,0.25); border-color: var(--purple); }

/* Grade Tabs */
.grade-tabs { display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.grade-tab {
  flex: 1; padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.grade-tab.active { background: var(--purple-dim); border-color: var(--purple); color: var(--purple3); }
.grade-tab:hover  { color: var(--text); background: var(--navy4); }

.sidebar-label { padding: 14px 16px 6px; font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

.topic-list { overflow-y: auto; padding: 0 8px; }
.topic-list::-webkit-scrollbar { width: 0; }

.topic-group { display: flex; flex-direction: column; }
.topic-group.hidden { display: none; }

.topic-btn {
  width: 100%; padding: 8px 10px;
  border-radius: 8px; border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font); font-size: 12px; font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  text-align: left;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.topic-btn:hover  { background: var(--navy4); color: var(--text2); }
.topic-btn.qhelp  { color: var(--purple3); }
.topic-btn.qhelp:hover { background: var(--purple-dim); }

.grade-section { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 5px; }

.sidebar-foot { padding: 12px 14px; border-top: 1px solid var(--border); margin-top: auto; }
.online-pill  { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 500; }
.pulse-dot    { width: 8px; height: 8px; border-radius: 50%; background: var(--purple3); box-shadow: 0 0 10px var(--purple); animation: pls 2s infinite; }
@keyframes pls { 0%,100% { opacity:1; box-shadow: 0 0 8px var(--purple); } 50% { opacity: 0.5; box-shadow: 0 0 20px var(--purple); } }
.sidebar-domain { font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ── Chat Main ───────────────────────────────── */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.page-view { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.page-view.hidden { display: none; }

/* ── Messages ────────────────────────────────── */
.messages { flex: 1; overflow-y: auto; padding: 28px 8%; scroll-behavior: smooth; }
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Welcome Screen ──────────────────────────── */
.welcome {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100%; text-align: center;
  animation: fadeUp 0.6s ease;
}
@keyframes fadeUp { from { opacity:0; transform: translateY(24px); } to { opacity:1; transform: translateY(0); } }

.label-tag { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; margin-bottom: 14px; }

.welcome-icon {
  width: 88px; height: 88px;
  border-radius: 24px;
  background: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 42px;
  margin: 0 auto 22px;
  box-shadow: 0 0 60px rgba(124,77,255,0.4);
  animation: float 4s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.welcome h1 { font-size: 34px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; margin-bottom: 12px; }
.welcome h1 span { color: var(--purple3); }
.welcome p { color: var(--text2); font-size: 14px; max-width: 420px; line-height: 1.7; margin-bottom: 32px; }

.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 560px; }

.sug-card {
  padding: 14px 16px;
  background: var(--navy3);
  border: 1px solid var(--border);
  border-radius: 13px;
  cursor: pointer; text-align: left;
  transition: all 0.2s;
  font-family: var(--font);
}
.sug-card:hover { background: var(--navy4); border-color: var(--purple-border); transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.sug-card .ic { font-size: 20px; margin-bottom: 8px; display: block; }
.sug-card .t  { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.sug-card .d  { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ── Messages ────────────────────────────────── */
.msg { display: flex; gap: 12px; margin-bottom: 24px; animation: msgIn 0.3s ease; }
@keyframes msgIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
.msg.user { flex-direction: row-reverse; }

.av {
  width: 36px; height: 36px;
  border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; margin-top: 2px;
}
.msg.bot  .av { background: var(--purple); box-shadow: 0 0 16px var(--purple-glow); }
.msg.user .av { background: var(--navy4); border: 1px solid var(--border2); font-size: 12px; font-weight: 800; color: var(--purple3); }

.msg-body { max-width: 72%; }
.msg.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }

.bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px; line-height: 1.7;
  word-break: break-word;
}
.msg.bot  .bubble { background: var(--navy3); border: 1px solid var(--border); border-top-left-radius: 4px; color: var(--text2); }
.msg.user .bubble { background: var(--purple); border-top-right-radius: 4px; color: #fff; box-shadow: 0 4px 20px var(--purple-glow); }

.bubble b    { color: var(--purple3); font-weight: 700; }
.bubble pre  { font-family: var(--mono); background: rgba(0,0,0,0.5); border: 1px solid var(--border2); border-radius: 8px; padding: 12px; font-size: 12px; overflow-x: auto; margin: 8px 0; color: #c5a3ff; line-height: 1.6; }
.bubble code { font-family: var(--mono); background: rgba(124,77,255,0.15); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: #c5a3ff; }

.bubble .gtag {
  display: inline-block;
  background: var(--purple-dim);
  border: 1px solid var(--purple-border);
  color: var(--purple3);
  font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 8px;
  margin: 0 2px;
  font-family: var(--mono);
}

.msg-meta { font-size: 11px; color: var(--muted); margin-top: 5px; padding: 0 4px; }

/* ── Typing ──────────────────────────────────── */
.typing-row { display: flex; gap: 12px; margin-bottom: 24px; }
.typing-bubble { background: var(--navy3); border: 1px solid var(--border); border-radius: 14px; border-top-left-radius: 4px; padding: 12px 16px; display: flex; gap: 5px; align-items: center; }
.td { width: 7px; height: 7px; border-radius: 50%; background: var(--purple); animation: tdB 1.3s infinite; opacity: 0.5; }
.td:nth-child(2) { animation-delay: 0.2s; }
.td:nth-child(3) { animation-delay: 0.4s; }
@keyframes tdB { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-7px); opacity: 1; } }

/* ── Input Zone ──────────────────────────────── */
.input-zone { padding: 14px 8% 16px; border-top: 1px solid var(--border); background: rgba(10,13,26,0.8); backdrop-filter: blur(20px); }

.quick-row { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }

.qp {
  padding: 5px 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--navy3);
  color: var(--muted);
  font-size: 12px; font-weight: 500;
  cursor: pointer; font-family: var(--font);
  transition: all 0.15s; white-space: nowrap;
}
.qp:hover { border-color: var(--purple-border); color: var(--purple3); background: var(--purple-dim); }

.input-box {
  background: var(--navy3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; align-items: flex-end; gap: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-box:focus-within { border-color: var(--purple-border); box-shadow: 0 0 0 3px rgba(124,77,255,0.08); }

#inp {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--font); font-size: 14px; color: var(--text);
  resize: none; max-height: 120px; line-height: 1.5;
}
#inp::placeholder { color: var(--muted); }

.send {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--purple); border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
  box-shadow: 0 0 16px var(--purple-glow);
}
.send:hover { background: var(--purple2); box-shadow: 0 0 24px rgba(124,77,255,0.5); transform: scale(1.05); }
.send:disabled { background: var(--navy4); box-shadow: none; cursor: not-allowed; transform: none; }
.send svg { fill: #fff; width: 17px; height: 17px; }
.send:disabled svg { fill: var(--muted); }

.input-foot { display: flex; justify-content: center; margin-top: 8px; font-size: 11px; color: var(--muted); gap: 14px; }
.input-foot a { color: rgba(156,111,255,0.7); text-decoration: none; font-weight: 500; }
.input-foot a:hover { color: var(--purple3); }

/* ── Syllabus Page ───────────────────────────── */
.scroll-page { flex: 1; overflow-y: auto; padding: 28px 8%; }
.scroll-page::-webkit-scrollbar { width: 4px; }
.scroll-page::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.page-title { font-size: 26px; font-weight: 800; letter-spacing: -1px; color: var(--text); margin-bottom: 6px; }
.page-sub   { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

.syllabus-card { background: var(--navy3); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 18px; }

.syllabus-header { padding: 12px 18px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.g10-h { background: rgba(0,200,150,0.1); color: #00c896; }
.g11-h { background: rgba(124,77,255,0.1); color: var(--purple3); }
.gal-h { background: rgba(255,150,0,0.1);  color: #ff9600; }

.syllabus-body { padding: 4px 0; }

.si {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  cursor: pointer; transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.si:last-child { border-bottom: none; }
.si:hover { background: var(--navy4); }

.si-n {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--purple-dim);
  border: 1px solid var(--purple-border);
  color: var(--purple3);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: var(--mono);
}
.si-c { flex: 1; }
.si-t { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.si-d { font-size: 11px; color: var(--muted); line-height: 1.4; }
.si-a { color: var(--muted); font-size: 14px; transition: all 0.15s; }
.si:hover .si-a { color: var(--purple3); transform: translateX(4px); }

/* ── Footer ──────────────────────────────────── */
.footer {
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: rgba(10,13,26,0.95);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  padding: 0 16px;
}
.footer a { color: var(--purple3); text-decoration: none; font-weight: 600; }
.footer a:hover { color: var(--purple); }
.footer-sep { opacity: 0.4; }

/* ── MOBILE RESPONSIVE ───────────────────────── */
@media (max-width: 768px) {

  :root { --nav-h: 56px; --footer-h: 40px; }

  /* Show hamburger */
  .hamburger { display: flex; }

  /* Hide nav links on mobile */
  .nav-links .nav-link { display: none; }
  .nav-btn { padding: 6px 12px; font-size: 12px; }

  /* Sidebar slides in from left */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    z-index: 300;
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .sidebar-close { display: flex; align-items: center; justify-content: center; }

  /* Full width chat */
  .chat-main { width: 100%; }

  /* Messages padding */
  .messages   { padding: 16px 4%; }
  .input-zone { padding: 10px 4% 12px; }
  .scroll-page { padding: 16px 4%; }

  /* Welcome screen */
  .welcome h1 { font-size: 24px; }
  .welcome p  { font-size: 13px; }
  .card-grid  { grid-template-columns: 1fr; gap: 8px; }
  .welcome-icon { width: 70px; height: 70px; font-size: 34px; }

  /* Message bubbles */
  .msg-body { max-width: 90%; }
  .bubble   { font-size: 13px; }

  /* Quick row scroll */
  .quick-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .quick-row::-webkit-scrollbar { height: 0; }

  /* Footer compact */
  .footer { font-size: 11px; gap: 6px; }
  .footer-sep:last-of-type ~ * { display: none; }

  /* App height */
  .app { height: calc(100vh - var(--nav-h) - var(--footer-h)); }
}

@media (max-width: 380px) {
  .nav-brand { font-size: 14px; }
  .nav-logo-box { width: 28px; height: 28px; font-size: 14px; }
}
