/* =========================================================
   URL Shortener — premium dark SaaS UI
   ========================================================= */

:root {
  /* Colors */
  --bg: #050816;
  --card: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.09);
  --primary: #7C3AED;
  --secondary: #06B6D4;
  --success: #22C55E;
  --text: #FFFFFF;
  --text-muted: #B6B6C2;

  /* Effects */
  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 30px 80px -20px rgba(0, 0, 0, 0.7),
                 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  --gradient-primary: linear-gradient(135deg, #7C3AED 0%, #06B6D4 100%);
  --gradient-primary-hover: linear-gradient(135deg, #8B4BF0 0%, #22C4E0 100%);
  --transition: 300ms cubic-bezier(0.22, 1, 0.36, 1);

  /* Typography */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, Helvetica, Arial, sans-serif;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadePage 700ms ease-out both;
}

/* ---------- Background ---------- */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.45;
  will-change: transform;
}

.blob-1 {
  width: 520px;
  height: 520px;
  background: #7C3AED;
  top: -140px;
  left: -140px;
  animation: floatBlob 18s ease-in-out infinite;
}

.blob-2 {
  width: 480px;
  height: 480px;
  background: #06B6D4;
  bottom: -160px;
  right: -120px;
  animation: floatBlob 22s ease-in-out infinite reverse;
}

.blob-3 {
  width: 360px;
  height: 360px;
  background: #22C55E;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.15;
  animation: floatBlob 26s ease-in-out infinite;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
}

/* ---------- App ---------- */
.app {
  width: 100%;
  max-width: 620px;
}

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 48px;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--shadow-card);
  animation: slideUp 800ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 100ms;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
    rgba(124, 58, 237, 0.4),
    rgba(6, 182, 212, 0.15) 50%,
    transparent 80%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.card-header {
  text-align: center;
  margin-bottom: 36px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s ease-in-out infinite;
}

h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 0%, #B6B6C2 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
  line-height: 1.1;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 420px;
  margin: 0 auto;
}

/* ---------- Fields ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field + .field {
  margin-top: 4px;
}

.label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.input-wrap {
  position: relative;
}

.input {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition);
}

.input::placeholder {
  color: rgba(182, 182, 194, 0.5);
}

.input:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.045);
}

.input:focus {
  border-color: rgba(124, 58, 237, 0.6);
  background: rgba(255, 255, 255, 0.05);
  box-shadow:
    0 0 0 4px rgba(124, 58, 237, 0.15),
    0 0 24px rgba(124, 58, 237, 0.15);
}

.input-readonly {
  padding-right: 108px;
  color: var(--text-muted);
  cursor: default;
}

.input-readonly.has-value {
  color: var(--text);
  font-weight: 500;
}

.short-wrap {
  display: flex;
  align-items: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  user-select: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

/* Primary */
.btn-primary {
  height: 56px;
  margin-top: 16px;
  background: var(--gradient-primary);
  background-size: 200% 200%;
  background-position: 0% 50%;
  box-shadow:
    0 10px 30px -8px rgba(124, 58, 237, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  transform: translateY(-2px);
  background-position: 100% 50%;
  box-shadow:
    0 18px 40px -10px rgba(124, 58, 237, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow:
    0 6px 16px -6px rgba(124, 58, 237, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.btn-primary.is-loading .btn-label {
  opacity: 0.4;
}

.btn-primary.is-loading .btn-spinner {
  opacity: 1;
}

.btn-spinner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  opacity: 0;
  animation: spin 700ms linear infinite;
  transition: opacity var(--transition);
}

/* Ghost / copy */
.btn-ghost {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 40px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-ghost:active {
  transform: translateY(-50%) scale(0.96);
}

.btn-ghost.is-copied {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--success);
}

.btn-ghost .icon {
  width: 15px;
  height: 15px;
}

/* Ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  animation: ripple 600ms ease-out;
}

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent);
  margin: 32px 0;
}

/* ---------- Status ---------- */
.status {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  transition: color var(--transition);
  min-height: 20px;
}

.status.is-success { color: var(--success); }
.status.is-error   { color: #F87171; }
.status.is-info    { color: var(--secondary); }

/* ---------- Animations ---------- */
@keyframes fadePage {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(40px, -30px) scale(1.08); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.3); }
}

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

@keyframes ripple {
  to { transform: scale(3); opacity: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .card { padding: 32px 24px; border-radius: 20px; }
  .card-header { margin-bottom: 28px; }
  .divider { margin: 24px 0; }
  .input, .btn-primary { height: 52px; }
  .btn-ghost .copy-label { display: none; }
  .btn-ghost { padding: 0 12px; }
  .input-readonly { padding-right: 64px; }
}

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