/* Refresh Error Handler Styles - Task 9 Implementation */

/* Toast Container */
.refresh-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  pointer-events: none;
  max-width: 400px;
}

/* Toast Notifications */
.refresh-toast {
  background: var(--bg-card, rgba(15, 23, 42, 0.95));
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.15));
  border-radius: var(--radius-lg, 15px);
  margin-bottom: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  overflow: hidden;
  position: relative;
}

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

/* Toast Types */
.refresh-toast.toast-success {
  border-left: 4px solid var(--accent-primary, #4ecdc4);
  background: rgba(78, 205, 196, 0.15);
}

.refresh-toast.toast-error {
  border-left: 4px solid var(--accent-secondary, #ff6b6b);
  background: rgba(255, 107, 107, 0.15);
}

.refresh-toast.toast-warning {
  border-left: 4px solid var(--accent-warning, #ffc107);
  background: rgba(255, 193, 7, 0.15);
}

.refresh-toast.toast-info {
  border-left: 4px solid var(--accent-tertiary, #45b7d1);
  background: rgba(69, 183, 209, 0.15);
}

/* Toast Content */
.toast-content {
  display: flex;
  align-items: flex-start;
  padding: 16px;
  gap: 12px;
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  /* Ensure icon is crisp */
  transform: translateZ(0);
  -webkit-font-smoothing: antialiased;
}

.toast-success .toast-icon {
  background: var(--accent-primary, #4ecdc4);
  color: white;
}

.toast-error .toast-icon {
  background: var(--accent-secondary, #ff6b6b);
  color: white;
}

.toast-warning .toast-icon {
  background: var(--accent-warning, #ffc107);
  color: #333;
}

.toast-info .toast-icon {
  background: var(--accent-tertiary, #45b7d1);
  color: white;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-message {
  color: #ffffff !important;
  font-size: 1rem !important;
  line-height: 1.4;
  margin-bottom: 8px;
  word-wrap: break-word;
  font-weight: bold !important;
  /* Remove text-shadow to prevent blur with backdrop-filter */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.toast-technical {
  color: var(--secondary-text, #b0b0b0);
  font-size: 0.8rem;
  font-family: monospace;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: 4px;
  margin-top: 8px;
  word-break: break-all;
}

.toast-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.toast-action-btn {
  background: var(--accent-primary, #4ecdc4);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast, 0.2s ease);
}

.toast-action-btn:hover {
  background: var(--accent-primary-dark, #3db8b0);
  transform: translateY(-1px);
}

.toast-close,
.toast-close-btn {
  background: none;
  border: none;
  color: var(--secondary-text, #b0b0b0);
  cursor: pointer;
  padding: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-fast, 0.2s ease);
  flex-shrink: 0;
}

.toast-close:hover,
.toast-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-text, #e0e0e0);
}
/* Progress Modal */
.refresh-progress-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.refresh-progress-modal.show {
  opacity: 1;
}

.refresh-progress-modal .modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.refresh-progress-modal .modal-content {
  position: relative;
  background: var(--bg-card, rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-xl, 20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.refresh-progress-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
}

.refresh-progress-modal .modal-header h3 {
  margin: 0;
  color: var(--accent-primary, #4ecdc4);
  font-size: var(--font-size-lg, 1.2rem);
  font-weight: 600;
}

.refresh-progress-modal .modal-close {
  background: none;
  border: none;
  color: var(--secondary-text, #b0b0b0);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: var(--transition-fast, 0.2s ease);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-progress-modal .modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-text, #e0e0e0);
}

.refresh-progress-modal .modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

/* Progress Overview */
.progress-overview {
  margin-bottom: 24px;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress-text {
  color: var(--primary-text, #e0e0e0);
  font-size: var(--font-size-small, 0.9rem);
  font-weight: 500;
}

.progress-percentage {
  color: var(--accent-primary, #4ecdc4);
  font-size: var(--font-size-small, 0.9rem);
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--accent-primary, #4ecdc4),
    var(--accent-tertiary, #45b7d1)
  );
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Character Progress List */
.character-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.character-progress-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md, 10px);
  transition: all 0.3s ease;
}

.character-progress-item.pending {
  border-left: 4px solid var(--secondary-text, #b0b0b0);
}

.character-progress-item.in-progress {
  border-left: 4px solid var(--accent-tertiary, #45b7d1);
  background: rgba(69, 183, 209, 0.1);
  animation: pulse 2s infinite;
}

.character-progress-item.completed {
  border-left: 4px solid var(--accent-primary, #4ecdc4);
  background: rgba(78, 205, 196, 0.1);
}

.character-progress-item.failed {
  border-left: 4px solid var(--accent-secondary, #ff6b6b);
  background: rgba(255, 107, 107, 0.1);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.character-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.character-name {
  color: var(--primary-text, #e0e0e0);
  font-weight: 500;
  font-size: var(--font-size-small, 0.9rem);
}

.character-server {
  color: var(--secondary-text, #b0b0b0);
  font-size: 0.8rem;
}

.character-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-icon {
  font-size: 0.9rem;
}

.character-progress-item.pending .status-icon {
  color: var(--secondary-text, #b0b0b0);
}

.character-progress-item.in-progress .status-icon {
  color: var(--accent-tertiary, #45b7d1);
}

.character-progress-item.completed .status-icon {
  color: var(--accent-primary, #4ecdc4);
}

.character-progress-item.failed .status-icon {
  color: var(--accent-secondary, #ff6b6b);
}

.status-text {
  color: var(--primary-text, #e0e0e0);
  font-size: 0.8rem;
  font-weight: 500;
}

/* Modal Footer */
.refresh-progress-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
}

.refresh-progress-modal .btn-cancel,
.refresh-progress-modal .btn-close {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md, 10px);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast, 0.2s ease);
}

.refresh-progress-modal .btn-cancel {
  background: var(--bg-secondary, rgba(255, 255, 255, 0.1));
  color: var(--primary-text, #e0e0e0);
}

.refresh-progress-modal .btn-cancel:hover {
  background: var(--bg-secondary-hover, rgba(255, 255, 255, 0.15));
}

.refresh-progress-modal .btn-close {
  background: var(--accent-primary, #4ecdc4);
  color: white;
}

.refresh-progress-modal .btn-close:hover {
  background: var(--accent-primary-dark, #3db8b0);
  transform: translateY(-1px);
}
/* Retry Modal */
.refresh-retry-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10002;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.refresh-retry-modal.show {
  opacity: 1;
}

.refresh-retry-modal .modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.refresh-retry-modal .modal-content {
  position: relative;
  background: var(--bg-card, rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-xl, 20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 500px;
  max-height: 70vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

.refresh-retry-modal .modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
}

.refresh-retry-modal .modal-header h3 {
  margin: 0;
  color: var(--accent-warning, #ffc107);
  font-size: var(--font-size-lg, 1.2rem);
  font-weight: 600;
}

.refresh-retry-modal .modal-body {
  padding: 24px;
  max-height: 50vh;
  overflow-y: auto;
}

.retry-message {
  text-align: center;
  margin-bottom: 24px;
}

.retry-message i {
  font-size: 2rem;
  color: var(--accent-warning, #ffc107);
  margin-bottom: 16px;
}

.retry-message p {
  color: var(--primary-text, #e0e0e0);
  margin: 8px 0;
  line-height: 1.5;
}

/* Failed Characters List */
.failed-characters-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.failed-character-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: var(--radius-md, 10px);
  gap: 12px;
}

.failed-character-item .character-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.failed-character-item .character-name {
  color: var(--primary-text, #e0e0e0);
  font-weight: 500;
  font-size: var(--font-size-small, 0.9rem);
}

.failed-character-item .character-server {
  color: var(--secondary-text, #b0b0b0);
  font-size: 0.8rem;
}

.error-info {
  flex: 1;
  min-width: 0;
}

.error-message {
  color: var(--accent-secondary, #ff6b6b);
  font-size: 0.8rem;
  word-wrap: break-word;
  line-height: 1.3;
}

/* Retry Modal Footer */
.refresh-retry-modal .modal-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 20px 24px;
  border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.1));
}

.refresh-retry-modal .btn-cancel,
.refresh-retry-modal .btn-retry {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md, 10px);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast, 0.2s ease);
  min-width: 100px;
}

.refresh-retry-modal .btn-cancel {
  background: var(--bg-secondary, rgba(255, 255, 255, 0.1));
  color: var(--primary-text, #e0e0e0);
}

.refresh-retry-modal .btn-cancel:hover {
  background: var(--bg-secondary-hover, rgba(255, 255, 255, 0.15));
}

.refresh-retry-modal .btn-retry {
  background: var(--accent-warning, #ffc107);
  color: #333;
}

.refresh-retry-modal .btn-retry:hover {
  background: var(--accent-warning-dark, #e0a800);
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .refresh-toast-container {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .refresh-toast {
    margin-bottom: 8px;
  }

  .toast-content {
    padding: 12px;
    gap: 10px;
  }

  .toast-message {
    font-size: 1.05rem !important;
    font-weight: bold !important;
  }

  .toast-actions {
    margin-top: 10px;
  }

  .toast-action-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .refresh-progress-modal .modal-content,
  .refresh-retry-modal .modal-content {
    width: 95%;
    margin: 10px;
  }

  .refresh-progress-modal .modal-header,
  .refresh-retry-modal .modal-header {
    padding: 16px 20px;
  }

  .refresh-progress-modal .modal-body,
  .refresh-retry-modal .modal-body {
    padding: 20px;
  }

  .character-progress-item,
  .failed-character-item {
    padding: 10px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .character-status {
    align-self: flex-end;
  }

  .refresh-progress-modal .modal-footer,
  .refresh-retry-modal .modal-footer {
    padding: 16px 20px;
    flex-direction: column;
  }

  .refresh-retry-modal .btn-cancel,
  .refresh-retry-modal .btn-retry {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .toast-content {
    padding: 10px;
    gap: 8px;
  }

  .toast-icon {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  .toast-message {
    font-size: 1rem !important;
    font-weight: bold !important;
  }

  .toast-technical {
    font-size: 0.7rem;
    padding: 6px;
  }

  .progress-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .character-name {
    font-size: 0.85rem;
  }

  .character-server,
  .status-text {
    font-size: 0.75rem;
  }

  .retry-message i {
    font-size: 1.5rem;
  }

  .retry-message p {
    font-size: 0.9rem;
  }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
  .refresh-toast {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
  }

  .refresh-progress-modal .modal-content,
  .refresh-retry-modal .modal-content {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .refresh-toast,
  .refresh-progress-modal .modal-content,
  .refresh-retry-modal .modal-content {
    border-width: 2px;
    border-color: currentColor;
  }

  .toast-action-btn,
  .refresh-progress-modal .btn-close,
  .refresh-retry-modal .btn-retry {
    border: 2px solid currentColor;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .refresh-toast,
  .refresh-progress-modal,
  .refresh-retry-modal {
    transition: opacity 0.2s ease;
  }

  .refresh-progress-modal .modal-content,
  .refresh-retry-modal .modal-content {
    animation: none;
  }

  .progress-fill::after {
    animation: none;
  }

  .character-progress-item.in-progress {
    animation: none;
  }

  .toast-action-btn:hover,
  .refresh-progress-modal .btn-close:hover,
  .refresh-retry-modal .btn-retry:hover {
    transform: none;
  }
}

/* Print styles */
@media print {
  .refresh-toast-container,
  .refresh-progress-modal,
  .refresh-retry-modal {
    display: none !important;
  }
}
