/* ============================================================
   OBSIDION — Global Design System
   Light, Modern, Minimalist
   ============================================================ */

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

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Colors */
  --clr-bg: #f8f9fc;
  --clr-bg-alt: #ffffff;
  --clr-surface: #ffffff;
  --clr-surface-2: #f1f3f9;
  --clr-border: #e4e7f0;
  --clr-border-2: #d1d5e8;

  --clr-accent: #4f46e5;
  --clr-accent-h: #4338ca;
  --clr-accent-l: #eef2ff;
  --clr-accent-2: #7c3aed;

  --clr-text: #0f172a;
  --clr-text-2: #475569;
  --clr-text-3: #94a3b8;
  --clr-text-inv: #ffffff;

  --clr-success: #10b981;
  --clr-success-l: #d1fae5;
  --clr-warn: #f59e0b;
  --clr-warn-l: #fef3c7;
  --clr-danger: #ef4444;
  --clr-danger-l: #fee2e2;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:
    0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:
    0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg:
    0 10px 15px -3px rgba(15, 23, 42, 0.08),
    0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl:
    0 20px 25px -5px rgba(15, 23, 42, 0.08),
    0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-acc: 0 8px 24px -4px rgba(79, 70, 229, 0.25);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-2xl: 32px;
  --r-full: 9999px;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;
  --sp-3xl: 64px;

  /* Font */
  --font: 'Inter', -apple-system, sans-serif;
  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semi: 600;
  --fw-bold: 700;
  --fw-extra: 800;
  --fw-black: 900;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-base: 250ms ease;
  --t-slow: 400ms ease;
  --t-spring: 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Reset ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
  min-height: 100vh;
}

img,
video {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}
input,
textarea,
select {
  font-family: inherit;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--clr-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--clr-border-2);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--clr-accent);
}

/* ─── Typography ────────────────────────────────────────────── */
.text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}
.text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}
.text-base {
  font-size: 1rem;
  line-height: 1.5rem;
}
.text-lg {
  font-size: 1.125rem;
  line-height: 1.75rem;
}
.text-xl {
  font-size: 1.25rem;
  line-height: 1.75rem;
}
.text-2xl {
  font-size: 1.5rem;
  line-height: 2rem;
}
.text-3xl {
  font-size: 1.875rem;
  line-height: 2.25rem;
}
.text-4xl {
  font-size: 2.25rem;
  line-height: 2.5rem;
}
.text-5xl {
  font-size: 3rem;
  line-height: 1.15;
}
.text-6xl {
  font-size: 3.75rem;
  line-height: 1.1;
}
.text-7xl {
  font-size: 4.5rem;
  line-height: 1.05;
}

.font-light {
  font-weight: var(--fw-light);
}
.font-regular {
  font-weight: var(--fw-regular);
}
.font-medium {
  font-weight: var(--fw-medium);
}
.font-semi {
  font-weight: var(--fw-semi);
}
.font-bold {
  font-weight: var(--fw-bold);
}
.font-extra {
  font-weight: var(--fw-extra);
}
.font-black {
  font-weight: var(--fw-black);
}

.text-primary {
  color: var(--clr-text);
}
.text-secondary {
  color: var(--clr-text-2);
}
.text-muted {
  color: var(--clr-text-3);
}
.text-accent {
  color: var(--clr-accent);
}
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}

/* ─── Gradient Text ─────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(
    135deg,
    var(--clr-accent) 0%,
    var(--clr-accent-2) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: 10px var(--sp-lg);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: var(--fw-semi);
  transition: all var(--t-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background var(--t-fast);
}
.btn:hover::after {
  background: rgba(255, 255, 255, 0.1);
}
.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--clr-accent);
  color: var(--clr-text-inv);
  box-shadow: var(--shadow-acc);
}
.btn-primary:hover {
  background: var(--clr-accent-h);
}

.btn-secondary {
  background: var(--clr-surface);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--clr-surface-2);
  border-color: var(--clr-border-2);
}

.btn-ghost {
  background: transparent;
  color: var(--clr-text-2);
}
.btn-ghost:hover {
  background: var(--clr-surface-2);
  color: var(--clr-text);
}

.btn-accent-outline {
  background: var(--clr-accent-l);
  color: var(--clr-accent);
  border: 1px solid rgba(79, 70, 229, 0.2);
}
.btn-accent-outline:hover {
  background: var(--clr-accent);
  color: white;
}

.btn-lg {
  padding: 14px var(--sp-xl);
  font-size: 1rem;
  border-radius: var(--r-lg);
}
.btn-sm {
  padding: 7px var(--sp-md);
  font-size: 0.8125rem;
  border-radius: var(--r-sm);
}
.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Inputs ────────────────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.input-label {
  font-size: 0.875rem;
  font-weight: var(--fw-medium);
  color: var(--clr-text);
}

.input {
  width: 100%;
  padding: 10px var(--sp-md);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--r-md);
  font-size: 0.9375rem;
  color: var(--clr-text);
  background: var(--clr-surface);
  transition: all var(--t-fast);
  outline: none;
}
.input:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.input::placeholder {
  color: var(--clr-text-3);
}
.input.error {
  border-color: var(--clr-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

/* ─── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: var(--fw-semi);
}
.badge-accent {
  background: var(--clr-accent-l);
  color: var(--clr-accent);
}
.badge-success {
  background: var(--clr-success-l);
  color: var(--clr-success);
}
.badge-warn {
  background: var(--clr-warn-l);
  color: var(--clr-warn);
}
.badge-danger {
  background: var(--clr-danger-l);
  color: var(--clr-danger);
}
.badge-neutral {
  background: var(--clr-surface-2);
  color: var(--clr-text-2);
}

/* ─── Spinner ───────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--clr-border);
  border-top-color: var(--clr-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: inline-block;
}
.spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

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

/* ─── Divider ───────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--clr-border);
  margin: var(--sp-lg) 0;
}
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  color: var(--clr-text-3);
  font-size: 0.875rem;
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--clr-border);
}

/* ─── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--sp-xl);
  right: var(--sp-xl);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 12px var(--sp-md);
  background: var(--clr-text);
  color: white;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  font-size: 0.875rem;
  font-weight: var(--fw-medium);
  pointer-events: auto;
  animation: toastIn 0.3s var(--t-spring);
  min-width: 220px;
  max-width: 360px;
}
.toast.success {
  background: var(--clr-success);
}
.toast.error {
  background: var(--clr-danger);
}
.toast.warn {
  background: var(--clr-warn);
  color: var(--clr-text);
}
.toast.out {
  animation: toastOut 0.3s ease forwards;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
}

/* ─── Utilities ─────────────────────────────────────────────── */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-1 {
  gap: 4px;
}
.gap-2 {
  gap: 8px;
}
.gap-3 {
  gap: 12px;
}
.gap-4 {
  gap: 16px;
}
.gap-6 {
  gap: 24px;
}
.w-full {
  width: 100%;
}
.h-full {
  height: 100%;
}
.relative {
  position: relative;
}
.overflow-hidden {
  overflow: hidden;
}
.hidden {
  display: none !important;
}

/* ─── Animations base ───────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.5s ease both;
}
.slide-up {
  animation: slideUp 0.5s ease both;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Reveal on scroll ──────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 {
  transition-delay: 0.1s;
}
.reveal-delay-2 {
  transition-delay: 0.2s;
}
.reveal-delay-3 {
  transition-delay: 0.3s;
}
.reveal-delay-4 {
  transition-delay: 0.4s;
}
.reveal-delay-5 {
  transition-delay: 0.5s;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .text-7xl {
    font-size: 3rem;
  }
  .text-6xl {
    font-size: 2.5rem;
  }
  .text-5xl {
    font-size: 2.25rem;
  }
  .hide-mobile {
    display: none !important;
  }
}

/* ─── Help Chat ─────────────────────────────────────────────── */
.chat-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  pointer-events: none; /* Let clicks pass through container */
}

.chat-fab {
  pointer-events: auto;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--clr-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    var(--shadow-acc),
    0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all var(--t-spring);
  border: none;
  outline: none;
}

.chat-fab:hover {
  transform: scale(1.05);
  background: var(--clr-accent-h);
}

.chat-fab:active {
  transform: scale(0.95);
}

.chat-fab svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--t-base);
}

.chat-fab.open svg {
  transform: rotate(90deg);
  opacity: 0;
}

.chat-fab-close-icon {
  position: absolute;
  width: 28px;
  height: 28px;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
  transition: all var(--t-base);
}

.chat-fab.open .chat-fab-close-icon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.chat-panel {
  width: 340px;
  height: 500px;
  max-height: 80vh;
  opacity: 0;
  transform: translateY(20px) scale(0);
  transform-origin: bottom right;
  transition:
    opacity var(--t-spring),
    transform var(--t-spring);
  pointer-events: none !important;
  visibility: hidden;
  z-index: -99;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow:
    var(--shadow-xl),
    0 10px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
}

.chat-panel deep-chat {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
}

.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  z-index: 100;
}

@media (max-width: 768px) {
  .chat-widget-container {
    bottom: 16px;
    right: 16px;
  }
  .chat-panel.open {
    position: fixed;
    bottom: 80px;
    right: 16px;
    left: 16px;
    width: auto;
    height: calc(100vh - 120px);
    max-height: none;
    z-index: 10000;
  }

  .chat-panel {
    max-height: 75vh !important;
  }

  .chat-panel deep-chat {
    width: 100% !important;
    height: calc(0) !important;
  }
}
