/* 
  Ready2Study - Premium Design System 
  Theme: Vibrant Academic (Indigo, Rose, Teal, Amber)
*/

@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=Noto+Sans+Tamil:wght@400;500;600;700&display=swap');

:root {
  /* Vibrant Color Palette */
  --primary: #1e40af;
  /* Blue 800 */
  --primary-dark: #1e3a8a;
  /* Blue 900 */
  --secondary: #f43f5e;
  /* Rose 500 */
  --accent-teal: #14b8a6;
  /* Teal 500 */
  --accent-amber: #f59e0b;
  /* Amber 500 */

  --background: #f0fdfa;
  /* Azure/Mint tint */
  --surface: #ffffff;
  --text-main: #0f172a;
  /* Slate 900 */
  --text-muted: #475569;
  /* Slate 600 */
  --border: #e2e8f0;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #1e40af 55%, #1d4ed8 100%);
  /* Dark Blue Gradient */
  --gradient-bg: linear-gradient(120deg, #f0fdfa 0%, #fff7ed 100%);
  /* Mint to Orange tint */
  --gradient-card: linear-gradient(to bottom right, #ffffff, #f8fafc);

  /* Shadows */
  --shadow-sm: 0 2px 4px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgba(30, 64, 175, 0.4);

  /* Spacing & Radius */
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --container-width: 1200px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--gradient-bg);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Utilities */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  font-size: 1rem;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(30, 64, 175, 0.5);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

/* Header */
header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
  box-shadow: var(--shadow-sm);
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo svg {
  stroke: var(--primary);
}

/* Hero Section (Landing) */
.hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 0;
  position: relative;
  overflow: hidden;
}

/* Background Blobs */
.hero::before {
  content: '';
  position: absolute;
  top: -10%;
  right: -5%;
  width: 400px;
  height: 400px;
  background: rgba(30, 64, 175, 0.15);
  filter: blur(80px);
  border-radius: 50%;
  z-index: -1;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -5%;
  width: 300px;
  height: 300px;
  background: rgba(244, 63, 94, 0.15);
  filter: blur(80px);
  border-radius: 50%;
  z-index: -1;
}

.hero-content h1 {
  font-size: 4rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  background: linear-gradient(to right, #0f172a, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-content p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 3rem;
}

/* Upload Card */
.upload-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-xl);
  padding: 3rem;
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: transform 0.3s ease;
}

.drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  background: #f8fafc;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
  transform: scale(1.02);
}

.icon-upload {
  width: 64px;
  height: 64px;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.file-info {
  margin-top: 1rem;
  font-weight: 500;
  color: var(--primary);
  display: none;
  animation: fadeIn 0.3s ease;
}

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

/* Dashboard Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  padding: 2rem 0;
  align-items: start;
}

.sidebar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: sticky;
  top: 100px;
}

.filter-group h3 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.filter-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: #f1f5f9;
  color: var(--primary);
  transform: translateX(4px);
}

.filter-btn.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 10px rgba(30, 64, 175, 0.3);
}

.questions-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 200px;
  width: 100%;
}

.questions-grid.one-by-one-view {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.questions-grid.one-by-one-view .question-card {
  width: 100%;
  animation: fadeIn 0.3s ease;
  display: block !important;
  visibility: visible !important;
}

.questions-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.question-navigation {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem;
}

/* Colorful Cards based on Marks */
.question-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: visible;
  border-left: 3px solid transparent;
  margin-bottom: 1rem;
  /* Colored accent bar */
}

/* Specific Card Accents */
.question-card:has(.mark-1) {
  border-left-color: #10b981;
}

.question-card:has(.mark-2) {
  border-left-color: #3b82f6;
}

.question-card:has(.mark-3) {
  border-left-color: #f59e0b;
}

.question-card:has(.mark-10) {
  border-left-color: #ef4444;
}

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

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

.badge {
  display: inline-flex;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.exam-date-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  background: #f8fafc;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Vibrant Badges */
.badge.mark-1 {
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #34d399;
}

.badge.mark-2 {
  color: #1e40af;
  background: #dbeafe;
  border: 1px solid #60a5fa;
}

.badge.mark-3 {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fbbf24;
}

.badge.mark-10 {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #f87171;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #1e293b;
  line-height: 1.5;
}

.answer-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed #cbd5e1;
  display: block !important;
  background: #f8fafc;
  /* Subtle background for answer */
  margin-left: -2rem;
  margin-right: -2rem;
  margin-bottom: -2rem;
  padding: 1.5rem 2rem;
}

.answer-section.visible {
  display: block !important;
  animation: slideDown 0.3s ease;
}

/* PDF Content Section - Always visible when content exists */
#pdfContentSection {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin-bottom: 2rem;
  animation: fadeIn 0.5s ease;
}

#pdfContentSection[style*="display: none"] {
  display: none !important;
}

#pdfContentDisplay {
  max-height: 600px;
  overflow-y: auto;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 0.5rem;
  line-height: 1.8;
}

#pdfContentDisplay::-webkit-scrollbar {
  width: 8px;
}

#pdfContentDisplay::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

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

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

.answer-text {
  color: #334155;
  line-height: 1.8;
  font-size: 1rem;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading State */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid #e2e8f0;
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
  /* Colorful spinner */
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-icon {
  background: white;
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  transition: all 0.2s;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}
.answer-image-container {
  margin-top: 1.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: white;
  padding: 0.5rem;
}

.answer-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: calc(var(--radius-lg) - 0.5rem);
  object-fit: cover;
}

/* Highlight Feature */
.answer-text {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

.highlight {
  background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
  padding: 2px 4px;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.highlight:hover {
  background: linear-gradient(120deg, #fde047 0%, #facc15 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transform: scale(1.02);
}

.highlight::after {
  content: '✨';
  opacity: 0;
  transition: opacity 0.2s;
  margin-left: 4px;
  font-size: 0.75em;
}

.highlight:hover::after {
  opacity: 1;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.highlight-toolbar {
  position: fixed;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  gap: 0.5rem;
  align-items: center;
}

.highlight-toolbar.visible {
  display: flex;
}

.highlight-btn {
  background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  color: #78350f;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.highlight-btn:hover {
  background: linear-gradient(120deg, #fde047 0%, #facc15 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.remove-highlight-btn {
  background: #fee2e2;
  color: #991b1b;
}

.remove-highlight-btn:hover {
  background: #fecaca;
}

/* Important Action Button */
.action-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--text-muted);
}

.action-btn:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.1);
}

.action-btn.active {
  background: #fef2f2;
  border-color: #f43f5e;
  color: #f43f5e;
}

.action-btn svg {
  transition: all 0.2s;
}

.question-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Chat Button */
.chat-button {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  font-family: 'Inter', 'Poppins', sans-serif;
  transition: all 0.3s ease;
}

.chat-button:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-glow);
}

/* Translate Button Specific Styles */
#translateButton {
  width: auto !important;
  min-width: 60px;
  padding: 0 0.75rem !important;
  border-radius: 30px !important;
  font-family: 'Inter', 'Poppins', sans-serif;
}

#translateButton span {
  display: inline-block;
  vertical-align: middle;
}

/* Chat Modal */
.chat-modal {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 2rem;
  width: 400px;
  height: 600px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  flex-direction: column;
  overflow: hidden;
}

.chat-modal.active {
  display: flex;
}

.chat-modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 1.25rem;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.chat-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: background 0.2s;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f8fafc;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.chat-message.user-message {
  align-self: flex-end;
}

.chat-message.bot-message {
  align-self: flex-start;
}

.message-content {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  background: white;
  box-shadow: var(--shadow-sm);
}

.user-message .message-content {
  background: var(--gradient-primary);
  color: white;
}

.message-content p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.chat-input-container {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  background: white;
}

.chat-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--primary);
}

.chat-send {
  padding: 0.75rem 1rem;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.chat-send:hover {
  transform: scale(1.05);
}

.chat-question-btn {
  color: var(--primary);
}

.chat-question-btn:hover {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}

/* Media Modal */
.media-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.media-modal.active {
  display: flex;
}

.media-modal-content {
  background: white;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.media-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.media-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
}

.media-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.media-close:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.media-modal-body {
  padding: 1.5rem;
}

.media-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.media-upload-zone:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.media-upload-zone h4 {
  margin: 0.5rem 0;
  color: var(--text-main);
}

#mediaPreviewContent img,
#mediaPreviewContent video {
  max-width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.question-media-container {
  margin-top: 1rem;
  margin-bottom: 1rem;
  width: 100%;
}

.question-media-container img,
.question-media-container video {
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  object-fit: contain;
  background: #f8fafc;
}

.question-media-container video {
  max-height: 500px;
}

.question-media-container img {
  max-height: 500px;
  object-fit: contain;
}

.attach-media-btn {
  color: var(--accent-teal);
}

.attach-media-btn:hover {
  background: #e0f2f1;
  border-color: var(--accent-teal);
  color: var(--accent-teal);
}

/* PDF Content Modal */
.pdf-content-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.pdf-content-modal.active {
  display: flex;
}

.pdf-content-modal-content {
  background: white;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.pdf-content-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.pdf-content-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
}

.pdf-content-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.pdf-content-close:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.pdf-content-body {
  padding: 2rem;
  line-height: 1.8;
  color: var(--text-main);
}

.pdf-content-body h4 {
  color: var(--primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.pdf-content-body p {
  margin-bottom: 1rem;
}

/* Calculator Modal */
.calculator-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.calculator-modal.active {
  display: flex;
}

.calculator-modal-content {
  background: white;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.calculator-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calculator-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.calculator-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.calculator-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.calculator-body {
  padding: 1.5rem;
}

.calculator-display {
  background: #f8fafc;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  font-size: 2rem;
  font-weight: 700;
  text-align: right;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 1rem;
  color: var(--text-main);
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

.calculator-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.calc-btn {
  background: white;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
}

.calc-btn:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  transform: scale(1.05);
}

.calc-btn:active {
  transform: scale(0.95);
}

.calc-operator {
  background: var(--gradient-primary);
  color: white;
  border-color: var(--primary);
}

.calc-operator:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.calc-clear {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.calc-clear:hover {
  background: #fecaca;
}

.calc-equals {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-color: #10b981;
  grid-row: span 2;
}

.calc-equals:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.calc-zero {
  grid-column: span 2;
}

/* Translate Modal */
.translate-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.translate-modal.active {
  display: flex;
}

.translate-modal-content {
  background: white;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.translate-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.translate-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.translate-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.translate-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.translate-body {
  padding: 1.5rem;
}

.translate-input {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: all 0.2s;
}

.translate-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.translate-output {
  background: #f0fdf4;
  border: 2px solid #10b981;
  border-radius: 0.5rem;
  padding: 1rem;
  min-height: 100px;
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-main);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Noto Sans Tamil', 'Arial Unicode MS', sans-serif;
}

/* Sources Sidebar */
.sources-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sources-sidebar.active {
  right: 0;
}

.sources-sidebar-header {
  padding: 1.5rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #fee2e2 0%, #fef3c7 100%);
}

.sources-sidebar-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #991b1b;
  display: flex;
  align-items: center;
}

.close-sources-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  color: #991b1b;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-sources-btn:hover {
  background: rgba(153, 27, 27, 0.1);
  transform: rotate(90deg);
}

.sources-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.sources-section {
  margin-bottom: 2rem;
}

.sources-section h4 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sources-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.source-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.2s;
}

.source-link:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.15);
}

.source-link-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fee2e2 0%, #fef3c7 100%);
  border-radius: 0.375rem;
  color: #991b1b;
}

.source-link-content {
  flex: 1;
  min-width: 0;
}

.source-link-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-link-url {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sources-images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.source-image {
  position: relative;
  width: 100%;
  padding-bottom: 75%;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.source-image:hover {
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
}

.source-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sources-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sources-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.sources-sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .sources-sidebar {
    width: 100%;
    right: -100%;
  }
}
