:root {
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #60a5fa;
  --secondary-color: #10b981;
  --secondary-dark: #059669;
  --accent-color: #f97316;
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --dark-color: #1e293b;
  --light-color: #f8fafc;
  --text-color: #334155;
  --text-light: #64748b;
  --bg-color: #ffffff;
  --bg-secondary: #f1f5f9;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --font-family-heading: 'Montserrat', sans-serif;
  --font-family-body: 'Open Sans', sans-serif;
  --transition: all 0.3s ease;
}

[data-theme="dark"] {
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #93c5fd;
  --bg-color: #0f172a;
  --bg-secondary: #1e293b;
  --text-color: #e2e8f0;
  --text-light: #94a3b8;
  --border-color: #334155;
}

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

body {
  font-family: var(--font-family-body);
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.6;
  transition: var(--transition);
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--dark-color);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: var(--light-color);
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 16px;
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

button {
  cursor: pointer;
  font-family: var(--font-family-body);
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  color: var(--text-light);
}

/* Navbar */
.navbar {
  background-color: var(--bg-color);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 16px 0;
  transition: var(--transition);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
}

.navbar-brand a {
  display: flex;
  align-items: center;
  font-family: var(--font-family-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary-color);
}

.logo-icon {
  margin-right: 8px;
}

.navbar-menu {
  display: flex;
  align-items: center;
}

.navbar-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
  margin-right: 24px;
}

.nav-link {
  color: var(--text-color);
  font-weight: 500;
  padding: 8px 0;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--primary-color);
}

.dropdown-toggle::after {
  content: '▼';
  display: inline-block;
  font-size: 0.6rem;
  margin-left: 4px;
  vertical-align: middle;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  display: none;
  background-color: var(--bg-color);
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  padding: 8px 0;
  list-style: none;
  margin: 0;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 8px 16px;
  color: var(--text-color);
  transition: var(--transition);
}

.dropdown-item:hover {
  background-color: var(--bg-secondary);
  color: var(--primary-color);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
}

.navbar-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  margin-bottom: 4px;
  background-color: var(--text-color);
  transition: var(--transition);
}

.navbar-toggle span:last-child {
  margin-bottom: 0;
}

.navbar-actions {
  display: flex;
  align-items: center;
  margin-left: 24px;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.25rem;
  padding: 4px;
  transition: var(--transition);
}

.theme-toggle:hover {
  color: var(--primary-color);
}

/* Hero section */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 80px 0 64px;
  text-align: center;
  margin-bottom: 64px;
}

.hero h1 {
  color: white;
  margin-bottom: 16px;
  font-size: 3rem;
}

.hero .subtitle {
  font-size: 1.25rem;
  margin-bottom: 32px;
  opacity: 0.9;
}

.search-container {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
}

.search-container input {
  flex-grow: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 4px 0 0 4px;
  font-size: 1rem;
  outline: none;
}

.search-container button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 0 4px 4px 0;
  font-weight: 500;
  transition: var(--transition);
}

.search-container button:hover {
  background-color: #ea580c;
}

/* Subjects section */
.subjects {
  padding: 0 0 64px;
}

.subjects h2 {
  text-align: center;
  margin-bottom: 32px;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.subject-card {
  background-color: var(--bg-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.subject-card-header {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
  padding: 24px;
  color: white;
}

.subject-card-header h3 {
  color: white;
  margin-bottom: 8px;
}

.subject-card-body {
  padding: 24px;
}

.subject-card-body p {
  margin-bottom: 16px;
  color: var(--text-light);
}

.subject-card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.subject-card-footer a {
  display: inline-block;
  padding: 8px 16px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 4px;
  font-weight: 500;
  transition: var(--transition);
}

.subject-card-footer a:hover {
  background-color: var(--primary-dark);
}

.subject-topics {
  color: var(--text-light);
  font-size: 0.875rem;
}

/* Features section */
.features {
  padding: 64px 0;
  background-color: var(--bg-secondary);
}

.features h2 {
  text-align: center;
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
}

.feature {
  text-align: center;
  transition: var(--transition);
}

.feature:hover {
  transform: translateY(-8px);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  color: var(--primary-color);
}

.feature h3 {
  margin-bottom: 8px;
}

.feature p {
  color: var(--text-light);
}

/* Subject page layout */
.page-container {
  display: flex;
  min-height: calc(100vh - 180px);
}

.sidebar {
  width: 300px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  transition: var(--transition);
  overflow-y: auto;
  height: calc(100vh - 73px);
  position: sticky;
  top: 73px;
  z-index: 10;
}

.sidebar-header {
  padding: 24px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

.sidebar-search {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-color);
}

.sidebar-nav {
  padding: 16px 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin-bottom: 1px;
}

.sidebar-nav a {
  display: block;
  padding: 12px 16px;
  color: var(--text-color);
  border-left: 3px solid transparent;
  transition: var(--transition);
}

.sidebar-nav a:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-left-color: var(--primary-light);
}

.sidebar-nav a.active {
  background-color: rgba(0, 0, 0, 0.05);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 500;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.content {
  flex-grow: 1;
  padding: 24px;
}

.breadcrumb {
  padding: 0 0 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-light);
}

.content-container {
  max-width: 800px;
  margin: 0 auto;
}

.content-header {
  margin-bottom: 32px;
}

.content-body {
  line-height: 1.8;
}

.content-body h2 {
  margin-top: 32px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.content-body h3 {
  margin-top: 24px;
  margin-bottom: 12px;
}

.content-body ul li, 
.content-body ol li {
  margin-bottom: 8px;
}

.content-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 24px 0;
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}

.content-body table th,
.content-body table td {
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border-color);
}

.content-body table th {
  background-color: var(--bg-secondary);
  font-weight: 600;
}

.content-body blockquote {
  padding: 16px 24px;
  margin: 24px 0;
  border-left: 4px solid var(--primary-color);
  background-color: var(--bg-secondary);
  font-style: italic;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1rem;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background-color: var(--bg-secondary);
}

/* Chatbot */
.chatbot-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 350px;
  background-color: var(--bg-color);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  overflow: hidden;
  transition: var(--transition);
}

.chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
}

.chatbot-header span {
  font-weight: 600;
}

#chatbot-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
}

.chatbot-body {
  height: 400px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.chatbot-messages {
  flex-grow: 1;
  padding: 16px;
  overflow-y: auto;
}

.message {
  margin-bottom: 16px;
  max-width: 80%;
}

.message p {
  padding: 12px;
  border-radius: 16px;
  margin-bottom: 0;
}

.message.user {
  margin-left: auto;
}

.message.user p {
  background-color: var(--primary-color);
  color: white;
  border-top-right-radius: 4px;
}

.message.bot p {
  background-color: var(--bg-secondary);
  border-top-left-radius: 4px;
}

.chatbot-input {
  display: flex;
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

.chatbot-input input {
  flex-grow: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px 0 0 4px;
  outline: none;
}

.chatbot-input button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 0 4px 4px 0;
  font-weight: 500;
  transition: var(--transition);
}

.chatbot-input button:hover {
  background-color: var(--primary-dark);
}

.chatbot-hidden .chatbot-body {
  height: 0;
}

/* Footer */
.footer {
  background-color: var(--dark-color);
  color: white;
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer h3, .footer h4 {
  color: white;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer p {
  opacity: 0.8;
}

.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer ul li {
  margin-bottom: 12px;
}

.footer a {
  color: rgba(255, 255, 255, 0.8);
  transition: var(--transition);
}

.footer a:hover {
  color: white;
}

.social-links {
  display: flex;
  gap: 12px;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transition: var(--transition);
}

.social-links a:hover {
  background-color: var(--primary-color);
}

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
  opacity: 0.6;
}

.mobile-only {
  display: none;
}