/* PROMPTORA AI — design system */
/* Dark theme is the brand default. Light theme: <html data-theme="light"> (set before paint by
   /assets/js/theme-init.js from the saved choice or the OS preference). */
:root {
  --fg-rgb: 255, 255, 255;
  --bg: #0b1020;
  --bg-2: #111827;
  --bg-3: #171e30;
  --panel: rgba(var(--fg-rgb), 0.035);
  --panel-2: rgba(var(--fg-rgb), 0.06);
  --panel-solid: #171e30;
  --border: rgba(var(--fg-rgb), 0.08);
  --border-2: rgba(var(--fg-rgb), 0.14);
  --heading: #ffffff;
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --accent-text: #c4b5fd;
  --ok-text: #a7f3d0;
  --err-text: #fecaca;
  --warn-text: #fde68a;
  --info-text: #7dd3fc;
  --violet: #8b5cf6;
  --purple: #a855f7;
  --indigo: #6366f1;
  --blue: #38bdf8;
  --cyan: #38bdf8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #6d5cf6 45%, #38bdf8 100%);
  --grad-text: linear-gradient(100deg, #c4b5fd 0%, #a78bfa 35%, #7dd3fc 100%);
  --glow: 0 0 0 1px rgba(139, 92, 246, 0.35), 0 10px 40px -10px rgba(99, 102, 241, 0.55);
  --orb-opacity: 0.45;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.8);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Sora', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}
:root[data-theme='light'] {
  --fg-rgb: 15, 23, 42;
  --bg: #f5f6fb;
  --bg-2: #ffffff;
  --bg-3: #eef0f7;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-2: rgba(var(--fg-rgb), 0.05);
  --panel-solid: #ffffff;
  --border: rgba(var(--fg-rgb), 0.1);
  --border-2: rgba(var(--fg-rgb), 0.18);
  --heading: #0b1020;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #5b6478;
  --accent-text: #6d28d9;
  --ok-text: #047857;
  --err-text: #b91c1c;
  --warn-text: #92400e;
  --info-text: #0369a1;
  --grad-text: linear-gradient(100deg, #7c3aed 0%, #6d28d9 40%, #0284c7 100%);
  --glow: 0 0 0 1px rgba(139, 92, 246, 0.35), 0 10px 30px -12px rgba(99, 102, 241, 0.35);
  --orb-opacity: 0.18;
  --shadow: 0 18px 50px -24px rgba(15, 23, 42, 0.28);
  color-scheme: light;
}
[hidden]{display:none!important}
/* Right-to-left languages (Arabic) — layout direction comes from <html dir="rtl">. */
[dir='rtl'] .row,
[dir='rtl'] .nav a {
  direction: rtl;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
/* default size for inline icons (zero specificity so component rules win) */
:where(svg:not([width])) {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--accent-text);
  text-decoration: none;
}
a:hover {
  color: var(--accent-text);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
::selection {
  background: rgba(139, 92, 246, 0.45);
}
:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--heading);
}

/* ---------- ambient background ---------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(800px 500px at 50% 110%, rgba(59, 130, 246, 0.12), transparent 60%), var(--bg);
}
.ambient::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(var(--fg-rgb), 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--fg-rgb), 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 70%);
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: var(--orb-opacity);
  animation: float 18s var(--ease) infinite alternate;
}
.orb.o1 {
  width: 420px;
  height: 420px;
  background: #7c3aed;
  top: -120px;
  left: 10%;
}
.orb.o2 {
  width: 380px;
  height: 380px;
  background: #2563eb;
  top: 30%;
  right: -120px;
  animation-delay: -6s;
}
.orb.o3 {
  width: 300px;
  height: 300px;
  background: #a855f7;
  bottom: -120px;
  left: 30%;
  animation-delay: -12s;
  opacity: 0.25;
}
@keyframes float {
  to {
    transform: translate3d(40px, 30px, 0) scale(1.1);
  }
}

/* ---------- primitives ---------- */
.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.card {
  background: linear-gradient(180deg, rgba(var(--fg-rgb), 0.045), rgba(var(--fg-rgb), 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: relative;
}
.card.hover {
  transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}
.card.hover:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 18px 50px -20px rgba(99, 102, 241, 0.45);
}
.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--heading);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.tiny {
  font-size: 0.75rem;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.row.wrap {
  flex-wrap: wrap;
}
.row.between {
  justify-content: space-between;
}
.stack > * + * {
  margin-top: 16px;
}
.grid {
  display: grid;
  gap: 18px;
}
.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.spacer {
  flex: 1;
}
.hidden {
  display: none !important;
}
.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* ---------- buttons ---------- */
.btn {
  --h: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h);
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.3s, opacity 0.2s;
  text-decoration: none;
  user-select: none;
}
.btn:hover {
  background: rgba(var(--fg-rgb), 0.1);
  border-color: rgba(var(--fg-rgb), 0.22);
  color: var(--heading);
}
.btn:active {
  transform: scale(0.97);
}
.btn[disabled],
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.primary {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 30px -10px rgba(99, 102, 241, 0.8), inset 0 1px 0 rgba(var(--fg-rgb), 0.25);
  position: relative;
  overflow: hidden;
}
.btn.primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(var(--fg-rgb), 0.25) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.8s var(--ease);
}
.btn.primary:hover::after {
  transform: translateX(120%);
}
.btn.primary:hover {
  box-shadow: 0 12px 40px -10px rgba(139, 92, 246, 0.9), inset 0 1px 0 rgba(var(--fg-rgb), 0.3);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn.ghost:hover {
  background: var(--panel-2);
}
.btn.danger {
  color: var(--err-text);
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}
.btn.danger:hover {
  background: rgba(248, 113, 113, 0.18);
}
.btn.sm {
  --h: 34px;
  padding: 0 12px;
  font-size: 0.84rem;
  border-radius: 10px;
}
.btn.lg {
  --h: 52px;
  padding: 0 26px;
  font-size: 1rem;
  border-radius: 14px;
}
.btn.icon {
  width: var(--h);
  padding: 0;
}
.btn.block {
  width: 100%;
}
.btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.btn.copied {
  border-color: rgba(52, 211, 153, 0.5);
  color: var(--ok-text);
  background: rgba(52, 211, 153, 0.1);
}

/* ---------- forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > label,
.label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.input,
.select,
.textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(139, 92, 246, 0.7);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
  background: rgba(0, 0, 0, 0.5);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
}
.textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.55;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239a9ab0' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.select option {
  background: var(--panel-solid);
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-2);
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(var(--fg-rgb), 0.02);
  transition: border-color 0.2s, background 0.2s;
}
.check:hover {
  border-color: var(--border-2);
}
.check input {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--border-2);
  display: grid;
  place-content: center;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}
.check input:checked {
  background: var(--grad);
  border-color: transparent;
}
.check input:checked::after {
  content: '';
  width: 9px;
  height: 5px;
  border: 2px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}
.check:has(input:checked) {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.07);
}
.check.locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.form-error {
  color: var(--err-text);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
}
.form-ok {
  color: var(--ok-text);
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
}

/* segmented control */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, color 0.2s;
}
.seg button:hover {
  color: var(--text);
}
.seg button.active {
  background: rgba(139, 92, 246, 0.22);
  color: var(--heading);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.45);
}
.seg button svg {
  width: 13px;
  height: 13px;
}

/* badges & chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  color: var(--text-2);
}
.badge.free {
  color: var(--text-2);
}
.badge.pro {
  color: var(--accent-text);
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.12);
}
.badge.premium {
  color: var(--warn-text);
  border-color: rgba(251, 191, 36, 0.4);
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.12), rgba(168, 85, 247, 0.12));
}
.badge.admin {
  color: var(--info-text);
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.08);
}
.badge.ok {
  color: var(--ok-text);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}
.badge.warn {
  color: var(--warn-text);
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}
.badge.err {
  color: var(--err-text);
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}
.badge svg {
  width: 11px;
  height: 11px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: rgba(var(--fg-rgb), 0.05);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(20, 20, 32, 0.92);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  font-size: 0.9rem;
  animation: toast-in 0.4s var(--ease);
}
.toast.ok {
  border-color: rgba(52, 211, 153, 0.4);
}
.toast.err {
  border-color: rgba(248, 113, 113, 0.45);
}
.toast svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}
.toast.ok svg {
  color: var(--green);
}
.toast.err svg {
  color: var(--red);
}
.toast.out {
  animation: toast-out 0.3s var(--ease) forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* ---------- modal ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 3, 8, 0.7);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade 0.25s;
}
.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: linear-gradient(180deg, #14141f, #0e0e17);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.9), var(--glow);
  animation: pop 0.35s var(--ease);
}
.modal.wide {
  width: min(860px, 100%);
}
.modal h3 {
  margin-bottom: 16px;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}

/* ---------- loaders ---------- */
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(var(--fg-rgb), 0.25);
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(var(--fg-rgb), 0.04) 25%, rgba(var(--fg-rgb), 0.09) 50%, rgba(var(--fg-rgb), 0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.thinking {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 50px 20px;
  text-align: center;
}
.thinking .core {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  position: relative;
  background: conic-gradient(from 0deg, #8b5cf6, #3b82f6, #a855f7, #8b5cf6);
  animation: spin 2.2s linear infinite;
  filter: drop-shadow(0 0 24px rgba(139, 92, 246, 0.6));
}
.thinking .core::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--bg-2);
}
.thinking .step {
  font-weight: 600;
  color: var(--heading);
  min-height: 1.5em;
  animation: fade 0.4s;
}
.scan {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}
.scan::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(139, 92, 246, 0.35), transparent);
  animation: scan 1.8s ease-in-out infinite;
}
@keyframes scan {
  from {
    top: -30%;
  }
  to {
    top: 100%;
  }
}

/* ---------- empty states ---------- */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
}
.empty .ico {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-text);
}
.empty .ico svg {
  width: 26px;
  height: 26px;
}
.empty h4 {
  color: var(--heading);
  margin-bottom: 4px;
  font-size: 1.05rem;
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(var(--fg-rgb), 0.025);
  font-weight: 600;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tr:hover td {
  background: rgba(var(--fg-rgb), 0.02);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
