/**
 * Content Portfolio Network & Loading Styles
 * Styles for network messages, loading states, and offline scenarios
 */

/* Network Messages */
.network-message {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  max-width: 500px;
  width: 90%;
  background: rgba(20, 20, 22, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transition: top 0.3s ease;
}

.network-message.show {
  top: 20px;
}

.network-message-content {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
}

.network-message i {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.message-text {
  flex: 1;
}

.message-text strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: #ffffff;
}

.message-text p {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}

.btn-dismiss-message {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 5px;
  font-size: 1.2rem;
  transition: color 0.3s ease;
  flex-shrink: 0;
}

.btn-dismiss-message:hover {
  color: #ffffff;
}

/* Offline Message */
.offline-message {
  border: 2px solid rgba(220, 53, 69, 0.5);
}

.offline-message i {
  color: #FF8C42;
}

/* Slow Connection Warning */
.slow-connection-warning {
  border: 2px solid rgba(255, 193, 7, 0.5);
}

.slow-connection-warning i {
  color: #D4AF37;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 20, 22, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: inherit;
  animation: fadeIn 0.3s ease;
}

.loading-overlay.fade-out {
  animation: fadeOut 0.3s ease;
}

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

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

.loading-spinner {
  text-align: center;
  color: #ffffff;
}

.spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 15px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-message {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

/* Content Loading State */
.content-loading {
  pointer-events: none;
  user-select: none;
}

/* Network Error Message */
.network-error-message {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 30px;
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
  border: 2px dashed rgba(220, 53, 69, 0.4);
  border-radius: 10px;
  margin: 20px 0;
}

.error-icon {
  flex-shrink: 0;
}

.error-icon i {
  font-size: 2.5rem;
  color: #dc3545;
}

.error-content {
  flex: 1;
}

.error-content h4 {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffffff;
}

.error-content p {
  margin: 0 0 15px 0;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

.btn-retry-load {
  padding: 10px 20px;
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-retry-load:hover {
  background: linear-gradient(135deg, #c82333, #bd2130);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.btn-retry-load:active {
  transform: translateY(0);
}

/* Offline Placeholder */
.offline-placeholder {
  width: 100%;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(44, 44, 44, 0.2), rgba(26, 26, 26, 0.4));
  border: 2px dashed rgba(128, 128, 128, 0.4);
  border-radius: 15px;
  padding: 60px 40px;
}

.offline-content {
  text-align: center;
  max-width: 400px;
}

.offline-content i {
  font-size: 4rem;
  color: rgba(128, 128, 128, 0.6);
  margin-bottom: 20px;
  display: block;
}

.offline-content h4 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: #ffffff;
}

.offline-content p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 25px 0;
  line-height: 1.6;
}

.btn-check-connection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #808080, #666666);
  color: #ffffff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-check-connection:hover {
  background: linear-gradient(135deg, #666666, #555555);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(128, 128, 128, 0.4);
}

.btn-check-connection:active {
  transform: translateY(0);
}

/* Skeleton Loading */
.skeleton-loader {
  background: linear-gradient(
    90deg,
    rgba(128, 128, 128, 0.1) 0%,
    rgba(128, 128, 128, 0.2) 50%,
    rgba(128, 128, 128, 0.1) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text:last-child {
  width: 80%;
}

.skeleton-image {
  width: 100%;
  height: 200px;
}

.skeleton-card {
  padding: 20px;
  border-radius: 10px;
}

/* Timeout Message */
.timeout-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.05));
  border: 2px dashed rgba(255, 193, 7, 0.4);
  border-radius: 10px;
  margin: 20px 0;
}

.timeout-message i {
  font-size: 3rem;
  color: #FF8C42;
  margin-bottom: 15px;
}

.timeout-message h4 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: #ffffff;
}

.timeout-message p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 20px 0;
  line-height: 1.6;
}

/* Progress Bar */
.loading-progress {
  width: 100%;
  height: 4px;
  background: rgba(128, 128, 128, 0.2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 15px;
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #D4AF37, #FF8C42);
  border-radius: 2px;
  transition: width 0.3s ease;
  animation: progress-shimmer 2s ease-in-out infinite;
}

@keyframes progress-shimmer {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Responsive Styles */
@media (max-width: 768px) {
  .network-message {
    max-width: 95%;
  }

  .network-message-content {
    padding: 12px 15px;
    gap: 12px;
  }

  .network-message i {
    font-size: 1.3rem;
  }

  .message-text strong {
    font-size: 0.95rem;
  }

  .message-text p {
    font-size: 0.85rem;
  }

  .offline-placeholder {
    min-height: 300px;
    padding: 40px 20px;
  }

  .offline-content i {
    font-size: 3rem;
  }

  .offline-content h4 {
    font-size: 1.3rem;
  }

  .network-error-message {
    flex-direction: column;
    gap: 15px;
    padding: 20px;
  }

  .error-icon i {
    font-size: 2rem;
  }

  .spinner {
    width: 40px;
    height: 40px;
  }

  .loading-message {
    font-size: 0.9rem;
  }
}

/* Accessibility */
.network-message,
.loading-overlay,
.offline-placeholder,
.network-error-message {
  outline: none;
}

.btn-dismiss-message:focus-visible,
.btn-retry-load:focus-visible,
.btn-check-connection:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .spinner,
  .skeleton-loader,
  .loading-progress-bar {
    animation: none;
  }

  .network-message {
    transition: none;
  }
}

/* Print Styles */
@media print {
  .network-message,
  .loading-overlay,
  .offline-placeholder,
  .network-error-message,
  .skeleton-loader {
    display: none;
  }
}
