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

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

p {
  margin-bottom: 1rem;
}

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

a:hover {
  text-decoration: underline;
}

/* Utility classes */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.align-center {
  align-items: center;
}

.align-start {
  align-items: flex-start;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.hidden {
  display: none !important;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-16 { margin-top: 4rem; }

.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.py-2 { padding: 0.5rem 0; }
.py-3 { padding: 0.75rem 0; }
.py-4 { padding: 1rem 0; }
.py-8 { padding: 2rem 0; }
.py-12 { padding: 3rem 0; }
.py-16 { padding: 4rem 0; }
.px-2 { padding: 0 0.5rem; }
.px-3 { padding: 0 0.75rem; }
.px-4 { padding: 0 1rem; }
.px-6 { padding: 0 1.5rem; }

.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-x-6 > * + * { margin-left: 1.5rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }

.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

.opacity-50 { opacity: 0.5; }
.opacity-60 { opacity: 0.6; }
.opacity-70 { opacity: 0.7; }
.opacity-80 { opacity: 0.8; }
.opacity-90 { opacity: 0.9; }

.cursor-pointer { cursor: pointer; }

.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

.border { border: 1px solid var(--border-color); }
.border-2 { border: 2px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.border-b { border-bottom: 1px solid var(--border-color); }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.text-6xl { font-size: 3.75rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.tracking-tight { letter-spacing: -0.025em; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }

.leading-relaxed { line-height: 1.625; }

.uppercase { text-transform: uppercase; }

/* Grid system */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-7xl { max-width: 80rem; }

.max-h-90vh { max-height: 90vh; }

.min-w-0 { min-width: 0px; }

.flex-1 { flex: 1 1 0%; }

.inset-0 {
  top: 0px;
  right: 0px;
  bottom: 0px;
  left: 0px;
}

.top-0 { top: 0px; }
.top-2 { top: 0.5rem; }
.right-0 { right: 0px; }
.right-2 { right: 0.5rem; }
.right-6 { right: 1.5rem; }
.bottom-6 { bottom: 1.5rem; }
.bottom-24 { bottom: 6rem; }
.left-3 { left: 0.75rem; }
.left-4 { left: 1rem; }

.-top-1 { top: -0.25rem; }
.-right-1 { right: -0.25rem; }

.transform { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); }
.-translate-y-1{ transform: translateY(-50%); }

/* Layout and Grid Styles */
.hero-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 60px 0;
  margin-bottom: 40px;
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 12px 40px rgba(37,99,235,0.08);
}

.search-bar {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 56px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 40px 0;
}

.stat-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.resource-card {
  background: var(--bg-primary);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

.gradient-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Navigation Styles */
.nav-item {
  position: relative;
  padding: 10px 18px;
  border-radius: calc(var(--radius-sm,8px) + 4px);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.3s ease;
  cursor: pointer;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}

.nav-item:hover:not(.active) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Filter Styles */
.category-filter {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Animation and Interaction Styles */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hover-scale {
  transition: transform 0.2s ease;
}
.hover-scale:hover {
  transform: scale(1.02);
}

.filter-btn {
  border-radius: 999px;
  font-weight: 600;
  transition: all 0.18s ease;
}

.micro-interaction {
  transition: all 0.2s ease;
}

.micro-interaction:hover {
  transform: scale(1.05);
}

.btn-primary {
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.micro-interaction:active {
  transform: scale(0.95);
}

.book-card {
  transition: all 0.3s ease;
}

.card {
  padding: 20px;
  border-radius: var(--radius-md,12px);
  box-shadow: var(--card-shadow, 0 6px 24px rgba(0,0,0,0.06));
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.copies-badge {
  font-weight: 600;
  border: 1px solid rgba(0,0,0,0.06);
}

.card {
  padding: 18px;
  border-radius: 12px;
  background: var(--bg-primary);
  box-shadow: 0 6px 24px rgba(0,0,0,0.06);
  border: 1px solid var(--border-color);
}

.btn-primary {
  background: linear-gradient(90deg,#6d28d9,#9333ea);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

/* Loading Animation */
.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 20px;
  right: -300px;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease;
  z-index: 1000;
  max-width: 350px;
  border: 1px solid var(--border-color);
}

.toast.show {
  right: 20px;
}

/* Tab Styles */
.tab-active {
  border-bottom: 3px solid var(--primary);
  color: var(--primary);
}

/* Focus Styles */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Content section styles */
.content-section {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.content-section.hidden {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  left: -9999px;
}

/* Form styles */
input, select, textarea {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Header styles */
header {
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Chat widget positioning */
.chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 50;
}

.chat-window {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  width: 20rem;
  height: 24rem;
  border-radius: 1rem;
  overflow: hidden;
  z-index: 40;
}

/* Color utilities */
.text-white { color: #ffffff; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: #111827; }

.text-blue-600 { color: #2563eb; }
.text-green-600 { color: #16a34a; }
.text-green-700 { color: #15803d; }
.text-red-600 { color: #dc2626; }
.text-red-700 { color: #b91c1c; }
.text-purple-600 { color: #9333ea; }
.text-purple-700 { color: #7c2d12; }
.text-purple-300 { color: #d8b4fe; }
.text-yellow-400 { color: #facc15; }
.text-orange-600 { color: #ea580c; }

.bg-white { background-color: #ffffff; }
.bg-black { background-color: #000000; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-gray-700 { background-color: #374151; }
.bg-gray-800 { background-color: #1f2937; }
.bg-gray-900 { background-color: #111827; }

.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-blue-600 { background-color: #2563eb; }
.bg-blue-900 { background-color: #1e3a8a; }

.bg-green-50 { background-color: #f0fdf4; }
.bg-green-100 { background-color: #dcfce7; }
.bg-green-500 { background-color: #22c55e; }
.bg-green-600 { background-color: #16a34a; }
.bg-green-700 { background-color: #15803d; }
.bg-green-900 { background-color: #14532d; }

.bg-red-50 { background-color: #fef2f2; }
.bg-red-100 { background-color: #fee2e2; }
.bg-red-500 { background-color: #ef4444; }
.bg-red-600 { background-color: #dc2626; }
.bg-red-900 { background-color: #7f1d1d; }

.bg-purple-50 { background-color: #faf5ff; }
.bg-purple-100 { background-color: #f3e8ff; }
.bg-purple-600 { background-color: #9333ea; }
.bg-purple-700 { background-color: #7c3aed; }
.bg-purple-900 { background-color: #581c87; }

.bg-orange-100 { background-color: #fed7aa; }
.bg-orange-500 { background-color: #f97316; }
.bg-orange-600 { background-color: #ea580c; }
.bg-orange-900 { background-color: #9a3412; }

.bg-yellow-50 { background-color: #fefce8; }
.bg-yellow-100 { background-color: #fef3c7; }
.bg-yellow-400 { background-color: #facc15; }
.bg-yellow-500 { background-color: #eab308; }

.bg-opacity-50 { background-color: rgba(0, 0, 0, 0.5); }

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .resource-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .search-input {
    font-size: 14px;
    padding: 12px 16px 12px 50px;
  }
  
  .nav-item {
    padding: 8px 16px;
    font-size: 14px;
  }
  
  .grid-cols-1-md { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .grid-cols-2-md { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cols-3-md { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-cols-4-md { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  
  .chat-window {
    width: calc(100vw - 3rem);
    right: 1.5rem;
  }
  
  .flex-wrap-mobile {
    flex-wrap: wrap;
  }
}
.toast {
  position: fixed;
  top: 20px;
  right: -300px;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease;
  z-index: 1000;
  max-width: 350px;
  border: 1px solid var(--border-color);
}

.toast.show {
  right: 20px;
}

/* Tab Styles */
.tab-active {
  border-bottom: 3px solid var(--primary);
  color: var(--primary);
}

/* Focus Styles */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .resource-grid {
    grid-template-columns: 1fr;
  }
  
  .card {
    padding: 16px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .search-input {
    font-size: 14px;
    padding: 12px 16px 12px 50px;
  }
  
  .nav-item {
    padding: 8px 16px;
    font-size: 14px;
  }
}
