/* Character Cache Status Styles - Task 7 Implementation */

/* Cache status container */
.character-cache-status {
  position: relative;
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  transition: all 0.3s ease;
  display: none; /* Hidden by default, shown only when there's content */
}

/* Cache status info section */
.cache-status-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: opacity 0.3s ease;
}

/* Last updated time display */
.last-updated-time {
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;
}

.last-updated-time i {
  font-size: 0.65rem;
  opacity: 0.8;
}

.update-time-text {
  font-weight: 500;
}

/* Cache status badge for stale data */
.cache-status-badge {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  background: linear-gradient(135deg, #eab308, #ca8a04);
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 4px rgba(234, 179, 8, 0.3);
  animation: pulse-warning 2s infinite;
}

.cache-status-badge.stale-data {
  display: flex;
}

.badge-text {
  white-space: nowrap;
}

/* Refresh loading indicator */
.refresh-loading-indicator {
  display: none !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 8px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 6px;
  color: white;
  font-size: 0.7rem;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.refresh-loading-indicator.show {
  display: flex !important;
}

.refresh-loading-indicator i {
  font-size: 0.75rem;
}

.loading-text {
  white-space: nowrap;
}

/* Character card states */
.character-card.refreshing {
  position: relative;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  border-color: rgba(79, 70, 229, 0.5);
}

.character-card.refreshing::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #4f46e5, #7c3aed, #4f46e5);
  border-radius: inherit;
  z-index: -1;
  animation: refresh-border 2s linear infinite;
}

.character-card.recently-updated {
  animation: update-success 2s ease-out;
}

.character-card.update-failed {
  animation: update-error 1s ease-out;
}

/* Update success indicator */
.update-success-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 6px;
  color: white;
  font-size: 0.7rem;
  font-weight: 500;
  margin-top: 4px;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
  animation: slide-in-success 0.5s ease-out;
}

.update-success-indicator i {
  font-size: 0.75rem;
}

/* Update error indicator */
.update-error-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 6px;
  color: white;
  font-size: 0.7rem;
  font-weight: 500;
  margin-top: 4px;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
  animation: slide-in-error 0.5s ease-out;
}

.update-error-indicator i {
  font-size: 0.75rem;
}

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

@keyframes refresh-border {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@keyframes update-success {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
}

@keyframes update-error {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes slide-in-success {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slide-in-error {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .character-cache-status {
    padding: 4px 6px;
    font-size: 0.7rem;
  }

  .last-updated-time {
    font-size: 0.65rem;
  }

  .cache-status-badge {
    font-size: 0.6rem;
    padding: 1px 4px;
  }

  .refresh-loading-indicator {
    font-size: 0.65rem;
    padding: 3px 6px;
  }

  .update-success-indicator,
  .update-error-indicator {
    font-size: 0.65rem;
    padding: 3px 6px;
  }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
  .character-cache-status {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
  }

  .last-updated-time {
    color: rgba(255, 255, 255, 0.8);
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .character-cache-status {
    border-width: 2px;
    border-color: currentColor;
  }

  .cache-status-badge {
    border: 2px solid white;
  }

  .refresh-loading-indicator {
    border: 2px solid white;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .character-cache-status,
  .cache-status-info,
  .character-card.refreshing {
    transition: none;
  }

  .cache-status-badge,
  .refresh-loading-indicator i,
  .character-card.refreshing::before {
    animation: none;
  }

  .character-card.recently-updated,
  .character-card.update-failed,
  .update-success-indicator,
  .update-error-indicator {
    animation: none;
  }
}

/* Focus styles for accessibility */
.character-card:focus-within .character-cache-status {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* Task 13: Cooldown status display styles */
.cooldown-status-display {
  display: none; /* Hidden by default */
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 8px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(99, 102, 241, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.7rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.cooldown-status-display i {
  font-size: 0.7rem;
  color: rgba(139, 92, 246, 0.9);
  animation: hourglass-rotate 2s ease-in-out infinite;
}

.cooldown-time-text {
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* Hourglass rotation animation */
@keyframes hourglass-rotate {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(180deg);
  }
}

/* Hover effect for cooldown display */
.cooldown-status-display:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(99, 102, 241, 0.25));
  border-color: rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.2);
}

/* Responsive adjustments for cooldown display */
@media (max-width: 768px) {
  .cooldown-status-display {
    font-size: 0.65rem;
    padding: 3px 6px;
    gap: 4px;
  }

  .cooldown-status-display i {
    font-size: 0.65rem;
  }
}

/* Dark theme adjustments for cooldown display */
@media (prefers-color-scheme: dark) {
  .cooldown-status-display {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(99, 102, 241, 0.2));
    border-color: rgba(139, 92, 246, 0.4);
    color: rgba(255, 255, 255, 0.9);
  }

  .cooldown-status-display:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(99, 102, 241, 0.3));
    border-color: rgba(139, 92, 246, 0.6);
  }
}

/* High contrast mode for cooldown display */
@media (prefers-contrast: high) {
  .cooldown-status-display {
    border-width: 2px;
    border-color: currentColor;
    background: transparent;
  }
}

/* Reduced motion preferences for cooldown display */
@media (prefers-reduced-motion: reduce) {
  .cooldown-status-display {
    transition: none;
  }

  .cooldown-status-display i {
    animation: none;
  }

  .cooldown-status-display:hover {
    transform: none;
  }
}

/* Print styles */
@media print {
  .character-cache-status {
    background: transparent;
    border: 1px solid #000;
  }

  .cache-status-badge,
  .refresh-loading-indicator,
  .update-success-indicator,
  .update-error-indicator {
    background: transparent;
    color: #000;
    border: 1px solid #000;
  }

  .cooldown-status-display {
    background: transparent;
    border: 1px solid #000;
    color: #000;
  }

  .cooldown-status-display i {
    animation: none;
  }
}
