/* Custom styles for SQL Learning Platform */

/* Tamil font support */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;500;600;700&family=Source+Code+Pro:wght@400;500;600&display=swap');

:root {
  --tamil-font: 'Noto Sans Tamil', system-ui, -apple-system, sans-serif;
  --code-font: 'Source Code Pro', 'Consolas', 'Monaco', monospace;
}

/* Typography for Tamil text support */
.tanglish-text {
  font-family: var(--tamil-font);
  line-height: 1.6;
}

/* Code editor styles */
.CodeMirror {
  height: 300px;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  font-family: var(--code-font);
  font-size: 14px;
}

.CodeMirror-focused {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Results table styling */
.results-table {
  max-height: 400px;
  overflow-y: auto;
}

.results-table table {
  font-size: 0.9rem;
}

.results-table th {
  background-color: var(--bs-primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Error message styling */
.error-message {
  background-color: var(--bs-danger-bg-subtle);
  border: 1px solid var(--bs-danger-border-subtle);
  color: var(--bs-danger-text-emphasis);
  border-radius: 0.375rem;
  padding: 1rem;
  font-family: var(--tamil-font);
}

.success-message {
  background-color: var(--bs-success-bg-subtle);
  border: 1px solid var(--bs-success-border-subtle);
  color: var(--bs-success-text-emphasis);
  border-radius: 0.375rem;
  padding: 1rem;
  font-family: var(--tamil-font);
}

/* Dark mode flash message styling - More specific selectors to override Bootstrap */
[data-bs-theme="dark"] .alert.alert-danger,
[data-bs-theme="dark"] .alert-danger {
  color: #ffffff !important;
  --bs-alert-color: #ffffff !important;
}

[data-bs-theme="dark"] .alert.alert-success,
[data-bs-theme="dark"] .alert-success {
  color: #ffffff !important;
  --bs-alert-color: #ffffff !important;
}

[data-bs-theme="dark"] .alert.alert-info,
[data-bs-theme="dark"] .alert-info {
  color: #ffffff !important;
  --bs-alert-color: #ffffff !important;
}

[data-bs-theme="dark"] .alert.alert-warning,
[data-bs-theme="dark"] .alert-warning {
  color: #ffffff !important;
  --bs-alert-color: #ffffff !important;
}

[data-bs-theme="dark"] .alert.alert-error,
[data-bs-theme="dark"] .alert-error {
  color: #ffffff !important;
  --bs-alert-color: #ffffff !important;
}

/* Ensure all alert content is white in dark theme with highest specificity */
html[data-bs-theme="dark"] .alert,
html[data-bs-theme="dark"] .alert strong,
html[data-bs-theme="dark"] .alert * {
  color: #ffffff !important;
}

/* Exception: Step-by-Step Explanation alert should have black text due to light background */
html[data-bs-theme="dark"] .alert-info[style*="linear-gradient"],
html[data-bs-theme="dark"] .alert-info[style*="linear-gradient"] strong,
html[data-bs-theme="dark"] .alert-info[style*="linear-gradient"] * {
  color: #000000 !important;
}

/* Payment page styling */
.payment-features-card {
  background-color: var(--bs-light);
}

.payment-features-title {
  color: var(--bs-dark);
}

.payment-feature-item {
  color: var(--bs-dark);
}

/* Dark mode payment page styling */
[data-bs-theme="dark"] .payment-features-card {
  background-color: var(--bs-dark);
  border: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .payment-features-title {
  color: #ffffff !important;
}

[data-bs-theme="dark"] .payment-feature-item {
  color: #ffffff !important;
}

/* Progress indicators */
.progress-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
}

/* Card hover effects */
.card:hover {
  transform: translateY(-2px);
  transition: transform 0.2s ease-in-out;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Button loading state */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Hero section */
.hero-section {
  background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-info) 100%);
}

/* Feature icons */
.feature-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  background-color: var(--bs-light);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .CodeMirror {
    height: 200px;
  }
  
  .hero-section .display-4 {
    font-size: 2rem;
  }
  
  .feature-icon {
    width: 50px;
    height: 50px;
  }
}

/* Dark theme adjustments */
[data-bs-theme="dark"] .CodeMirror {
  background-color: var(--bs-dark);
  color: var(--bs-light);
}

[data-bs-theme="dark"] .feature-icon {
  background-color: var(--bs-dark);
}

/* Loading spinner for results */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

/* SQL syntax highlighting in solution modals */
.sql-code {
  background-color: var(--bs-dark);
  color: var(--bs-light);
  padding: 1rem;
  border-radius: 0.375rem;
  font-family: var(--code-font);
  overflow-x: auto;
}

/* Badge styles for difficulty levels */
.badge-beginner {
  background-color: var(--bs-success);
}

.badge-intermediate {
  background-color: var(--bs-warning);
}

.badge-advanced {
  background-color: var(--bs-danger);
}

/* Question navigation */
.question-nav {
  position: sticky;
  top: 20px;
}

/* Tanglish text improvements */
.tanglish-content {
  font-family: var(--tamil-font);
  line-height: 1.7;
  font-size: 1.05rem;
}

.tanglish-content strong {
  font-weight: 600;
}

/* Results animation */
.results-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

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

/* Empty state styling */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--bs-text-muted);
}

.empty-state i {
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Subscription pricing cards */
.pricing-card {
  transition: transform 0.3s ease;
}

.pricing-card:hover {
  transform: scale(1.05);
}

.price {
  margin: 1rem 0;
}

/* Modal improvements */
.modal-content {
  border-radius: 0.5rem;
}

.modal-header {
  border-bottom: 1px solid var(--bs-border-color);
}

/* Accessibility improvements */
.btn:focus,
.form-control:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Blog content text visibility fixes - Proper theme support */
[data-bs-theme="dark"] .blog-content,
[data-bs-theme="dark"] .blog-content p,
[data-bs-theme="dark"] .blog-content h1,
[data-bs-theme="dark"] .blog-content h2,
[data-bs-theme="dark"] .blog-content h3,
[data-bs-theme="dark"] .blog-content h4,
[data-bs-theme="dark"] .blog-content h5,
[data-bs-theme="dark"] .blog-content h6,
[data-bs-theme="dark"] .blog-content li,
[data-bs-theme="dark"] .blog-content ul,
[data-bs-theme="dark"] .blog-content ol,
[data-bs-theme="dark"] .blog-content strong,
[data-bs-theme="dark"] .blog-content em,
[data-bs-theme="dark"] .blog-content span,
[data-bs-theme="dark"] .blog-content blockquote {
    color: #ffffff !important;
}

[data-bs-theme="light"] .blog-content,
[data-bs-theme="light"] .blog-content p,
[data-bs-theme="light"] .blog-content h1,
[data-bs-theme="light"] .blog-content h2,
[data-bs-theme="light"] .blog-content h3,
[data-bs-theme="light"] .blog-content h4,
[data-bs-theme="light"] .blog-content h5,
[data-bs-theme="light"] .blog-content h6,
[data-bs-theme="light"] .blog-content li,
[data-bs-theme="light"] .blog-content ul,
[data-bs-theme="light"] .blog-content ol,
[data-bs-theme="light"] .blog-content strong,
[data-bs-theme="light"] .blog-content em,
[data-bs-theme="light"] .blog-content span,
[data-bs-theme="light"] .blog-content blockquote {
    color: #212529 !important;
}

/* Case Studies page specific fixes - make all text visible */
div[style*="background-color: #495057"] h5,
div[style*="background-color: #495057"] p,
div[style*="background-color: #495057"] li,
div[style*="background-color: #495057"] ul {
    color: #ffffff !important;
}

/* Force visibility for all case studies info text */
.container h5,
.container p,
.container li,
.container ul {
    color: #ffffff !important;
}

/* Override any bootstrap text classes - proper theme support */
[data-bs-theme="dark"] .text-muted {
    color: #6c757d !important;
}

[data-bs-theme="light"] .text-muted {
    color: #6c757d !important;
}

/* Code blocks in blog content */
.blog-content pre {
    background-color: #212529 !important;
    border: 1px solid #495057 !important;
    border-radius: 0.375rem !important;
    padding: 1rem !important;
    color: #ffffff !important;
}

.blog-content code {
    background-color: #495057 !important;
    color: #f8f9fa !important;
    padding: 0.2rem 0.4rem !important;
    border-radius: 0.25rem !important;
}

/* Blog listing page fixes - Proper light/dark theme support */
[data-bs-theme="dark"] .card .card-title,
[data-bs-theme="dark"] .card .card-text {
    color: #ffffff !important;
}

[data-bs-theme="light"] .card .card-title,
[data-bs-theme="light"] .card .card-text {
    color: #212529 !important;
}

/* Proper text-dark class for both themes */
[data-bs-theme="dark"] .text-dark {
    color: #ffffff !important;
}

[data-bs-theme="light"] .text-dark {
    color: #212529 !important;
}

/* Ensure badges are visible */
.badge.bg-light {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

/* AI Icon and Floating Action Button Fixes */
.ai-floating-button,
.floating-ai-menu {
    z-index: 9999 !important;
    position: fixed !important;
}

.ai-dropdown-menu,
.floating-dropdown {
    z-index: 9999 !important;
    position: absolute !important;
    background: white !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    animation: none !important;
}

/* Prevent flickering in dark theme */
[data-bs-theme="dark"] .ai-dropdown-menu,
[data-bs-theme="dark"] .floating-dropdown {
    background: var(--bs-dark) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-light) !important;
}

/* Ensure AI elements stay on top of modals and other overlays */
.modal {
    z-index: 1050;
}

.ai-floating-button,
.floating-ai-menu,
.ai-dropdown-menu,
.floating-dropdown {
    z-index: 9999 !important;
}

/* Print styles */
@media print {
  .sidebar,
  .navbar,
  .footer,
  .btn,
  .ai-floating-button,
  .floating-ai-menu {
    display: none !important;
  }
  
  .container-fluid {
    padding: 0 !important;
  }
}
