@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg: #090e1d;
  --surface: #0f172a;
  --card: #141f35;
  --card-hover: #1a2740;
  --border: #1e2d47;
  --border-hover: #2d4060;
  --green: #10b981;
  --green-light: #34d399;
  --green-glow: rgba(16,185,129,0.12);
  --purple: #7c3aed;
  --purple-light: #a78bfa;
  --purple-glow: rgba(124,58,237,0.12);
  --cyan: #22d3ee;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #475569;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --ease: 0.2s ease;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── HEADER ── */
.site-header {
  background: rgba(9,14,29,0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.logo-icon { font-size: 1.7rem; line-height: 1; }

.logo-name {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  -webkit-text-fill-color: var(--text-faint);
}

nav { display: flex; gap: 0.25rem; }

nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--ease);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

nav a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
nav a.nav-active-lib  { color: var(--green-light); background: var(--green-glow); }
nav a.nav-active-math { color: var(--purple-light); background: var(--purple-glow); }

/* ── HERO ── */
.hero {
  padding: 5rem 2rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 700px; height: 400px;
  background: radial-gradient(ellipse, rgba(124,58,237,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-block;
  border: 1px solid rgba(124,58,237,0.35);
  background: rgba(124,58,237,0.08);
  color: var(--purple-light);
  padding: 0.2rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.75;
}

.hero-lib-gradient::before { background: radial-gradient(ellipse, rgba(16,185,129,0.1) 0%, transparent 70%); }
.hero-math-gradient::before { background: radial-gradient(ellipse, rgba(124,58,237,0.13) 0%, transparent 70%); }

/* ── FEATURE CARDS (index) ── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  max-width: 880px;
  margin: 0 auto;
}

.feature-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.lib-card::after  { background: radial-gradient(ellipse at top left, var(--green-glow), transparent 60%); }
.math-card::after { background: radial-gradient(ellipse at top left, var(--purple-glow), transparent 60%); }

.feature-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,0.5); }
.feature-card:hover::after { opacity: 1; }
.lib-card:hover  { border-color: var(--green); }
.math-card:hover { border-color: var(--purple); }

.feature-icon { font-size: 2.25rem; margin-bottom: 1rem; display: block; }

.feature-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.6rem; color: var(--text); }

.feature-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.75; margin-bottom: 1.25rem; }

.feature-cta { font-size: 0.85rem; font-weight: 600; }
.lib-card .feature-cta  { color: var(--green-light); }
.math-card .feature-cta { color: var(--purple-light); }

/* ── QUICK TOOLS (index) ── */
.quick-tools {
  padding: 1rem 2rem 4rem;
  max-width: 880px;
  margin: 0 auto;
}

.quick-tools-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.85rem;
  text-align: center;
}

.chips { display: flex; gap: 0.625rem; justify-content: center; flex-wrap: wrap; }

.chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--ease);
}

.chip:hover { border-color: var(--cyan); color: var(--text); background: var(--card-hover); }

/* ── LIBRARY PAGE ── */
.page-section {
  padding: 2.5rem 2rem;
  max-width: 1160px;
  margin: 0 auto;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.section-head h2 { font-size: 1.3rem; font-weight: 700; }

.count-badge {
  background: var(--green-glow);
  color: var(--green-light);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.search-wrap { margin-bottom: 1.5rem; }

.search-input {
  width: 100%;
  max-width: 460px;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--ease);
}

.search-input:focus { outline: none; border-color: var(--green); }
.search-input::placeholder { color: var(--text-faint); }

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.book-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: all var(--ease);
}

.book-card:hover {
  border-color: var(--green);
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16,185,129,0.1);
}

.book-emoji { font-size: 1.4rem; margin-bottom: 0.6rem; }

.book-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 0.35rem;
}

.book-source { font-size: 0.72rem; color: var(--text-faint); margin-bottom: auto; }

.book-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.875rem;
  color: var(--green-light);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  transition: gap var(--ease);
}

.book-link:hover { gap: 0.5rem; }

.no-results {
  grid-column: 1/-1;
  text-align: center;
  color: var(--text-faint);
  padding: 3rem;
  font-size: 0.95rem;
}

/* ── RESERVATION FORM ── */
.reservation-form-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2.5rem;
  max-width: 640px;
  margin: 0 auto 2rem;
}

.reservation-form-wrap h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.35rem; }
.reservation-form-wrap > p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.75rem; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.875rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--ease);
  width: 100%;
}

.form-group select { cursor: pointer; }

.form-group textarea { resize: vertical; min-height: 80px; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green);
  background: var(--card-hover);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-faint); }

.form-group select option { background: var(--surface); }

.form-submit-row {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-note { font-size: 0.78rem; color: var(--text-faint); }

.form-success {
  display: none;
  background: var(--green-glow);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  color: var(--green-light);
  font-size: 0.9rem;
  margin-top: 1rem;
  text-align: center;
}

.form-error {
  display: none;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  color: #fca5a5;
  font-size: 0.9rem;
  margin-top: 1rem;
  text-align: center;
}

@media (max-width: 500px) {
  .form-grid { grid-template-columns: 1fr; }
  .reservation-form-wrap { padding: 1.5rem 1.25rem; }
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--ease);
  cursor: pointer;
  font-family: inherit;
  border: none;
}

.btn-green  { background: var(--green); color: #fff; }
.btn-green:hover  { background: var(--green-light); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(16,185,129,0.35); }

.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: var(--purple-light); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124,58,237,0.35); }

.btn-lg { padding: 1rem 2.25rem; font-size: 1rem; border-radius: 10px; }

/* ── AI PAGE ── */
.ai-hero-card {
  background: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(16,185,129,0.04));
  border: 1px solid rgba(124,58,237,0.35);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 700px;
  margin: 2rem auto;
  position: relative;
  overflow: hidden;
}

.ai-hero-card::before {
  content: '';
  position: absolute;
  top: -60%; left: 50%;
  transform: translateX(-50%);
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(124,58,237,0.18), transparent 70%);
  pointer-events: none;
}

.ai-main-icon { font-size: 3rem; display: block; margin-bottom: 0.75rem; position: relative; z-index: 1; }

.ai-hero-sub {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--purple-light);
  margin-bottom: 0.6rem;
  position: relative; z-index: 1;
}

.ai-hero-card h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.75rem; position: relative; z-index: 1; }
.ai-hero-card p  { color: var(--text-muted); line-height: 1.75; margin-bottom: 1.75rem; position: relative; z-index: 1; }

.ai-login-note {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  margin-top: 1rem;
  position: relative; z-index: 1;
}

.tools-section {
  padding: 0 2rem 2.5rem;
  max-width: 980px;
  margin: 0 auto;
}

.tools-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
}

.ai-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}

.ai-tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-decoration: none;
  color: var(--text);
  transition: all var(--ease);
}

.ai-tool-card:hover {
  border-color: var(--purple);
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124,58,237,0.1);
}

.ai-tool-card.cyan-hover:hover { border-color: var(--cyan); box-shadow: 0 6px 20px rgba(34,211,238,0.08); }
.ai-tool-card.green-hover:hover { border-color: var(--green); box-shadow: 0 6px 20px rgba(16,185,129,0.1); }

.ai-tool-icon { font-size: 1.7rem; flex-shrink: 0; margin-top: 0.1rem; }
.ai-tool-name { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.2rem; }
.ai-tool-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

/* ── CONTACT ── */
.contact-strip {
  max-width: 700px;
  margin: 1rem auto 3rem;
  padding: 0 2rem;
}

.contact-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.contact-card .contact-icon { font-size: 1.5rem; }

.contact-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 0.15rem; }
.contact-name  { font-weight: 600; font-size: 0.92rem; }
.contact-email { color: var(--cyan); font-size: 0.85rem; text-decoration: none; }
.contact-email:hover { text-decoration: underline; }
.contact-note  { font-size: 0.78rem; color: var(--text-faint); margin-left: auto; }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-faint);
}

footer a { color: var(--text-faint); text-decoration: none; }
footer a:hover { color: var(--text-muted); }

/* ── ABOUT BOX (library) ── */
.about-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  max-width: 700px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.about-box strong { color: var(--text); }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .site-header { padding: 0.75rem 1rem; }
  .features { grid-template-columns: 1fr; padding: 1.25rem 1rem; }
  .hero { padding: 3.5rem 1rem 3rem; }
  .page-section { padding: 2rem 1rem; }
  .tools-section { padding: 0 1rem 2rem; }
  .ai-hero-card { padding: 2rem 1.25rem; margin: 1.5rem 1rem; }
  .ai-tools-grid { grid-template-columns: 1fr; }
  .reservation-box { padding: 1.75rem 1.25rem; }
  .contact-card { flex-direction: column; gap: 0.75rem; }
  .contact-note { margin-left: 0; }
  .chips { gap: 0.4rem; }
}
