/**
 * Character Refresh Loading Indicators
 * Task 14: Enhanced loading indicators (Requirement 6.1, 6.5)
 */

/* Global refresh loading overlay */
.global-refresh-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Loading content container */
.global-refresh-loading .loading-content {
  background: white;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  text-align: center;
  min-width: 320px;
  max-width: 480px;
  animation: slideUp 0.3s ease-out;
}

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

/* Loading spinner */
.global-refresh-loading .loading-spinner {
  font-size: 48px;
  color: #3b82f6;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.global-refresh-loading .loading-spinner i {
  display: inline-block;
}

/* Loading text */
.global-refresh-loading .loading-text {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 24px;
}

/* Progress bar container */
.global-refresh-loading .loading-progress {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

/* Progress bar fill */
.global-refresh-loading .progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 4px;
  transition: width 0.3s ease-out;
  width: 0%;
  position: relative;
  overflow: hidden;
}

/* Animated shimmer effect on progress bar */
.global-refresh-loading .progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Progress count */
.global-refresh-loading .loading-count {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* Refresh button active state */
.refresh-btn.refreshing-active {
  position: relative;
  overflow: hidden;
}

.refresh-btn.refreshing-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: buttonShimmer 1.5s infinite;
}

@keyframes buttonShimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Character card loading overlay */
.refresh-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 12px;
}

.character-card.refreshing .refresh-loading-overlay {
  display: flex;
}

/* Card loading spinner */
.refresh-loading-spinner {
  font-size: 32px;
  color: #3b82f6;
}

.refresh-loading-spinner i {
  animation: spin 1s linear infinite;
}

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

/* Character card refreshing state */
.character-card.refreshing {
  position: relative;
  opacity: 0.7;
}

/* Refresh status container */
.character-refresh-status-container {
  margin-bottom: 16px;
}

.refresh-status {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
}

.refresh-status:empty {
  display: none;
}

/* Status types */
.refresh-status.status-loading {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.refresh-status.status-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.refresh-status.status-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.refresh-status.status-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Toast notification */
.refresh-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 16px 20px;
  min-width: 320px;
  max-width: 480px;
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease-out;
}

.refresh-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.refresh-toast .toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.refresh-toast .toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}

/* Removed duplicate ::before pseudo-elements - using FontAwesome icons instead */

.refresh-toast .toast-message {
  flex: 1;
  font-size: 14px;
  color: #1f2937;
  line-height: 1.5;
  white-space: pre-line;
}

.refresh-toast .toast-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  transition: color 0.2s;
}

.refresh-toast .toast-close:hover {
  color: #4b5563;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .global-refresh-loading .loading-content {
    min-width: 280px;
    padding: 32px 24px;
  }

  .global-refresh-loading .loading-spinner {
    font-size: 40px;
  }

  .global-refresh-loading .loading-text {
    font-size: 16px;
  }

  .refresh-toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    min-width: auto;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .global-refresh-loading .loading-content {
    background: #1f2937;
    color: #f3f4f6;
  }

  .global-refresh-loading .loading-text {
    color: #f3f4f6;
  }

  .global-refresh-loading .loading-progress {
    background: #374151;
  }

  .refresh-toast {
    background: #1f2937;
  }

  .refresh-toast .toast-message {
    color: #f3f4f6;
  }
}
