/* ============================================================
   ALP Premium Components — premium-components.css
   Enhanced modals, toasts, tooltips, and micro-interactions
   ============================================================ */

/* ── Premium Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: overlayFadeIn 0.3s var(--ease-out) both;
}

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

.modal-content {
  background: rgba(22, 22, 42, 0.95);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(99, 102, 241, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  animation: modalSlideIn 0.4s var(--ease-spring) both;
  position: relative;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.5), transparent);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-primary);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--color-danger);
}

.modal-body {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-primary);
}

/* ── Premium Toast Notifications ──────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 420px;
  width: 100%;
}

.toast {
  background: rgba(22, 22, 42, 0.95);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: 
    0 12px 32px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(99, 102, 241, 0.08);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  animation: toastSlideIn 0.4s var(--ease-spring) both;
  position: relative;
  overflow: hidden;
}

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

.toast.toast-exit {
  animation: toastSlideOut 0.3s var(--ease-out) both;
}

@keyframes toastSlideOut {
  to {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
  }
}

.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: currentColor;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: currentColor;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0 0 2px;
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: var(--leading-normal);
}

.toast-close {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.toast.toast-success {
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.2);
}

.toast.toast-error {
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.toast.toast-warning {
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.toast.toast-info {
  color: var(--color-info);
  border-color: rgba(59, 130, 246, 0.2);
}

/* ── Premium Tooltips ─────────────────────────────────────── */
.tooltip {
  position: absolute;
  padding: 6px 12px;
  background: rgba(22, 22, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: tooltipFadeIn 0.2s var(--ease-out) both;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tooltip::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: rgba(13, 13, 20, 0.95);
  border-right: 1px solid rgba(99, 102, 241, 0.3);
  border-bottom: 1px solid rgba(99, 102, 241, 0.3);
}

/* ── Loading Spinner (Premium) ────────────────────────────── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

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

/* ── Premium Progress Bar ─────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--cyber-green));
  border-radius: var(--radius-pill);
  transition: width var(--transition-slow) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Skeleton Loader (Premium) ────────────────────────────── */
.skeleton-box {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02) 25%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.02) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

/* ── Context Menu ─────────────────────────────────────────── */
.context-menu {
  position: fixed;
  background: rgba(22, 22, 42, 0.95);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-2) 0;
  min-width: 200px;
  box-shadow: 
    0 12px 32px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(99, 102, 241, 0.08);
  z-index: var(--z-dropdown);
  animation: contextMenuIn 0.2s var(--ease-spring) both;
}

@keyframes contextMenuIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2.5) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.context-menu-item:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
}

.context-menu-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.context-menu-divider {
  height: 1px;
  background: var(--border-primary);
  margin: var(--space-2) 0;
}

/* ── Floating Action Button ───────────────────────────────── */
.fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent-primary), var(--cyber-green));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 8px 24px rgba(99, 102, 241, 0.35),
    0 0 40px rgba(99, 102, 241, 0.15);
  cursor: pointer;
  transition: all var(--transition-base);
  z-index: var(--z-sticky);
}

.fab:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 
    0 12px 32px rgba(99, 102, 241, 0.45),
    0 0 60px rgba(99, 102, 241, 0.25);
}

.fab:active {
  transform: translateY(-2px) scale(1.02);
}

/* ── Chip Component ───────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-primary);
  transition: all var(--transition-base);
}

.chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
}

.chip-close {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-muted);
}

.chip-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-primary), transparent);
  margin: var(--space-5) 0;
}

.divider-vertical {
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent, var(--border-primary), transparent);
}

/* ── Stats Card (Premium) ─────────────────────────────────── */
.stats-card {
  background: rgba(22, 22, 42, 0.60);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-slow);
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.stats-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-4px);
  box-shadow: 
    0 16px 48px rgba(0, 0, 0, 0.35),
    0 0 60px rgba(99, 102, 241, 0.1);
}

.stats-card:hover::before {
  opacity: 1;
}
