/* 
 * Model Loading Animation CSS
 * Ultra-lightweight styles for model loading that prevent browser freezing
 * Version: 1.0.0 (May 12, 2025)
 */

/* Main container for models grid with loading state */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.models-grid.loading {
  position: relative;
  min-height: 200px;
}

/* Loading indicator specific to model grid */
.loading-indicator.model-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 20, 0.7);
  color: var(--text-primary, #e8ecff);
  border-radius: 8px;
  z-index: 10;
  padding: 20px;
  text-align: center;
}

/* Lightweight cyber spinner */
.cyber-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(40, 100, 200, 0.3);
  border-top: 3px solid rgba(80, 160, 255, 0.8);
  border-radius: 50%;
  animation: cyber-spin 1.5s linear infinite;
  margin-bottom: 15px;
}

@keyframes cyber-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error message when model loading fails */
.models-error-message {
  background: rgba(40, 15, 15, 0.8);
  border: 1px solid rgba(255, 70, 70, 0.5);
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
  color: #ffcccc;
  text-align: center;
}

.error-icon {
  font-size: 24px;
  margin-bottom: 10px;
}

.retry-button {
  background: rgba(70, 80, 120, 0.6);
  color: #ffffff;
  border: 1px solid rgba(100, 120, 200, 0.5);
  border-radius: 4px;
  padding: 5px 15px;
  margin-top: 10px;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  transition: all 0.2s ease;
}

.retry-button:hover {
  background: rgba(80, 100, 160, 0.8);
  border-color: rgba(120, 160, 255, 0.7);
}

/* Model card styling */
.model-card {
  background: rgba(20, 30, 45, 0.7);
  border: 1px solid rgba(60, 80, 120, 0.5);
  border-radius: 6px;
  padding: 12px;
  transition: all 0.3s ease;
}

.model-card:hover {
  background: rgba(30, 40, 60, 0.8);
  border-color: rgba(80, 120, 200, 0.6);
  transform: translateY(-2px);
}

.model-card.selected {
  background: rgba(30, 50, 80, 0.9);
  border-color: rgba(100, 160, 255, 0.8);
  box-shadow: 0 0 10px rgba(80, 140, 240, 0.4);
}

.model-name {
  font-weight: bold;
  font-family: 'Orbitron', sans-serif;
  margin-bottom: 8px;
  color: var(--text-highlight, #c0d8ff);
}

.model-info {
  font-size: 0.85em;
  color: var(--text-secondary, #a0a8c0);
  margin-bottom: 10px;
}

.info-item {
  margin-bottom: 4px;
}

.select-model-btn {
  width: 100%;
  background: rgba(40, 60, 100, 0.6);
  color: var(--text-primary, #e8ecff);
  border: 1px solid rgba(60, 100, 180, 0.5);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  transition: all 0.2s ease;
}

.select-model-btn:hover {
  background: rgba(50, 80, 140, 0.7);
  border-color: rgba(80, 140, 240, 0.6);
}

/* Search input styling */
#model-search {
  background: rgba(20, 25, 35, 0.7);
  border: 1px solid rgba(60, 80, 120, 0.5);
  border-radius: 4px;
  color: var(--text-primary, #e8ecff);
  padding: 8px 12px;
  width: 100%;
  max-width: 300px;
  font-family: 'Share Tech Mono', monospace;
  margin-bottom: 10px;
}

#model-search:focus {
  border-color: rgba(80, 140, 240, 0.6);
  outline: none;
  box-shadow: 0 0 5px rgba(80, 140, 240, 0.3);
}

/* Refresh button styling */
#refresh-models {
  background: rgba(30, 40, 70, 0.6);
  color: var(--text-primary, #e8ecff);
  border: 1px solid rgba(60, 100, 180, 0.5);
  border-radius: 4px;
  padding: 8px 15px;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}

#refresh-models:hover {
  background: rgba(40, 60, 100, 0.7);
  border-color: rgba(80, 140, 240, 0.6);
}

#refresh-models i {
  margin-right: 8px;
}

/* Active model display */
#active-model-display {
  font-weight: bold;
  color: var(--text-highlight, #c0d8ff);
  background: rgba(20, 30, 50, 0.6);
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid rgba(60, 100, 180, 0.4);
}

/* No models fallback display */
.no-models-message {
  text-align: center;
  color: var(--text-secondary, #a0a8c0);
  padding: 20px;
  background: rgba(20, 25, 35, 0.7);
  border-radius: 6px;
  margin: 15px 0;
}

/* Ensure animations run smoothly but don't cause browser freezes */
* {
  animation-duration: 1.5s !important;
  transition-duration: 0.3s !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }
}
