/**
 * @file
 * Styles for Fast News Server-Sent Events functionality.
 */

/* Main SSE container */
.fast-news-sse-container {
  position: relative;
  min-height: 200px;
}

/* Connection status indicator */
.fast-news-connection-status {
  position: absolute;
  top: -30px;
  right: 0;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  z-index: 10;
  transition: all 0.3s ease;
}

.fast-news-connection-status.connected {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.fast-news-connection-status.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  animation: pulse-error 2s infinite;
}

.fast-news-connection-status.failed {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

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

/* New item animation */
.fast-news-new-item {
  position: relative;
  overflow: hidden;
}

.fast-news-new-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(189, 158, 115, 0.15),
    transparent
  );
  animation: shimmer 2s ease-in-out;
  z-index: 1;
}

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


.fast-news-new-item {
  border-left: 3px solid #bd9e73;
  background-color: rgba(189, 158, 115, 0.1);
  transition: all 0.3s ease;
}

.fast-news-new-item:hover {
  background-color: #bd9e73;
}

/* Notification popup */
.fast-news-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 350px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  display: none;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.fast-news-notification-content {
  font-size: 14px;
  line-height: 1.4;
  color: #333;
}

.fast-news-notification-content strong {
  color: #007bff;
}

/* Loading state */
.fast-news-sse-container.loading {
  opacity: 0.7;
  pointer-events: none;
}

.fast-news-sse-container.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
  .fast-news-notification {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .fast-news-connection-status {
    position: relative;
    top: 0;
    right: auto;
    margin-bottom: 10px;
    display: inline-block;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .fast-news-notification {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }
  
  .fast-news-notification-content {
    color: #e2e8f0;
  }
  
  .fast-news-new-item {
    background-color: rgba(189, 158, 115, 0.1);
    border-left-color: #bd9e73;
  }
  
  .fast-news-new-item:hover {
    background-color: #bd9e73;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .fast-news-connection-status.connected {
    background-color: #000;
    color: #fff;
    border-color: #000;
  }
  
  .fast-news-connection-status.error,
  .fast-news-connection-status.failed {
    background-color: #ff0000;
    color: #fff;
    border-color: #ff0000;
  }
  
  .fast-news-new-item {
    border-left-width: 5px;
    background-color: rgba(0, 0, 0, 0.1);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .fast-news-connection-status,
  .fast-news-new-item,
  .fast-news-notification {
    animation: none;
    transition: none;
  }
  
  .fast-news-new-item::before {
    display: none;
  }
}

/* Focus states for accessibility */
.fast-news-sse-container:focus-within {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .fast-news-connection-status,
  .fast-news-notification {
    display: none !important;
  }
  
  .fast-news-new-item {
    border-left: none;
    background: none;
  }
}
