/* UPSC Mentor - Custom Styles */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Animation for loading dots */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.animate-bounce {
  animation: bounce 0.6s ease-in-out infinite;
}

/* Prose styles for markdown content */
.prose {
  color: #374151;
  max-width: 65ch;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: #111827;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
}

.prose h1 { font-size: 1.5rem; }
.prose h2 { font-size: 1.25rem; }
.prose h3 { font-size: 1.125rem; }

.prose p {
  margin-top: 0.75em;
  margin-bottom: 0.75em;
}

.prose ul, .prose ol {
  margin-top: 0.75em;
  margin-bottom: 0.75em;
  padding-left: 1.5em;
}

.prose li {
  margin-top: 0.25em;
  margin-bottom: 0.25em;
}

.prose ul > li {
  list-style-type: disc;
}

.prose ol > li {
  list-style-type: decimal;
}

.prose code {
  background-color: #f3f4f6;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.prose pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1em 0;
}

.prose pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

.prose blockquote {
  border-left: 4px solid #30A7B2;
  padding-left: 1rem;
  margin: 1em 0;
  font-style: italic;
  color: #6b7280;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.prose th, .prose td {
  border: 1px solid #e5e7eb;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.prose th {
  background-color: #f9fafb;
  font-weight: 600;
}

.prose strong {
  font-weight: 600;
  color: #111827;
}

.prose em {
  font-style: italic;
}

.prose hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.5em 0;
}

/* Line clamp utilities */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card hover effect */
.card-hover {
  transition: transform 0.2s, box-shadow 0.2s;
}

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

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, #30A7B2 0%, #2a96a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Focus styles */
input:focus, select:focus, textarea:focus, button:focus {
  outline: none;
  ring: 2px;
  ring-color: #30A7B2;
}

/* Template button active state */
.template-btn.active {
  border-color: #30A7B2;
  background-color: #e6f7f8;
  color: #30A7B2;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    z-index: 40;
    transition: left 0.3s ease;
  }
  
  #sidebar.open {
    left: 0;
  }
  
  #mobile-menu-btn {
    display: flex;
  }
}

@media (min-width: 769px) {
  #mobile-menu-btn {
    display: none !important;
  }
}

/* Smooth page transitions */
#main-content {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Pulse animation for notifications */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Status badge colors */
.status-not-started { background-color: #f3f4f6; color: #6b7280; }
.status-in-progress { background-color: #fef3c7; color: #d97706; }
.status-revision { background-color: #dbeafe; color: #2563eb; }
.status-completed { background-color: #dcfce7; color: #16a34a; }

/* Progress bar animation */
.progress-bar {
  transition: width 0.5s ease;
}

/* Chat message animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#chat-messages > div {
  animation: slideIn 0.3s ease;
}

/* Button press effect */
button:active {
  transform: scale(0.98);
}

/* Tooltip styles */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background-color: #1f2937;
  color: white;
  font-size: 0.75rem;
  border-radius: 0.375rem;
  white-space: nowrap;
  z-index: 50;
}

/* Print styles */
@media print {
  #sidebar, #mobile-menu-btn {
    display: none !important;
  }
  
  #main-content {
    width: 100% !important;
    margin: 0 !important;
  }
}

/* ==================== RICH AI RESPONSE STYLES ==================== */

/* Base rich response container */
.rich-response {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #374151;
}

.rich-response strong,
.rich-response b {
  font-style: italic;
  color: #1e40af;
  font-weight: 600;
}

.rich-response em,
.rich-response i:not(.fas):not(.fa):not(.far) {
  color: #7c3aed;
  font-style: italic;
}

/* Data and statistics emphasis */
.rich-response li strong,
.rich-facts li strong,
.dimension-category li strong {
  font-style: italic;
  color: #0369a1;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Overview Section */
.rich-overview {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-left: 4px solid #0ea5e9;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.rich-overview h3 {
  color: #0369a1;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.rich-overview p {
  color: #1e3a5f;
  line-height: 1.7;
  font-size: 0.875rem;
}

/* Key Facts Box */
.rich-facts {
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.rich-facts h4 {
  color: #a16207;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-family: 'Inter', system-ui, sans-serif;
}

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

.rich-facts li {
  padding: 0.4rem 0;
  color: #713f12;
  border-bottom: 1px dashed #fde047;
  font-size: 0.85rem;
  line-height: 1.6;
}

.rich-facts li:last-child {
  border-bottom: none;
}

/* Timeline */
.rich-timeline {
  margin-bottom: 1.25rem;
}

.rich-timeline h4 {
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.timeline-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: relative;
  padding: 0.5rem 0;
}

.timeline-container::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #22c55e, #f59e0b, #ef4444, #8b5cf6);
  z-index: 0;
}

.timeline-item {
  position: relative;
  z-index: 1;
  color: white;
  padding: 0.4rem 0.65rem;
  border-radius: 0.375rem;
  font-size: 0.7rem;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
  font-family: 'Inter', system-ui, sans-serif;
}

/* Mentor Avatar Styles */
.mentor-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #30A7B2;
  box-shadow: 0 2px 8px rgba(48, 167, 178, 0.3);
}

.mentor-avatar-container {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a7b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #30A7B2;
  box-shadow: 0 2px 8px rgba(48, 167, 178, 0.3);
}

/* Dimensions */
.rich-dimensions {
  background: #f9fafb;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.rich-dimensions h4 {
  color: #374151;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.dimension-category {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.dimension-category:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.dimension-category h5 {
  color: #30A7B2;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.dimension-category ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
}

.dimension-category li {
  color: #4b5563;
  font-size: 0.825rem;
  padding: 0.25rem 0;
  line-height: 1.6;
}

/* Keywords */
.rich-keywords {
  margin-bottom: 1rem;
}

.rich-keywords h4 {
  color: #374151;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.rich-keywords h4::after {
  content: ' (click to explore)';
  font-size: 0.7rem;
  font-weight: 400;
  color: #9ca3af;
  font-style: italic;
}

.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.keyword-tag {
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 500;
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 0.025em;
  transition: all 0.2s ease;
}

/* Clickable keyword styles */
.clickable-keyword {
  cursor: pointer;
  position: relative;
}

.clickable-keyword:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  filter: brightness(1.1);
}

.clickable-keyword:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.clickable-keyword::after {
  content: '→';
  margin-left: 4px;
  font-size: 0.6rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.clickable-keyword:hover::after {
  opacity: 1;
}

.tag-blue { background: #dbeafe; color: #1e40af; }
.tag-green { background: #dcfce7; color: #166534; }
.tag-yellow { background: #fef3c7; color: #92400e; }
.tag-red { background: #fee2e2; color: #991b1b; }
.tag-purple { background: #f3e8ff; color: #6b21a8; }
.tag-orange { background: #ffedd5; color: #c2410c; }
.tag-teal { background: #ccfbf1; color: #0f766e; }

/* Case Studies */
.rich-case-studies {
  margin-bottom: 1rem;
}

.rich-case-studies h4 {
  color: #374151;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.case-study-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.case-study-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.case-country {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.case-study-card h5 {
  color: #1f2937;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.case-study-card p {
  color: #6b7280;
  font-size: 0.75rem;
  line-height: 1.5;
  font-style: italic;
}

/* Government Initiatives */
.rich-initiatives {
  margin-bottom: 1rem;
}

.rich-initiatives h4 {
  color: #374151;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.initiative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.initiative-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: 0.5rem;
  padding: 1rem;
}

.initiative-country {
  font-size: 0.75rem;
  color: #166534;
  margin-bottom: 0.25rem;
}

.initiative-card h5 {
  color: #14532d;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.initiative-card p {
  color: #166534;
  font-size: 0.75rem;
  line-height: 1.5;
  font-style: italic;
}

/* UPSC Relevance */
.rich-upsc-relevance {
  background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
  border: 1px solid #e879f9;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.rich-upsc-relevance h4 {
  color: #86198f;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.rich-upsc-relevance p {
  color: #701a75;
  font-size: 0.825rem;
  margin: 0.25rem 0;
  line-height: 1.6;
}

.rich-upsc-relevance p strong {
  font-style: italic;
  color: #581c87;
}

/* Quotes Box */
.rich-quotes {
  background: #f1f5f9;
  border-left: 4px solid #64748b;
  padding: 1rem;
  margin: 1rem 0;
  font-style: italic;
  color: #475569;
}

.rich-quotes cite {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-weight: 600;
  color: #334155;
}

/* ==================== NEW ENHANCED COMPONENTS ==================== */

/* What UPSC Wants Section */
.rich-upsc-wants {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.rich-upsc-wants h4 {
  color: #334155;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.upsc-expectation {
  color: #475569;
  font-size: 0.85rem;
  line-height: 1.7;
  font-style: italic;
  background: white;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border-left: 3px solid #30A7B2;
}

/* Answer Flowchart */
.rich-flowchart {
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.flowchart-container {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  min-width: max-content;
  padding: 0.5rem;
}

.flow-box {
  min-width: 140px;
  max-width: 180px;
  border-radius: 0.5rem;
  padding: 0.75rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 2px solid;
  flex-shrink: 0;
}

.flow-intro {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #60a5fa;
}

.flow-body {
  background: linear-gradient(135deg, #fefce8 0%, #fef08a 50%, #fef9c3 100%);
  border-color: #facc15;
}

.flow-conclusion {
  background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);
  border-color: #4ade80;
}

.flow-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  color: #1e293b;
}

.flow-content {
  font-size: 0.72rem;
  color: #475569;
  line-height: 1.4;
}

.flow-arrow {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  color: #94a3b8;
  padding: 0 0.5rem;
  font-weight: bold;
}

/* Rich Tables */
.rich-table-container {
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.rich-table-container h4 {
  color: #374151;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.rich-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.rich-table thead {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a7b 100%);
}

.rich-table th {
  color: white;
  font-weight: 600;
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #30A7B2;
}

.rich-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  color: #374151;
  vertical-align: top;
}

.rich-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.rich-table tbody tr:hover {
  background: #f0f9ff;
}

.rich-table td strong {
  color: #1e40af;
  font-weight: 600;
  font-style: normal;
}

/* Comparison Table specific */
.comparison-table thead th:first-child {
  background: #334155;
}

.comparison-table thead th:nth-child(2) {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

.comparison-table thead th:nth-child(3) {
  background: linear-gradient(135deg, #22c55e 0%, #4ade80 100%);
}

/* Dimension Grid (new layout) */
.dimension-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.dimension-grid .dimension-category {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 0;
  border-bottom: none;
}

.dimension-grid .dimension-category h5 {
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Keyword Hint */
.keyword-hint {
  font-size: 0.65rem;
  font-weight: 400;
  color: #9ca3af;
  font-style: italic;
}

/* Override the ::after content when we have the hint */
.rich-keywords h4 .keyword-hint + *::after {
  content: none;
}

.rich-keywords h4:has(.keyword-hint)::after {
  content: none !important;
}

/* ==================== KEYWORD POPUP MODAL ==================== */
.keyword-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.keyword-popup {
  background: #1e293b;
  border-radius: 1rem;
  max-width: 450px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

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

.keyword-popup-header {
  padding: 1.25rem 1.5rem 0.75rem;
  position: relative;
}

.keyword-popup-title {
  color: white;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.keyword-popup-subtitle {
  color: #38bdf8;
  font-size: 0.8rem;
  font-style: italic;
}

.keyword-popup-image {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 60px;
  height: 60px;
  border-radius: 0.5rem;
  object-fit: cover;
  border: 2px solid #475569;
}

.keyword-popup-body {
  padding: 1rem 1.5rem 1.5rem;
  color: #e2e8f0;
  font-size: 0.9rem;
  line-height: 1.7;
}

.keyword-popup-body p {
  margin: 0;
}

.keyword-popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: #475569;
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.keyword-popup-close:hover {
  background: #ef4444;
  transform: scale(1.1);
}

.keyword-popup-actions {
  padding: 0 1.5rem 1.25rem;
  display: flex;
  gap: 0.75rem;
}

.keyword-popup-btn {
  flex: 1;
  padding: 0.65rem 1rem;
  border-radius: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.keyword-popup-btn-explore {
  background: linear-gradient(135deg, #30A7B2 0%, #2a96a0 100%);
  color: white;
}

.keyword-popup-btn-explore:hover {
  background: linear-gradient(135deg, #2a96a0 0%, #248690 100%);
  transform: translateY(-1px);
}

.keyword-popup-btn-close {
  background: #475569;
  color: white;
}

.keyword-popup-btn-close:hover {
  background: #64748b;
}

/* ==================== RESPONSIVE STYLES ==================== */

/* Tablet */
@media (max-width: 768px) {
  .flowchart-container {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }
  
  .flow-box {
    max-width: 100%;
    width: 100%;
  }
  
  .flow-arrow {
    transform: rotate(90deg);
    padding: 0.25rem 0;
  }
  
  .dimension-grid {
    grid-template-columns: 1fr;
  }
  
  .rich-table {
    font-size: 0.75rem;
  }
  
  .rich-table th,
  .rich-table td {
    padding: 0.5rem 0.65rem;
  }
  
  .keyword-popup {
    max-width: 90%;
  }
  
  .case-study-grid,
  .initiative-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .timeline-container {
    flex-direction: column;
  }
  
  .timeline-container::before {
    top: 0;
    bottom: 0;
    left: 1rem;
    width: 3px;
    height: auto;
  }
  
  .timeline-item {
    margin-left: 2rem;
  }
  
  .rich-overview,
  .rich-facts,
  .rich-dimensions,
  .rich-table-container,
  .rich-case-studies,
  .rich-initiatives,
  .rich-upsc-relevance,
  .rich-upsc-wants {
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
  }
  
  .rich-overview h3,
  .rich-overview h4,
  .rich-facts h4,
  .rich-dimensions h4,
  .rich-table-container h4,
  .rich-case-studies h4,
  .rich-initiatives h4,
  .rich-upsc-relevance h4,
  .rich-upsc-wants h4 {
    font-size: 0.875rem;
  }
  
  .rich-response {
    font-size: 0.85rem;
  }
  
  .keyword-tags {
    gap: 0.4rem;
  }
  
  .keyword-tag {
    padding: 0.3rem 0.55rem;
    font-size: 0.65rem;
  }
  
  .flow-box {
    min-width: unset;
    padding: 0.65rem;
  }
  
  .flow-title {
    font-size: 0.72rem;
  }
  
  .flow-content {
    font-size: 0.68rem;
  }
  
  .keyword-popup-title {
    font-size: 1.1rem;
  }
  
  .keyword-popup-body {
    font-size: 0.85rem;
    padding: 0.85rem 1.25rem 1.25rem;
  }
  
  .keyword-popup-actions {
    flex-direction: column;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  .rich-table th,
  .rich-table td {
    padding: 0.4rem 0.5rem;
    font-size: 0.7rem;
  }
  
  .timeline-item {
    font-size: 0.65rem;
    padding: 0.35rem 0.5rem;
  }
  
  .keyword-popup-header {
    padding: 1rem 1.25rem 0.5rem;
  }
  
  .keyword-popup-body {
    padding: 0.75rem 1.25rem 1rem;
  }
}

/* ==================== ENHANCED TIMELINE (Key Events) ==================== */
.rich-timeline-enhanced {
  margin-bottom: 1.5rem;
  background: #f8fafc;
  border-radius: 0.75rem;
  padding: 1.25rem;
  overflow-x: auto;
}

.rich-timeline-enhanced h4 {
  color: #1e293b;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  font-family: 'Inter', system-ui, sans-serif;
  text-align: center;
}

.timeline-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  position: relative;
  padding: 1rem 0 2rem;
  min-width: max-content;
}

.timeline-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #22c55e, #f59e0b, #8b5cf6, #ec4899, #ef4444);
  border-radius: 2px;
  transform: translateY(-50%);
}

.timeline-track::after {
  content: '→';
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: #64748b;
}

.timeline-event {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  position: relative;
  z-index: 1;
}

.timeline-event::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--event-color, #3b82f6);
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  margin-bottom: 0.75rem;
}

.event-year {
  background: var(--event-color, #3b82f6);
  color: white;
  padding: 0.35rem 0.65rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'Inter', system-ui, sans-serif;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.event-desc {
  background: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.7rem;
  color: #475569;
  text-align: center;
  max-width: 110px;
  line-height: 1.4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

/* ==================== PRACTICE SECTION ==================== */
.rich-practice-section {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f0fdf4 100%);
  border: 2px solid #38bdf8;
  border-radius: 1rem;
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.rich-practice-section h4 {
  color: #0369a1;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.practice-intro {
  color: #334155;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.practice-intro strong {
  color: #0369a1;
}

.practice-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.practice-btn {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', system-ui, sans-serif;
}

.practice-btn i {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.practice-btn span {
  font-size: 0.9rem;
  font-weight: 600;
}

.practice-btn small {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

.practice-btn-prelims {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.practice-btn-prelims:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.practice-btn-mains {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.practice-btn-mains:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

/* ==================== PYQ RESPONSE STYLES ==================== */
.pyq-container {
  margin-top: 1rem;
}

.pyq-question {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pyq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.pyq-year {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'Inter', system-ui, sans-serif;
}

.pyq-paper {
  color: #64748b;
  font-size: 0.75rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.pyq-text {
  color: #1e293b;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.pyq-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pyq-option {
  padding: 0.65rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f8fafc;
}

.pyq-option:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.pyq-option.correct {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

.pyq-option.wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.pyq-explanation {
  background: #f0fdf4;
  border-left: 4px solid #22c55e;
  padding: 0.75rem 1rem;
  border-radius: 0 0.5rem 0.5rem 0;
  font-size: 0.8rem;
  color: #166534;
}

.pyq-explanation strong {
  color: #15803d;
}

/* ==================== MAINS ANSWER FORMAT ==================== */
.mains-container {
  margin-top: 1rem;
}

.mains-question-box {
  background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
  border: 2px solid #d946ef;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.mains-question-box h5 {
  color: #86198f;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.mains-question-text {
  color: #4a044e;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.6;
}

.mains-word-limit {
  display: inline-block;
  background: #d946ef;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.mains-answer {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.mains-answer h5 {
  color: #374151;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  font-family: 'Inter', system-ui, sans-serif;
}

.mains-answer-content {
  font-size: 0.875rem;
  line-height: 1.8;
  color: #374151;
}

.mains-answer-content p {
  margin-bottom: 0.75rem;
  text-align: justify;
}

/* ==================== RESPONSIVE FOR NEW COMPONENTS ==================== */
@media (max-width: 768px) {
  .timeline-track {
    flex-direction: column;
    align-items: flex-start;
    padding-left: 2rem;
  }
  
  .timeline-track::before {
    top: 0;
    bottom: 0;
    left: 1rem;
    width: 4px;
    height: auto;
    transform: none;
  }
  
  .timeline-track::after {
    display: none;
  }
  
  .timeline-event {
    flex-direction: row;
    align-items: center;
    min-width: 100%;
    margin-bottom: 1rem;
  }
  
  .timeline-event::before {
    position: absolute;
    left: -1.5rem;
    margin-bottom: 0;
  }
  
  .event-year {
    margin-bottom: 0;
    margin-right: 0.75rem;
    min-width: 60px;
    text-align: center;
  }
  
  .event-desc {
    max-width: none;
    flex: 1;
    text-align: left;
  }
  
  .practice-buttons {
    flex-direction: column;
  }
  
  .practice-btn {
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .rich-timeline-enhanced {
    padding: 1rem;
  }
  
  .rich-timeline-enhanced h4 {
    font-size: 0.9rem;
  }
  
  .event-year {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
  }
  
  .event-desc {
    font-size: 0.68rem;
  }
  
  .rich-practice-section {
    padding: 1rem;
  }
  
  .practice-btn {
    padding: 0.85rem;
  }
  
  .practice-btn i {
    font-size: 1.25rem;
  }
  
  .practice-btn span {
    font-size: 0.85rem;
  }
}
