/* ==========================================================================
   Outbound Caller App — Glassmorphism SaaS Styles
   ========================================================================== */

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --navy: #0f172a;
  --navy-light: #1e293b;
  --navy-lighter: #334155;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-bg-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.35);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.12);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 10px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.7); }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #dbeafe 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}
.glass-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}
.glass-dark {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(148, 163, 184, 0.15);
  color: #e2e8f0;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
}
.glass-input {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.glass-input:focus {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
  outline: none;
}

/* ---------- Navbar & Sidebar ---------- */
.app-sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.1);
}
.nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  color: #cbd5e1;
  transition: var(--transition);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.nav-link:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #ffffff;
  transform: translateX(3px);
}
.nav-link.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.12));
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3);
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}
.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.btn-success:hover { transform: translateY(-1px); }
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { transform: translateY(-1px); }
.btn-outline {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(148, 163, 184, 0.3);
  color: #334155;
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-ghost {
  background: transparent;
  color: #475569;
}
.btn-ghost:hover { background: rgba(148, 163, 184, 0.15); }

/* ---------- Badges & Tags ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-blue   { background: rgba(59,130,246,.15); color: #1d4ed8; }
.badge-green  { background: rgba(16,185,129,.15); color: #047857; }
.badge-amber  { background: rgba(245,158,11,.15); color: #b45309; }
.badge-red    { background: rgba(239,68,68,.15); color: #b91c1c; }
.badge-gray   { background: rgba(107,114,128,.15); color: #374151; }
.badge-purple { background: rgba(139,92,246,.15); color: #6d28d9; }
.badge-pink   { background: rgba(236,72,153,.15); color: #9d174d; }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: #64748b;
  background: rgba(148, 163, 184, 0.08);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.data-table tbody td {
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: #334155;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: rgba(59, 130, 246, 0.04); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---------- Stat Cards ---------- */
.stat-card {
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  opacity: 0.8;
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 22px; height: 22px; stroke-width: 2; }

/* ---------- Forms ---------- */
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: #0f172a;
  transition: var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
  background: #fff;
}
.form-textarea { min-height: 100px; resize: vertical; font-family: inherit; }
.field-error {
  font-size: 0.78rem;
  color: #dc2626;
  margin-top: 0.3rem;
}
.field-hint {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid transparent;
  animation: fadeIn 0.3s ease-out;
}
.alert-success { background: rgba(16, 185, 129, 0.12); border-color: rgba(16,185,129,.25); color: #065f46; }
.alert-error   { background: rgba(239, 68, 68, 0.12); border-color: rgba(239,68,68,.25); color: #991b1b; }
.alert-info    { background: rgba(59, 130, 246, 0.12); border-color: rgba(59,130,246,.25); color: #1e40af; }
.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }

/* ---------- Avatars ---------- */
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.6);
  flex-shrink: 0;
}
.avatar-sm { width: 30px; height: 30px; font-size: 0.72rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }

/* ---------- Chatbot ---------- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  min-height: 600px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chat-bubble {
  max-width: 88%;
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  font-size: 0.87rem;
  line-height: 1.55;
  word-wrap: break-word;
  animation: msgIn 0.25s ease-out;
}
.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(59,130,246,.25);
}
.chat-bubble.ai {
  align-self: flex-start;
  background: rgba(255,255,255,0.92);
  color: #1e293b;
  border: 1px solid rgba(148,163,184,0.18);
  border-bottom-left-radius: 4px;
}
.chat-bubble.ai p { margin: 0 0 0.5rem 0; }
.chat-bubble.ai p:last-child { margin-bottom: 0; }
.chat-sources {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(148,163,184,0.2);
  font-size: 0.73rem;
  color: #64748b;
}
.question-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #1e40af;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.question-pill:hover {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.chat-input-wrap {
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
}
.chat-textarea {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255,255,255,0.8);
  resize: none;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  max-height: 140px;
  transition: var(--transition);
}
.chat-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.16);
}

/* ---------- Typing Indicator ---------- */
.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.5rem 0.85rem;
}
.typing span {
  width: 7px; height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.animate-float { animation: float 3s ease-in-out infinite; }

/* ---------- Orbs for auth background ---------- */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.05);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  transform: scale(1.01);
}

/* ---------- Utility ---------- */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}
.text-muted { color: #64748b; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
