/* ==========================================================================
   SnapURL — design tokens
   Palette: near-black base, violet primary, teal secondary (link/success)
   Type: Space Grotesk (display) / Inter (body) / JetBrains Mono (code, links)
   ========================================================================== */

:root {
  --bg: #0a0b10;
  --bg-elevated: #101219;
  --surface: #13151e;
  --surface-2: #191c28;
  --border: #242736;
  --border-strong: #333749;

  --text: #eceef5;
  --text-muted: #9498ab;
  --text-faint: #5c6178;

  --violet: #7c5cff;
  --violet-strong: #9478ff;
  --violet-dim: #7c5cff1a;
  --teal: #2dd4bf;
  --teal-dim: #2dd4bf1a;
  --danger: #ff6b6b;
  --danger-dim: #ff6b6b1a;
  --success: #34d399;

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 0 1px var(--border), 0 12px 40px -12px rgba(124, 92, 255, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 15% -10%, rgba(124, 92, 255, 0.12), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(45, 212, 191, 0.08), transparent 40%);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.02em;
}

p { margin: 0; }

a { color: inherit; text-decoration: none; }

button, input {
  font-family: inherit;
  color: inherit;
}

img, svg { display: block; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

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

/* Focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--violet-strong);
  outline-offset: 2px;
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(10, 11, 16, 0.72);
  border-bottom: 1px solid var(--border);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.logo__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--violet), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0b10;
  font-weight: 800;
  font-size: 0.85rem;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--violet);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 8px 20px -8px rgba(124, 92, 255, 0.7);
}
.btn--primary:hover { background: var(--violet-strong); }

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--violet-strong); background: var(--violet-dim); }

.btn--subtle {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted);
}
.btn--subtle:hover { color: var(--text); border-color: var(--border-strong); }

.btn--danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn--danger:hover { background: var(--danger-dim); }

.btn--danger-solid {
  background: var(--danger);
  color: #1a0505;
}
.btn--danger-solid:hover { filter: brightness(1.08); }

.btn--sm { --btn-h: 36px; padding: 0 13px; font-size: 0.85rem; }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: var(--btn-h); }

.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.btn--ghost .spinner, .btn--subtle .spinner {
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--text);
}

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

/* ==========================================================================
   Hero / Landing
   ========================================================================== */

.hero {
  padding: 96px 0 72px;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid rgba(45, 212, 191, 0.3);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.eyebrow__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
}

.hero h1 {
  font-size: clamp(2.4rem, 4.6vw, 3.6rem);
  margin-bottom: 20px;
}

.hero h1 .accent {
  background: linear-gradient(90deg, var(--violet-strong), var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  font-size: 1.12rem;
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 34px;
}

.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Terminal-style signature widget */
.term {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  overflow: hidden;
}

.term__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.term__dot { width: 10px; height: 10px; border-radius: 50%; }
.term__dot--r { background: #ff5f57; }
.term__dot--y { background: #febc2e; }
.term__dot--g { background: #28c840; }

.term__title {
  margin-left: 8px;
  font-size: 0.78rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.term__body {
  padding: 26px 22px 30px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.term__line { color: var(--text-muted); margin-bottom: 14px; }
.term__prompt { color: var(--teal); }

.term__url-in {
  color: var(--text);
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 2px;
}

.term__cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: var(--violet-strong);
  margin-left: 2px;
  vertical-align: -2px;
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.term__result {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transform: translateY(6px);
  animation: reveal 0.5s ease forwards;
  animation-delay: 1.6s;
}

@keyframes reveal { to { opacity: 1; transform: translateY(0); } }

.term__result .short { color: var(--violet-strong); font-weight: 600; }
.term__result .badge {
  font-size: 0.7rem;
  color: var(--success);
  background: rgba(52, 211, 153, 0.12);
  padding: 3px 8px;
  border-radius: 999px;
}

/* ==========================================================================
   Feature section
   ========================================================================== */

.section {
  padding: 60px 0;
}

.section__head {
  max-width: 560px;
  margin-bottom: 44px;
}

.section__head h2 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  margin-bottom: 12px;
}

.section__head p {
  color: var(--text-muted);
  font-size: 1.02rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.feature-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
}

.feature-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  background: var(--violet-dim);
  color: var(--violet-strong);
}

.feature-card h3 {
  font-size: 1.02rem;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  margin-top: 40px;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* ==========================================================================
   Auth pages
   ========================================================================== */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-soft);
}

.auth-card__logo {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.auth-card h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 6px;
}

.auth-card__sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.auth-card__sub strong { color: var(--text); font-weight: 600; }

.auth-card__foot {
  text-align: center;
  margin-top: 22px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.auth-card__foot a { color: var(--violet-strong); font-weight: 600; }
.auth-card__foot a:hover { text-decoration: underline; }

.auth-card__row {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 18px;
}
.auth-card__row a { font-size: 0.83rem; color: var(--text-muted); }
.auth-card__row a:hover { color: var(--violet-strong); }

/* ==========================================================================
   Form fields
   ========================================================================== */

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  height: 46px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder { color: var(--text-faint); }

.field input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-dim);
}

.field input[readonly] {
  color: var(--text-muted);
  background: var(--surface-2);
}

.field--error input { border-color: var(--danger); }
.field--error input:focus { box-shadow: 0 0 0 3px var(--danger-dim); }

.field__error {
  display: block;
  min-height: 16px;
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 6px;
}

.field__hint {
  display: block;
  color: var(--text-faint);
  font-size: 0.78rem;
  margin-top: 6px;
}

.field--otp input {
  letter-spacing: 0.5em;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  text-align: center;
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.dash {
  min-height: 100vh;
}

.dash__main {
  padding: 44px 0 80px;
}

.dash__intro {
  margin-bottom: 32px;
}

.dash__intro h1 {
  font-size: 1.7rem;
  margin-bottom: 8px;
}

.dash__intro p {
  color: var(--text-muted);
}

.shorten-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 40px;
}

.shorten-panel__form {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.shorten-panel__form .field {
  flex: 1;
  margin-bottom: 0;
}

.result-strip {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  animation: reveal 0.35s ease;
}

.result-strip.is-visible { display: flex; }

.result-strip__info {
  min-width: 0;
}

.result-strip__original {
  font-size: 0.78rem;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 420px;
}

.result-strip__short {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  color: var(--violet-strong);
  font-weight: 600;
}

.result-strip__actions {
  display: flex;
  gap: 8px;
}

.dash__list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.dash__list-head h2 {
  font-size: 1.15rem;
}

.count-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.link-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.link-card:hover { border-color: var(--border-strong); }

.link-card__short {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--violet-strong);
}

.link-card__short svg { width: 15px; height: 15px; color: var(--teal); flex-shrink: 0; }

.link-card__original {
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card__meta {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.link-card__actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.link-card__actions .btn { flex: 1; }

/* Skeleton loaders */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border-strong) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-line--short { width: 40%; height: 18px; }
.skeleton-line--full { width: 85%; }
.skeleton-line--btn { height: 34px; border-radius: 8px; margin-top: 10px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 70px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 14px;
  background: var(--violet-dim);
  color: var(--violet-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 340px;
  margin: 0 auto;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 11, 0.65);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay.is-open { display: flex; }

.modal {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-soft);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--danger-dim);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.modal h3 { font-size: 1.15rem; margin-bottom: 8px; }
.modal p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 22px; }

.modal__actions {
  display: flex;
  gap: 10px;
}
.modal__actions .btn { flex: 1; }

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  font-size: 0.87rem;
}

.toast--visible { opacity: 1; transform: translateX(0); }

.toast__icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast__icon svg { width: 100%; height: 100%; }

.toast--success .toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--danger); }
.toast--default .toast__icon { color: var(--violet-strong); }

/* ==========================================================================
   Misc
   ========================================================================== */

.center-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--text-muted);
  gap: 10px;
  font-size: 0.9rem;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: 44px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .feature-grid { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 48px; }
  .navbar__actions .btn span.hide-mobile { display: none; }
  .shorten-panel__form { flex-direction: column; }
  .shorten-panel__form .btn { width: 100%; }
  .result-strip { flex-direction: column; align-items: flex-start; }
  .result-strip__actions { width: 100%; }
  .result-strip__actions .btn { flex: 1; }
  .auth-card { padding: 28px 22px; }
  .footer__inner { flex-direction: column; gap: 10px; text-align: center; }
}
