/**
 * Toast Notifications & HTMX Loading States
 * Part of shared domain styling
 */

/* ============================================================================
   TOAST NOTIFICATION CONTAINER
   ============================================================================ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  pointer-events: none;
}

@media (max-width: 576px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* ============================================================================
   TOAST NOTIFICATION STYLES
   ============================================================================ */

.toast-notification {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: var(--md-surface);
  border-left: 4px solid;
  pointer-events: auto;
  min-width: 300px;
  animation: slideIn 0.3s ease-out;
}

@media (max-width: 576px) {
  .toast-notification {
    min-width: auto;
  }
}

.toast-notification i.fas {
  font-size: 20px;
  flex-shrink: 0;
}

.toast-message {
  flex-grow: 1;
  font-size: 14px;
  line-height: 1.4;
  color: #333;
}

.toast-close {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #999;
  font-size: 16px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  color: #333;
}

/* Toast type variants */
.toast-success {
  border-left-color: #28a745;
}

.toast-success i.fas {
  color: #28a745;
}

.toast-error {
  border-left-color: #dc3545;
}

.toast-error i.fas {
  color: #dc3545;
}

.toast-warning {
  border-left-color: #ffc107;
}

.toast-warning i.fas {
  color: #ffc107;
}

.toast-info {
  border-left-color: #17a2b8;
}

.toast-info i.fas {
  color: #17a2b8;
}

/* Dark mode support */
[data-theme="dark"] .toast-notification {
  background: #2c2c2c;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toast-message {
  color: #e0e0e0;
}

[data-theme="dark"] .toast-close {
  color: #999;
}

[data-theme="dark"] .toast-close:hover {
  color: #e0e0e0;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

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

.animate-slide-in {
  animation: slideIn 0.3s ease-out;
}

.animate-slide-out {
  animation: slideOut 0.3s ease-in;
}

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

/* ============================================================================
   HTMX LOADING STATES
   ============================================================================ */

.htmx-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.htmx-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid rgba(0, 123, 255, 0.3);
  border-top-color: #007bff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 1;
}

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

/* HTMX indicator (manual placement) */
.htmx-indicator {
  display: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.htmx-indicator.htmx-request {
  display: inline-block;
  opacity: 1;
}

/* Spinner variants */
.htmx-indicator .spinner-border {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.htmx-indicator.spinner-lg .spinner-border {
  width: 2rem;
  height: 2rem;
  border-width: 3px;
}

/* ============================================================================
   SKELETON LOADERS (for optimistic UI)
   ============================================================================ */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

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

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #2c2c2c 25%, #3a3a3a 50%, #2c2c2c 75%);
  background-size: 200% 100%;
}

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

.skeleton-heading {
  height: 2em;
  margin-bottom: 1em;
}

.skeleton-card {
  height: 300px;
  width: 100%;
}
