/* ── Design Tokens (matches landing page) ─────────────────────────── */
:root {
  --bg: #09090e;
  --surface: #0f0f17;
  --card: #13131c;
  --raised: #191926;
  --border: #222233;
  --accent: #e8ff47;
  --purple: #7c6bff;
  --teal: #00e5c0;
  --text: #eeeeff;
  --muted: #50506a;
  --danger: #ff4757;
  --r: 10px;
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
}

/* ════════════════════════════════════════════════════════════════════
       TOAST CONTAINER
       Fixed, stacks from bottom-right. On mobile: bottom-center.
    ════════════════════════════════════════════════════════════════════ */
#flowly-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse; /* newest on top */
  gap: 10px;
  pointer-events: none;
  width: 360px;
}

@media (max-width: 480px) {
  #flowly-toast-container {
    right: 1rem;
    left: 1rem;
    width: auto;
    bottom: 1rem;
  }
}

/* ════════════════════════════════════════════════════════════════════
       SINGLE TOAST
    ════════════════════════════════════════════════════════════════════ */
.flowly-toast {
  pointer-events: all;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.4),
    0 16px 40px -4px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
  min-width: 0;
  width: 100%;

  /* ── Enter animation ── */
  animation: toast-in 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

/* Variant: left accent bar */
.flowly-toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10%;
  bottom: 10%;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--toast-accent, var(--border));
}

/* Variant color overrides */
.flowly-toast.toast-success {
  --toast-accent: var(--teal);
}
.flowly-toast.toast-error {
  --toast-accent: var(--danger);
}
.flowly-toast.toast-warning {
  --toast-accent: var(--accent);
}
.flowly-toast.toast-info {
  --toast-accent: var(--purple);
}
.flowly-toast.toast-music {
  --toast-accent: var(--accent);
}

/* ── Progress bar (auto-dismiss countdown) ── */
.flowly-toast::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 12px 12px;
  background: var(--toast-accent, var(--border));
  opacity: 0.45;
  width: 100%;
  transform-origin: left;
  animation: toast-progress var(--toast-duration, 4000ms) linear forwards;
}

.flowly-toast.toast-persistent::after {
  display: none;
}

/* ── Icon wrapper ── */
.toast-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.toast-success .toast-icon {
  background: rgba(0, 229, 192, 0.1);
}
.toast-error .toast-icon {
  background: rgba(255, 71, 87, 0.1);
}
.toast-warning .toast-icon {
  background: rgba(232, 255, 71, 0.1);
}
.toast-info .toast-icon {
  background: rgba(124, 107, 255, 0.1);
}
.toast-music .toast-icon {
  background: rgba(232, 255, 71, 0.1);
}

.toast-icon svg {
  width: 16px;
  height: 16px;
}

.toast-success .toast-icon svg {
  color: var(--teal);
}
.toast-error .toast-icon svg {
  color: var(--danger);
}
.toast-warning .toast-icon svg {
  color: var(--accent);
}
.toast-info .toast-icon svg {
  color: var(--purple);
}
.toast-music .toast-icon svg {
  color: var(--accent);
}

/* ── Text area ── */
.toast-body {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.toast-title {
  font-family: "Syne", sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}

/* Action link inside toast */
.toast-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--toast-accent, var(--muted));
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  transition:
    background 0.15s,
    opacity 0.15s;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.09);
  opacity: 0.9;
}

/* ── Close button ── */
.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  transition:
    background 0.15s,
    color 0.15s;
  margin-top: 1px;
  padding: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}
.toast-close svg {
  width: 13px;
  height: 13px;
}

/* ── Animations ── */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 120px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: translateX(24px) scale(0.93);
    max-height: 0;
    margin-bottom: -10px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.flowly-toast.removing {
  animation: toast-out 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════════════════
       DEMO PAGE STYLES (not needed in production)
    ════════════════════════════════════════════════════════════════════ */
.demo-title {
  font-family: "Syne", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.demo-sub {
  font-size: 0.83rem;
  color: var(--muted);
  margin-bottom: 2rem;
  text-align: center;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 600px;
}

.demo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.7rem 1rem;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.demo-btn:hover {
  background: var(--raised);
  border-color: var(--muted);
}
.demo-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.demo-btn.btn-success {
  border-color: rgba(0, 229, 192, 0.3);
  color: var(--teal);
}
.demo-btn.btn-error {
  border-color: rgba(255, 71, 87, 0.3);
  color: var(--danger);
}
.demo-btn.btn-warning {
  border-color: rgba(232, 255, 71, 0.3);
  color: var(--accent);
}
.demo-btn.btn-info {
  border-color: rgba(124, 107, 255, 0.3);
  color: var(--purple);
}
.demo-btn.btn-music {
  border-color: rgba(232, 255, 71, 0.25);
  color: var(--accent);
}
.demo-btn.btn-action {
  border-color: var(--border);
  color: var(--text);
}
.demo-btn.btn-persist {
  border-color: var(--border);
  color: var(--muted);
}

.demo-divider {
  width: 100%;
  max-width: 600px;
  height: 1px;
  background: var(--border);
  margin: 1rem 0 0.5rem;
}

.demo-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  width: 100%;
  max-width: 600px;
  margin-bottom: 0.5rem;
}

/* ── Code block preview ── */
.demo-code-wrap {
  width: 100%;
  max-width: 600px;
  margin-top: 2rem;
}

.demo-code-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.demo-code {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  color: #b0b0cc;
  line-height: 1.7;
  overflow-x: auto;
}

.demo-code .kw {
  color: var(--purple);
}
.demo-code .str {
  color: var(--teal);
}
.demo-code .fn {
  color: var(--accent);
}
.demo-code .cmt {
  color: var(--muted);
  font-style: italic;
}
