/* ── ORKIX Brand Design System — Conversation Intelligence Platform ── */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* ORKIX Color Psychology: Trust (Blue) + Innovation (Violet) + Precision (White) */
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;

  --border-subtle: #e2e8f0;
  --border-active: #c7d2fe;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* ORKIX Accent: Electric Blue-Violet (trust + innovation) */
  --accent-primary: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4338ca 0%, #0891b2 100%);
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  --font-main: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-glass: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(79, 70, 229, 0.06);
  --glow-accent: 0 0 20px rgba(79, 70, 229, 0.25), 0 0 40px rgba(6, 182, 212, 0.1);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s ease;
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Layout Grid */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  width: 100vw;
}

/* Sidebar Styling */
.app-sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  z-index: 10;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 20px 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: var(--accent-gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-accent);
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 10px 6px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-link:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.nav-link.active {
  background: #ede9fe;
  color: #4f46e5;
  border: 1px solid #c4b5fd;
  font-weight: 700;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* Main Content Area */
.app-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-app);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}

.content-body {
  padding: 32px;
  flex: 1;
}

/* Cards & Containers */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass);
  padding: 24px;
  transition: var(--transition);
}

.glass-card:hover {
  border-color: #cbd5e1;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-pill.online {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-pill.human {
  background: #ede9fe;
  color: #4f46e5;
  border: 1px solid #c4b5fd;
}

.status-pill.warning {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--glow-accent);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Form Fields */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-group input, .input-group select, .input-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
}

.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* ── Toast Notifications System ── */
.orkai-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 400px;
  width: calc(100vw - 48px);
}

.orkai-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  line-height: 1.4;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.orkai-toast.toast-hiding {
  animation: toastOut 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.orkai-toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.orkai-toast-content {
  flex: 1;
}

.orkai-toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
}

.orkai-toast-close:hover {
  color: var(--text-primary);
}

.orkai-toast--success {
  border-left: 4px solid var(--accent-success);
}
.orkai-toast--success .orkai-toast-icon {
  color: var(--accent-success);
}

.orkai-toast--danger {
  border-left: 4px solid var(--accent-danger);
}
.orkai-toast--danger .orkai-toast-icon {
  color: var(--accent-danger);
}

.orkai-toast--warning {
  border-left: 4px solid var(--accent-warning);
}
.orkai-toast--warning .orkai-toast-icon {
  color: var(--accent-warning);
}

.orkai-toast--info {
  border-left: 4px solid var(--accent-primary);
}
.orkai-toast--info .orkai-toast-icon {
  color: var(--accent-primary);
}

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

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

/* ── Inline Alert Banners ── */
.orkai-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.orkai-alert--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.orkai-alert--success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.orkai-alert--warning {
  background: #fffbe6;
  border-color: #ffe58f;
  color: #d46b08;
}

.orkai-alert--danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* ── Reusable Modal Overlays & Cards ── */
.orkai-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
}

.orkai-modal-overlay.active,
.orkai-modal-overlay[style*="display: flex"],
.orkai-modal-overlay[style*="display:flex"] {
  opacity: 1;
  visibility: visible;
}

.orkai-modal-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.orkai-modal-overlay.active .orkai-modal-card,
.orkai-modal-overlay[style*="display: flex"] .orkai-modal-card,
.orkai-modal-overlay[style*="display:flex"] .orkai-modal-card {
  transform: translateY(0) scale(1);
}

.orkai-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.orkai-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.orkai-modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.orkai-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Standardized Linkage & Live Inspector Modal Cards ── */
.orkai-modal-card--standard-linkage {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05));
  width: min(880px, 94vw);
  height: min(720px, 88vh);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.orkai-modal-header--fixed {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: #ffffff;
  flex-shrink: 0;
}

.orkai-modal-body--scrollable {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
  box-sizing: border-box;
}

.orkai-modal-footer--fixed {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

/* ── Badges & Empty States ── */
.orkai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.orkai-badge--online { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.orkai-badge--human { background: #ede9fe; color: #4f46e5; border: 1px solid #c4b5fd; }
.orkai-badge--warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.orkai-badge--danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.orkai-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.orkai-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.8;
}
.orkai-empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.orkai-empty-desc {
  font-size: 0.88rem;
  max-width: 360px;
  margin-bottom: 16px;
}

/* ── Custom Scrollbar Styles for Chat Stream & Contact Lists ── */
#customer-chat-stream,
#real-customer-chats-list,
.chat-history {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

#customer-chat-stream::-webkit-scrollbar,
#real-customer-chats-list::-webkit-scrollbar,
.chat-history::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#customer-chat-stream::-webkit-scrollbar-track,
#real-customer-chats-list::-webkit-scrollbar-track,
.chat-history::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

#customer-chat-stream::-webkit-scrollbar-thumb,
#real-customer-chats-list::-webkit-scrollbar-thumb,
.chat-history::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
  transition: background 0.2s ease;
}

#customer-chat-stream::-webkit-scrollbar-thumb:hover,
#real-customer-chats-list::-webkit-scrollbar-thumb:hover,
.chat-history::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ── Tooltip Component (Design System) ── */
.orkai-tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.orkai-tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  transition: all 0.2s ease;
}

.orkai-tooltip-wrapper:hover .orkai-tooltip-icon,
.orkai-tooltip-icon:hover {
  background: #6366f1;
  color: #ffffff;
}

.orkai-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1050;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.orkai-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.92) transparent transparent transparent;
}

.orkai-tooltip-wrapper:hover .orkai-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Tooltip position variants */
.orkai-tooltip-wrapper.position-right .orkai-tooltip {
  bottom: auto;
  top: 50%;
  left: calc(100% + 6px);
  transform: translateY(-50%) translateX(-4px);
}
.orkai-tooltip-wrapper.position-right .orkai-tooltip::after {
  top: 50%;
  left: auto;
  right: 100%;
  transform: translateY(-50%);
  border-color: transparent rgba(15, 23, 42, 0.92) transparent transparent;
}
.orkai-tooltip-wrapper.position-right:hover .orkai-tooltip {
  transform: translateY(-50%) translateX(0);
}

