/**
 * Fallback UI Styles for CECCM Application
 * 
 * Styles for degraded mode notices, feature unavailable messages,
 * and content placeholders.
 */

/* ==========================================================================
   Degraded Mode Notice
   ========================================================================== */

.degraded-mode-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
  background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
  border: 1px solid #ffc107;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.15);
}

.degraded-mode-notice .notice-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: #ffc107;
  border-radius: 50%;
  color: #856404;
}

.degraded-mode-notice .notice-content {
  flex: 1;
}

.degraded-mode-notice .notice-content h4 {
  margin: 0 0 var(--space-1) 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: #856404;
}

.degraded-mode-notice .notice-content p {
  margin: 0;
  font-size: var(--text-sm);
  color: #856404;
}

.degraded-mode-notice .notice-content .notice-details {
  margin-top: var(--space-1);
  font-size: 0.8125rem;
  opacity: 0.8;
}

.degraded-mode-notice .notice-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.degraded-mode-notice .btn-outline {
  padding: 0.375rem var(--space-3);
  font-size: 0.8125rem;
  color: #856404;
  border-color: #856404;
  background: transparent;
}

.degraded-mode-notice .btn-outline:hover {
  background: #856404;
  color: #fff;
}

/* ==========================================================================
   Feature Unavailable Message
   ========================================================================== */

.feature-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  border-radius: var(--radius-lg);
  min-height: 200px;
}

.feature-unavailable-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: var(--space-4);
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
  border-radius: 50%;
  color: #fff;
  font-size: var(--text-xl);
}

.feature-unavailable h3 {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-xl);
  font-weight: 600;
  color: #343a40;
}

.feature-unavailable p {
  margin: 0 0 var(--space-6) 0;
  font-size: 0.9375rem;
  color: #6c757d;
  max-width: 400px;
}

.feature-unavailable-actions {
  display: flex;
  gap: var(--space-3);
}

/* ==========================================================================
   Content Placeholder
   ========================================================================== */

.content-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  background: #fff;
  border: 2px dashed #dee2e6;
  border-radius: var(--radius-lg);
  min-height: 250px;
}

.content-placeholder .placeholder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: var(--space-4);
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  border-radius: 50%;
  color: #6c757d;
  font-size: var(--text-xl);
}

.content-placeholder h3 {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-lg);
  font-weight: 600;
  color: #495057;
}

.content-placeholder p {
  margin: 0 0 var(--space-6) 0;
  font-size: var(--text-sm);
  color: #6c757d;
  max-width: 350px;
}

.content-placeholder .placeholder-actions {
  display: flex;
  gap: var(--space-3);
}

/* ==========================================================================
   Network Error Retry
   ========================================================================== */

.network-error-retry {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: var(--z-modal);
  animation: slideUp var(--transition-base) ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.network-error-retry .network-error-message {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: #dc3545;
}

.network-error-retry .network-error-message i {
  font-size: var(--text-xl);
}

.network-error-retry .network-error-message p {
  margin: 0;
  font-size: var(--text-sm);
  color: #495057;
}

.network-error-retry .network-error-actions {
  display: flex;
  gap: var(--space-2);
}

/* ==========================================================================
   Error Boundary
   ========================================================================== */

.error-boundary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem var(--space-8);
  text-align: center;
  background: #fff;
  border: 1px solid #f5c6cb;
  border-radius: var(--radius-lg);
  margin: var(--space-4) 0;
}

.error-boundary-fade-in {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.error-boundary-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  font-size: var(--text-xl);
}

.error-boundary-icon.error {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #721c24;
}

.error-boundary-icon.warning {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
  color: #856404;
}

.error-boundary-icon.info {
  background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
  color: #0c5460;
}

.error-boundary-title {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-xl);
  font-weight: 600;
  color: #343a40;
}

.error-boundary-message {
  margin: 0 0 var(--space-6) 0;
  font-size: 0.9375rem;
  color: #6c757d;
  max-width: 400px;
}

.error-boundary-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: center;
}

.error-boundary .error-details {
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  text-align: left;
  width: 100%;
  max-width: 500px;
}

.error-boundary .error-details summary {
  cursor: pointer;
  font-weight: 500;
  color: #495057;
}

.error-boundary .error-details p {
  margin: var(--space-2) 0 0 0;
  font-size: 0.8125rem;
  color: #6c757d;
  font-family: monospace;
}

/* ==========================================================================
   Database Error Container
   ========================================================================== */

.database-error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  min-height: 300px;
}

.database-error-container .error-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  margin-bottom: var(--space-6);
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  border-radius: 50%;
  color: #721c24;
  font-size: var(--text-2xl);
}

.database-error-container h2 {
  margin: 0 0 var(--space-3) 0;
  font-size: var(--text-2xl);
  font-weight: 600;
  color: #343a40;
}

.database-error-container p {
  margin: 0 0 var(--space-8) 0;
  font-size: var(--text-base);
  color: #6c757d;
  max-width: 450px;
}

.database-error-container .error-actions {
  display: flex;
  gap: var(--space-4);
}

.database-error-container .error-details {
  margin-top: var(--space-8);
  padding: var(--space-4) var(--space-6);
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  text-align: left;
}

.database-error-container .error-details p {
  margin: var(--space-1) 0;
  font-size: 0.8125rem;
  color: #6c757d;
}

/* ==========================================================================
   Admin Notice
   ========================================================================== */

.admin-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
  border-radius: var(--radius-sm);
  border-left: 4px solid;
}

.admin-notice-error {
  background: #f8d7da;
  border-color: #dc3545;
}

.admin-notice-error .notice-icon {
  color: #dc3545;
}

.admin-notice-warning {
  background: #fff3cd;
  border-color: #ffc107;
}

.admin-notice-warning .notice-icon {
  color: #856404;
}

.admin-notice-info {
  background: #d1ecf1;
  border-color: #17a2b8;
}

.admin-notice-info .notice-icon {
  color: #0c5460;
}

.admin-notice .notice-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
}

.admin-notice .notice-content h4 {
  margin: 0 0 var(--space-1) 0;
  font-size: var(--text-base);
  font-weight: 600;
}

.admin-notice .notice-content p {
  margin: 0;
  font-size: var(--text-sm);
}

.admin-notice-error .notice-content {
  color: #721c24;
}

.admin-notice-warning .notice-content {
  color: #856404;
}

.admin-notice-info .notice-content {
  color: #0c5460;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: var(--z-popover);
  animation: slideInRight var(--transition-base) ease-out;
  max-width: 400px;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-error {
  border-left: 4px solid #dc3545;
}

.toast-success {
  border-left: 4px solid #28a745;
}

.toast-warning {
  border-left: 4px solid #ffc107;
}

.toast-info {
  border-left: 4px solid #17a2b8;
}

.toast .toast-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
}

.toast-error .toast-icon {
  color: #dc3545;
}

.toast-success .toast-icon {
  color: #28a745;
}

.toast-warning .toast-icon {
  color: #856404;
}

.toast-info .toast-icon {
  color: #0c5460;
}

.toast .toast-message {
  flex: 1;
}

.toast .toast-title {
  margin: 0 0 0.125rem 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: #343a40;
}

.toast .toast-text {
  margin: 0;
  font-size: 0.8125rem;
  color: #6c757d;
}

.toast .toast-close {
  flex-shrink: 0;
  padding: var(--space-1);
  background: transparent;
  border: none;
  color: #6c757d;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.toast .toast-close:hover {
  color: #343a40;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
  .degraded-mode-notice {
    flex-direction: column;
    text-align: center;
  }

  .degraded-mode-notice .notice-actions {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }

  .network-error-retry {
    flex-direction: column;
    width: calc(100% - 2rem);
    left: 1rem;
    transform: none;
  }

  .network-error-retry .network-error-actions {
    width: 100%;
  }

  .network-error-retry .network-error-actions .btn {
    flex: 1;
  }

  .error-boundary-actions {
    flex-direction: column;
    width: 100%;
  }

  .error-boundary-actions .btn {
    width: 100%;
  }

  .feature-unavailable-actions,
  .content-placeholder .placeholder-actions {
    flex-direction: column;
    width: 100%;
  }

  .feature-unavailable-actions .btn,
  .content-placeholder .placeholder-actions .btn {
    width: 100%;
  }

  .database-error-container .error-actions {
    flex-direction: column;
    width: 100%;
  }

  .database-error-container .error-actions .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Admin Status Widget
   ========================================================================== */

.admin-status-widget {
  padding: var(--space-3) var(--space-4);
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-sm);
  margin-top: var(--space-4);
}

.admin-status-widget .status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.admin-status-widget .status-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.status-dot.status-connected {
  background: #28a745;
  box-shadow: 0 0 0 0.1875rem rgba(40, 167, 69, 0.2);
}

.status-dot.status-disconnected {
  background: #dc3545;
  box-shadow: 0 0 0 0.1875rem rgba(220, 53, 69, 0.2);
}

.status-dot.status-error {
  background: #ffc107;
  box-shadow: 0 0 0 0.1875rem rgba(255, 193, 7, 0.2);
}

.status-dot.status-unknown {
  background: #6c757d;
  box-shadow: 0 0 0 0.1875rem rgba(108, 117, 125, 0.2);
}

.admin-status-widget .status-text {
  font-size: 0.8125rem;
  color: #495057;
}

/* Notice Timestamp */
.notice-timestamp {
  font-size: var(--text-xs);
  opacity: 0.7;
  margin-top: var(--space-1);
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  .feature-unavailable {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: #4a5568;
  }

  .feature-unavailable h3 {
    color: #f7fafc;
  }

  .feature-unavailable p {
    color: #a0aec0;
  }

  .content-placeholder {
    background: #1a202c;
    border-color: #4a5568;
  }

  .content-placeholder h3 {
    color: #f7fafc;
  }

  .content-placeholder p {
    color: #a0aec0;
  }

  .error-boundary {
    background: #1a202c;
    border-color: #4a5568;
  }

  .error-boundary-title {
    color: #f7fafc;
  }

  .error-boundary-message {
    color: #a0aec0;
  }

  .error-boundary .error-details {
    background: #2d3748;
  }

  .error-boundary .error-details summary {
    color: #e2e8f0;
  }

  .database-error-container h2 {
    color: #f7fafc;
  }

  .database-error-container p {
    color: #a0aec0;
  }

  .database-error-container .error-details {
    background: #2d3748;
  }

  .toast {
    background: #2d3748;
  }

  .toast .toast-title {
    color: #f7fafc;
  }

  .toast .toast-text {
    color: #a0aec0;
  }
}
