/* NexApps — Design System v2
 * Inspired by Linear · Vercel · v0 · Bolt
 * Dark-mode-first · ShadCN-flavored · glassmorphic accents
 */

:root {
  --brand-50:  #f5f3ff;
  --brand-300: #c4b5fd;
  --brand-400: #a78bfa;
  --brand-500: #8b5cf6;
  --brand-600: #7c3aed;
  --brand-700: #6d28d9;
  --accent:    #ec4899;
  --cyan:      #38bdf8;
  --emerald:   #10b981;
  --amber:     #f59e0b;
  --rose:      #f43f5e;

  --bg:           #09090b;
  --bg-elevated:  #0c0c10;
  --surface:      #18181b;
  --surface-2:    #27272a;
  --border:       rgba(255,255,255,0.07);
  --border-strong:rgba(255,255,255,0.12);
  --border-focus: rgba(167,139,250,0.45);
  --text:         #f4f4f5;
  --text-muted:   #a1a1aa;
  --text-subtle:  #71717a;

  --radius-sm: 0.375rem;
  --radius:    0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.4);
  --shadow:     0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.55);
  --shadow-xl:  0 24px 48px -12px rgba(0,0,0,0.6);
  --shadow-glow:0 0 0 1px rgba(167,139,250,0.18), 0 8px 32px -8px rgba(124,58,237,0.4);

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ----------------------- Base ----------------------- */
html, body {
  font-family: 'Inter', 'InterVariable', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03', 'cv02';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color: var(--text);
  background: var(--bg);
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124,58,237,0.18), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(236,72,153,0.10), transparent 50%);
  background-attachment: fixed;
}

::selection { background: rgba(167,139,250,0.4); color: #fff; }

h1, h2, h3, h4, h5, h6 { letter-spacing: -0.02em; font-weight: 700; }
.heading-display { font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }

/* ----------------------- Buttons ----------------------- */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.18s var(--ease-out);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 6px 18px -6px rgba(124,58,237,0.55);
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 12px 28px -8px rgba(236,72,153,0.55);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary[disabled], .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  color: #e5e7eb;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s var(--ease-out);
  cursor: pointer;
  text-decoration: none;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--border-strong);
  color: #fff;
}
.btn-ghost:active { background: rgba(255,255,255,0.04); }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s var(--ease-out);
  cursor: pointer;
  text-decoration: none;
}
.btn-outline:hover { background: rgba(255,255,255,0.04); border-color: var(--brand-400); color: var(--brand-300); }

.btn-danger {
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.25);
  color: #fda4af;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s var(--ease-out);
  cursor: pointer;
}
.btn-danger:hover { background: rgba(244,63,94,0.18); color: #fff; }

/* Icon-only button */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: all 0.15s var(--ease-out);
  cursor: pointer;
}
.btn-icon:hover { background: rgba(255,255,255,0.06); color: #fff; border-color: var(--border-strong); }

/* ----------------------- Cards & Surfaces ----------------------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.025) 0%, rgba(255,255,255,0.015) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.card:hover { border-color: var(--border-strong); }

.card-interactive {
  cursor: pointer;
}
.card-interactive:hover {
  border-color: rgba(167,139,250,0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.glass {
  background: rgba(20,20,24,0.7);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(90deg, #c4b5fd 0%, #f9a8d4 50%, #7dd3fc 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.gradient-border {
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
}
.gradient-border::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(167,139,250,0.6), rgba(236,72,153,0.4) 50%, rgba(56,189,248,0.4));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

/* Decorative glow background */
.glow {
  background-image:
    radial-gradient(circle at 20% 0%, rgba(124,58,237,0.35), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(236,72,153,0.25), transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(56,189,248,0.18), transparent 40%);
}

/* ----------------------- Inputs ----------------------- */
.input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.55rem 0.8rem;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: all 0.15s var(--ease-out);
}
.input::placeholder { color: var(--text-subtle); }
.input:hover { border-color: rgba(255,255,255,0.18); }
.input:focus {
  border-color: var(--brand-400);
  background: rgba(255,255,255,0.04);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}

textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='%23a1a1aa'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%23a1a1aa' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 0.7rem center;
  background-repeat: no-repeat;
  background-size: 12px;
  padding-right: 2rem;
}

/* ----------------------- Chips & Badges ----------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.55rem; border-radius: 9999px;
  font-size: 0.7rem; font-weight: 500;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.chip-violet { background: rgba(124,58,237,0.12); border-color: rgba(124,58,237,0.3); color: #c4b5fd; }
.chip-emerald{ background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.chip-amber  { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.chip-rose   { background: rgba(244,63,94,0.12); border-color: rgba(244,63,94,0.3); color: #fda4af; }
.chip-cyan   { background: rgba(56,189,248,0.12); border-color: rgba(56,189,248,0.3); color: #7dd3fc; }

/* Kbd-style key */
kbd, .kbd {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.7rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  color: var(--text-muted);
  min-width: 1.3rem; height: 1.3rem;
}

/* ----------------------- Animations ----------------------- */
.spinner {
  width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,0.18);
  border-top-color: #fff;
  border-radius: 9999px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}
.animate-fade   { animation: fade-in 0.3s var(--ease-out) both; }
.animate-up     { animation: slide-up 0.35s var(--ease-out) both; }
.animate-scale  { animation: scale-in 0.2s var(--ease-out) both; }

/* Stagger helpers */
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.04s; }
.stagger > *:nth-child(3) { animation-delay: 0.06s; }
.stagger > *:nth-child(4) { animation-delay: 0.08s; }
.stagger > *:nth-child(5) { animation-delay: 0.10s; }
.stagger > *:nth-child(6) { animation-delay: 0.12s; }
.stagger > *:nth-child(7) { animation-delay: 0.14s; }
.stagger > *:nth-child(8) { animation-delay: 0.16s; }
.stagger > *:nth-child(9) { animation-delay: 0.18s; }

/* Pulse / shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

/* ----------------------- Toast ----------------------- */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: rgba(20,20,24,0.96);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  z-index: 100;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  font-size: 0.875rem;
  display: flex; align-items: center; gap: 0.5rem;
  animation: slide-up 0.25s var(--ease-out);
}

/* ----------------------- Scrollbar ----------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,0.15); background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

/* ----------------------- Utility ----------------------- */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.dot-divider { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--text-subtle); margin: 0 0.5rem; vertical-align: middle; }

.platform-badge i { width: 1rem; }

/* ----------------------- Command palette ----------------------- */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14vh;
}
.cmdk-box {
  width: min(640px, 92vw);
  background: rgba(15,15,18,0.96);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: scale-in 0.18s var(--ease-out);
}
.cmdk-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.2rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}
.cmdk-input::placeholder { color: var(--text-subtle); }
.cmdk-list { max-height: 320px; overflow-y: auto; padding: 0.4rem; }
.cmdk-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
}
.cmdk-item:hover, .cmdk-item.selected {
  background: rgba(124,58,237,0.15);
  color: #fff;
}
.cmdk-item .cmdk-icon { color: var(--text-subtle); width: 1.2rem; text-align: center; }
.cmdk-item .cmdk-meta { margin-left: auto; font-size: 0.7rem; color: var(--text-subtle); }
.cmdk-group { padding: 0.4rem 0.7rem 0.25rem; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-subtle); }

/* ----------------------- Marketing / Landing ----------------------- */
.hero-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
}

.feature-icon {
  width: 2.5rem; height: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(236,72,153,0.12));
  border: 1px solid rgba(124,58,237,0.25);
  color: #c4b5fd;
}

/* App tile (marketplace + workspace) */
.tile-icon {
  width: 3rem; height: 3rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0.85rem;
  font-weight: 800; font-size: 1.25rem; color: #fff;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.5);
}

/* ----------------------- Marquee ----------------------- */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee { overflow: hidden; }
.marquee-track { display: flex; gap: 2rem; animation: marquee 30s linear infinite; }
