/* ═══════════════════════════════════════════════════════════════
   Genesis Bridge — Design tokens & UI components for chat.html
   Ported from AI-Asistan-Genesis design-system.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Genesis Color Tokens ── */
:root {
  --genesis-crimson: #c41e3a;
  --genesis-crimson-light: #ff6b6b;
  --genesis-crimson-dark: #8b0000;
  --genesis-teal: #2d5f5f;
  --genesis-teal-dark: #1a4a4a;
  --genesis-gold: #d4a853;
  --genesis-success: #14b8a6;
  --genesis-warning: #f59e0b;
  --genesis-danger: #ef4444;
  --genesis-info: #3b82f6;
  --genesis-panel-bg: rgba(10, 10, 15, 0.92);
  --genesis-panel-border: rgba(255, 255, 255, 0.08);
  --genesis-glass-bg: rgba(10, 10, 15, 0.85);
  --genesis-accent-gradient: linear-gradient(135deg, #c41e3a, #8b0000);
  --genesis-glow: 0 0 20px rgba(196, 30, 58, 0.2);
}

/* ── Genesis Panel (shared base for tool browser, task panel, notifications) ── */
.genesis-panel {
  background: var(--genesis-panel-bg);
  border: 1px solid var(--genesis-panel-border);
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.genesis-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--genesis-panel-border);
}

.genesis-panel-header span,
.genesis-panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #e5e5e5;
  margin: 0;
}

.genesis-panel-header input[type='search'] {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: #e5e5e5;
  width: 180px;
  outline: none;
  transition: border-color 0.15s;
}

.genesis-panel-header input[type='search']:focus {
  border-color: var(--genesis-crimson);
}

.genesis-panel-header input[type='search']::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* ── Genesis List (shared for tool list, task list) ── */
.genesis-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.genesis-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.genesis-list-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(196, 30, 58, 0.3);
}

.genesis-list-item .item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.genesis-list-item .item-info {
  flex: 1;
  min-width: 0;
}

.genesis-list-item .item-name {
  font-size: 13px;
  font-weight: 500;
  color: #e5e5e5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.genesis-list-item .item-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Categories (horizontal pill list) ── */
.genesis-categories {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.genesis-category-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.genesis-category-pill:hover,
.genesis-category-pill.active {
  background: rgba(196, 30, 58, 0.15);
  color: var(--genesis-crimson-light);
  border-color: rgba(196, 30, 58, 0.3);
}

/* ── Task Status Badges ── */
.genesis-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.genesis-status.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.genesis-status.running {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.genesis-status.completed {
  background: rgba(20, 184, 166, 0.15);
  color: #2dd4bf;
}

.genesis-status.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Dot indicator before status text */
.genesis-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Genesis Buttons ── */
.genesis-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.genesis-btn-primary {
  background: var(--genesis-accent-gradient);
  color: #fff;
}

.genesis-btn-primary:hover {
  box-shadow: var(--genesis-glow);
  filter: brightness(1.1);
}

.genesis-btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.genesis-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e5e5;
}

.genesis-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Toast Notifications ── */
.genesis-toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
}

.genesis-toast {
  background: var(--genesis-panel-bg);
  border: 1px solid var(--genesis-panel-border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: #e5e5e5;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: genesisToastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.genesis-toast.toast-exit {
  animation: genesisToastOut 0.2s ease forwards;
}

.genesis-toast.toast-success {
  border-left: 3px solid var(--genesis-success);
}
.genesis-toast.toast-warning {
  border-left: 3px solid var(--genesis-warning);
}
.genesis-toast.toast-error {
  border-left: 3px solid var(--genesis-danger);
}
.genesis-toast.toast-info {
  border-left: 3px solid var(--genesis-info);
}

.genesis-toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

@keyframes genesisToastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes genesisToastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ── Voice Input Button ── */
.genesis-voice-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.genesis-voice-btn:hover {
  background: rgba(196, 30, 58, 0.15);
  color: var(--genesis-crimson-light);
  border-color: rgba(196, 30, 58, 0.3);
}

.genesis-voice-btn.recording {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
  animation: genesisPulse 1.5s infinite;
}

@keyframes genesisPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

/* ── Notification Badge ── */
.genesis-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--genesis-crimson);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Model Selector Enhancement ── */
.genesis-model-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.genesis-model-chip {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.genesis-model-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

.genesis-model-chip.active {
  background: rgba(196, 30, 58, 0.15);
  color: var(--genesis-crimson-light);
  border-color: rgba(196, 30, 58, 0.3);
}

/* ── Empty State ── */
.genesis-empty {
  text-align: center;
  padding: 24px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
}

.genesis-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ── Inline Form (new task) ── */
.genesis-inline-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.genesis-inline-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #e5e5e5;
  outline: none;
}

.genesis-inline-form input:focus {
  border-color: var(--genesis-crimson);
}

.genesis-inline-form input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* ── Loading Skeleton ── */
.genesis-skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: genesisShimmer 1.5s infinite;
  border-radius: 6px;
}

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

/* ── Responsive ── */
@media (max-width: 768px) {
  .genesis-panel {
    margin: 4px 0;
    padding: 12px;
  }

  .genesis-panel-header input[type='search'] {
    width: 140px;
  }

  .genesis-toast-container {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}
