/* AI Trends Analyzer - Main Styles */
:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --info-color: #0dcaf0;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  
  --border-radius: 0.5rem;
  --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  
  --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Base Typography */
body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--dark-color);
  background-color: #f5f7fa;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  margin-bottom: 1rem;
}

.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
  font-weight: 300;
}

/* Material Icons Alignment */
.material-icons {
  vertical-align: middle;
  font-size: 1.2em;
}

.material-icons.fs-1 {
  font-size: 2.5rem !important;
}

/* Navigation */
.navbar-brand {
  font-weight: 500;
  font-size: 1.25rem;
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.85);
  transition: color 0.2s ease;
}

.navbar-dark .navbar-nav .nav-link:hover {
  color: white;
}

/* Cards */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: all 0.3s ease;
}

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

.card-header {
  background-color: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
  font-weight: 500;
}

/* Buttons */
.btn {
  border-radius: var(--border-radius);
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn .material-icons {
  font-size: 1.1em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0b5ed7 0%, #0a58ca 100%);
  transform: translateY(-1px);
}

.btn-outline-primary:hover {
  transform: translateY(-1px);
}

/* Forms */
.form-control, .form-select {
  border-radius: var(--border-radius);
  border: 1px solid #ced4da;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
  font-weight: 500;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
}

/* Badges */
.badge {
  font-weight: 500;
  border-radius: var(--border-radius);
}

.badge.fs-6 {
  font-size: 0.875rem !important;
  padding: 0.5rem 0.75rem;
}

/* Loading States */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.loading-spinner {
  text-align: center;
  color: white;
}

.loading-spinner .spinner-border {
  width: 3rem;
  height: 3rem;
}

/* HTMX Indicators */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.htmx-request .htmx-indicator {
  opacity: 1;
}

.htmx-request.htmx-indicator {
  opacity: 1;
}

/* Search Enhancements */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ced4da;
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--box-shadow-lg);
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f8f9fa;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.search-result-item:hover {
  background-color: #f8f9fa;
}

.search-result-item:last-child {
  border-bottom: none;
}

/* Pagination */
.pagination .page-link {
  border-radius: var(--border-radius);
  margin: 0 2px;
  border: 1px solid #dee2e6;
  color: var(--primary-color);
  transition: all 0.2s ease;
}

.pagination .page-link:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Toast Notifications */
.toast {
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow-lg);
}

.toast-header {
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Modal Enhancements */
.modal-content {
  border-radius: var(--border-radius);
  border: none;
  box-shadow: var(--box-shadow-lg);
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.125);
}

/* Content Preview */
.content-preview pre {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: var(--border-radius);
  padding: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  overflow-y: auto;
}

/* Trend Description */
.trend-description {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #495057;
}

.trend-description p {
  margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .display-5 {
    font-size: 2rem;
  }
  
  .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .badge.fs-6 {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem;
  }
}

@media (max-width: 576px) {
  .navbar-brand {
    font-size: 1rem;
  }
  
  .lead {
    font-size: 1rem;
  }
  
  .btn-group-vertical .btn {
    margin-bottom: 0.5rem;
  }
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

.slide-up {
  animation: slideUp 0.5s ease-out;
}

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

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

/* Accessibility */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

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

.btn:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .card {
    border: 2px solid var(--dark-color);
  }
  
  .btn-outline-primary {
    border-width: 2px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .navbar,
  .loading-overlay,
  .toast-container,
  .modal,
  .btn {
    display: none !important;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  body {
    background-color: white;
  }
}
