/* Hooki Dashboard — Design System Tokens & Utilities */

:root {
  /* Brand Coral */
  --coral-50: #FFF5F2;
  --coral-100: #FFE8E0;
  --coral-200: #FFD0BF;
  --coral-300: #FFB199;
  --coral-400: #FF8C66;
  --coral-500: #F25C2A;
  --coral-600: #D94A1A;
  --coral-700: #B33A14;
  --coral-800: #8C2E10;
  --coral-900: #66210B;

  /* Neutrals (warm) */
  --gray-50: #FAFAF9;
  --gray-100: #F5F5F4;
  --gray-200: #E7E5E4;
  --gray-300: #D6D3D1;
  --gray-400: #A8A29E;
  --gray-500: #78716C;
  --gray-600: #57534E;
  --gray-700: #44403C;
  --gray-800: #292524;
  --gray-900: #1C1917;

  /* Semantic */
  --green: #22A06B;
  --red: #DE350B;
  --amber: #E97F0F;
  --blue: #1D7AFC;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

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

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

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

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

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

.animate-fade-in {
  animation: fadeIn 200ms ease-out both;
}

.animate-modal-in {
  animation: modalIn 200ms ease-out both;
}

.animate-slide-in-right {
  animation: slideInRight 200ms ease-out both;
}

.animate-slide-out-right {
  animation: slideOutRight 150ms ease-in both;
}

.animate-shake {
  animation: shake 150ms ease-in-out;
}

.animate-spin {
  animation: spin 600ms linear infinite;
}

/* Stagger fade-in for table rows */
.stagger-item {
  animation: fadeIn 200ms ease-out both;
}
.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 50ms; }
.stagger-item:nth-child(3) { animation-delay: 100ms; }
.stagger-item:nth-child(4) { animation-delay: 150ms; }
.stagger-item:nth-child(5) { animation-delay: 200ms; }
.stagger-item:nth-child(6) { animation-delay: 250ms; }
.stagger-item:nth-child(7) { animation-delay: 300ms; }
.stagger-item:nth-child(8) { animation-delay: 350ms; }
.stagger-item:nth-child(9) { animation-delay: 400ms; }
.stagger-item:nth-child(10) { animation-delay: 450ms; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Sidebar */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  transition: all 150ms ease;
  text-decoration: none;
  position: relative;
}

.sidebar-link:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}

.sidebar-link.active {
  background: var(--coral-50);
  color: var(--coral-600);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--coral-500);
  border-radius: 0 2px 2px 0;
}

/* Table styles */
.table-header {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-row {
  border-bottom: 0.5px solid var(--gray-200);
  transition: background 150ms ease;
}

.table-row:hover {
  background: var(--gray-50);
}

/* Badge styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-critical { background: #FEE2E2; color: var(--red); }
.badge-normal { background: #E0F2FE; color: var(--blue); }
.badge-low { background: var(--gray-100); color: var(--gray-500); }
.badge-active { background: #DCFCE7; color: var(--green); }
.badge-inactive { background: var(--gray-100); color: var(--gray-400); }
.badge-public { background: #DCFCE7; color: var(--green); }
.badge-private { background: var(--gray-100); color: var(--gray-500); }
.badge-owner { background: var(--coral-50); color: var(--coral-600); }
.badge-subscriber { background: var(--gray-100); color: var(--gray-600); }

/* Toast */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: white;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 420px;
  border-left: 3px solid var(--gray-300);
}

.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-warning { border-left-color: var(--amber); }

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 150ms ease-out;
}

.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 200ms ease-out;
}

/* Channel card avatar */
.channel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

/* Button spinner */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* HTMX loading indicator */
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}
