/* ============================================================
   Shorty – Design System
   ============================================================ */

/* --- Tokens --- */
:root {
  --primary:        #7C3AED;
  --primary-dark:   #5B21B6;
  --primary-light:  #EDE9FE;
  --primary-glow:   rgba(124,58,237,0.25);
  --accent:         #06B6D4;
  --accent-light:   #CFFAFE;

  --bg:             #F1F5F9;
  --surface:        #FFFFFF;
  --surface-2:      #F8FAFC;
  --border:         #E2E8F0;

  --text:           #0F172A;
  --text-secondary: #334155;
  --text-muted:     #64748B;

  --success:        #10B981;
  --success-light:  #D1FAE5;
  --success-border: #6EE7B7;
  --success-text:   #065F46;

  --danger:         #EF4444;
  --danger-light:   #FEE2E2;
  --danger-border:  #FCA5A5;
  --danger-text:    #991B1B;

  --nav-bg:         #1E1B4B;
  --nav-border:     rgba(255,255,255,0.07);
  --nav-text:       #A5B4FC;

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  20px;
  --radius-full:9999px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06),0 1px 2px rgba(0,0,0,0.04);
  --shadow:     0 4px 20px rgba(0,0,0,0.08),0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.12),0 8px 24px rgba(0,0,0,0.06);
  --shadow-primary: 0 8px 32px var(--primary-glow);

  --transition: 0.18s ease;
  --nav-h: 68px;
}

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

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

/* --- Layout --- */
.app-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

.main-content {
  flex: 1;
  padding-top: var(--nav-h);
  display: flex;
  flex-direction: column;
}

.content-container {
  flex: 1;
  width: 100%;
  padding: 2rem 2rem;
  animation: pageIn 0.35s ease forwards;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 24px rgba(0,0,0,0.35);
}

.nav-inner {
  width: 100%;
  height: 100%;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-brand:hover { text-decoration: none; }

.nav-logo-img {
  height: 52px;
  width: auto;
  display: block;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
  transition: opacity var(--transition), box-shadow var(--transition);
}
.nav-brand:hover .nav-logo-img {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  opacity: 0.9;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  flex: 1;
  position: relative;
}

.nav-pill {
  position: absolute;
  height: 34px;
  background: rgba(124, 58, 237, 0.45);
  border-radius: var(--radius-full);
  transition: left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
  top: 50%;
  transform: translateY(-50%);
  z-index: 0;
}

.nav-links li {
  position: relative;
  z-index: 1;
}

/* Hidden on desktop, shown inside mobile menu */
.nav-mobile-user { display: none; }

.nav-links li a,
.nav-links li .nav-link-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  color: var(--nav-text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.nav-links li a:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-links li a.active { color: #fff; background: transparent; }

.nav-backdrop { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: rgba(255,255,255,0.8);
  border-radius: 2px;
  transition: var(--transition);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #0F0A1E 0%, #1E1B4B 45%, #1e3a5f 100%);
  padding: 3rem 2rem 2.5rem;
  text-align: center;
  margin: -2.5rem -2rem 1.5rem;
}

.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 70% 10%, rgba(124,58,237,0.45) 0%, transparent 60%),
    radial-gradient(ellipse at 15% 90%, rgba(6,182,212,0.25) 0%, transparent 55%);
  pointer-events: none;
  animation: floatOrb 7s ease-in-out infinite;
}

.hero-dots {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(167,139,250,0.35);
  border-radius: var(--radius-full);
  padding: 0.28rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #C4B5FD;
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-title {
  font-family: 'Fredoka One', 'Inter', sans-serif;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.01em;
  margin-bottom: 1.1rem;
  min-height: 2.6em;
  background: linear-gradient(160deg, #fff 20%, #C4B5FD 70%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.05rem;
  color: #94A3B8;
  margin-bottom: 1.5rem;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-hero-primary {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--primary);
  color: white;
  padding: 0.82rem 2rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: var(--shadow-primary);
  border: none; cursor: pointer; font-family: inherit;
}
.btn-hero-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 14px 40px var(--primary-glow); text-decoration: none; color: white; }

.btn-hero-secondary {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: rgba(255,255,255,0.06);
  color: #C4B5FD;
  padding: 0.82rem 2rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer; font-family: inherit;
}
.btn-hero-secondary:hover { background: rgba(255,255,255,0.1); color: white; text-decoration: none; }

/* ============================================================
   FEATURE CARDS (Home)
   ============================================================ */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.5rem;
  transition: var(--transition);
}
.feature-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.feature-icon {
  width: 46px; height: 46px;
  background: var(--primary-light);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.feature-title { font-weight: 700; font-size: 0.95rem; color: var(--text); margin-bottom: 0.35rem; }
.feature-desc  { font-size: 0.85rem; color: var(--text-muted); line-height: 1.65; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}
.card:hover {
  box-shadow: 0 6px 28px rgba(0,0,0,0.13);
  transform: translateY(-1px);
}

.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body { padding: 1.5rem; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header { margin-bottom: 1.75rem; }

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}

.page-subtitle {
  margin-top: 0.35rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.38rem;
  letter-spacing: 0.01em;
}

.form-control,
input.form-control,
select.form-select,
.form-select {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder { color: var(--text-muted); }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 14px;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* Validation */
.valid.modified:not([type=checkbox]) { border-color: var(--success); }
.invalid { border-color: var(--danger) !important; }
.validation-message { color: var(--danger); font-size: 0.78rem; margin-top: 0.25rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.62rem 1.4rem;
  font-size: 0.975rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 130ms cubic-bezier(0.2,0,0,1),
              color 130ms cubic-bezier(0.2,0,0,1),
              border-color 130ms cubic-bezier(0.2,0,0,1),
              transform 130ms cubic-bezier(0.2,0,0,1),
              box-shadow 130ms cubic-bezier(0.2,0,0,1),
              opacity 130ms ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

/* Pressed / active state — instant tactile feedback */
.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.975) !important;
  box-shadow: none !important;
  transition-duration: 60ms;
}

/* Keyboard focus ring */
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--primary-glow);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--primary-light);
  color: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(220,38,38,0.3);
}

.btn-sm { padding: 0.38rem 0.85rem; font-size: 0.9rem; }
.btn-lg { padding: 0.82rem 2rem; font-size: 0.95rem; border-radius: var(--radius); }
.btn-full { width: 100%; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-sm); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-light); color: var(--success-text); border-color: var(--success-border); }
.alert-danger   { background: var(--danger-light);  color: var(--danger-text);  border-color: var(--danger-border); }
.alert-info     { background: var(--accent-light);  color: #0E7490; border-color: #A5F3FC; }

/* ============================================================
   RESULT BOX (post-creation)
   ============================================================ */
.result-section { animation: fadeUp 0.35s ease forwards; }

.result-url-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--primary-light);
  border: 1.5px solid #C4B5FD;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}

.result-url-text {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  word-break: break-all;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.copy-btn:hover { background: var(--primary-dark); }
.copy-btn.copied { background: var(--success); }

/* ============================================================
   QR CODE
   ============================================================ */
.qr-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-top: 1.25rem;
}

.qr-wrapper img {
  border-radius: var(--radius-sm);
  width: 180px; height: 180px;
}

.qr-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.table-scroll { overflow-x: auto; }

table.s-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.s-table thead th {
  background: var(--surface-2);
  padding: 0.8rem 1.1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.s-table tbody td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

table.s-table tbody tr:last-child td { border-bottom: none; }
table.s-table tbody tr:hover { background: var(--surface-2); }

/* ============================================================
   BADGES / CHIPS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-primary  { background: var(--primary-light); color: var(--primary-dark); }
.badge-success  { background: var(--success-light);  color: var(--success-text); }
.badge-muted    { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.7rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.link-pill:hover { background: var(--primary); color: white; text-decoration: none; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.45; }
.empty-state h4 { font-size: 1rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.875rem; }

/* ============================================================
   SELECTED LINK PREVIEW
   ============================================================ */
.link-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.link-preview-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.link-preview-row:last-child { margin-bottom: 0; }
.link-preview-row strong { color: var(--text); }

/* ============================================================
   LOADING / SPINNER
   ============================================================ */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes floatOrb {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-18px) scale(1.04); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: var(--shadow-primary); }
  50%       { box-shadow: 0 8px 40px rgba(124,58,237,0.55), 0 0 0 4px rgba(124,58,237,0.15); }
}

.fade-up { animation: fadeUp 0.3s ease forwards; }

/* Staggered feature cards */
.features-grid .feature-card {
  animation: fadeUp 0.4s ease forwards;
  opacity: 0;
}
.features-grid .feature-card:nth-child(1) { animation-delay: 0.05s; }
.features-grid .feature-card:nth-child(2) { animation-delay: 0.12s; }
.features-grid .feature-card:nth-child(3) { animation-delay: 0.19s; }
.features-grid .feature-card:nth-child(4) { animation-delay: 0.26s; }
.features-grid .feature-card:nth-child(5) { animation-delay: 0.33s; }
.features-grid .feature-card:nth-child(6) { animation-delay: 0.40s; }

/* Staggered table rows */
table.s-table tbody tr {
  animation: slideInLeft 0.3s ease forwards;
  opacity: 0;
}
table.s-table tbody tr:nth-child(1)  { animation-delay: 0.04s; }
table.s-table tbody tr:nth-child(2)  { animation-delay: 0.08s; }
table.s-table tbody tr:nth-child(3)  { animation-delay: 0.12s; }
table.s-table tbody tr:nth-child(4)  { animation-delay: 0.16s; }
table.s-table tbody tr:nth-child(5)  { animation-delay: 0.20s; }
table.s-table tbody tr:nth-child(6)  { animation-delay: 0.24s; }
table.s-table tbody tr:nth-child(7)  { animation-delay: 0.28s; }
table.s-table tbody tr:nth-child(8)  { animation-delay: 0.32s; }
table.s-table tbody tr:nth-child(9)  { animation-delay: 0.36s; }
table.s-table tbody tr:nth-child(10) { animation-delay: 0.40s; }

/* Pulsing glow only on the hero CTA, not every primary button */
.btn-hero-primary { animation: pulseGlow 2.8s ease-in-out infinite; }
.btn-hero-primary:hover { animation: none; }

/* ============================================================
   LIVE DOT
   ============================================================ */
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  50%       { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
  animation: livePulse 1.8s ease-in-out infinite;
}

@keyframes expiredPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

.expired-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
  animation: expiredPulse 1.8s ease-in-out infinite;
}

/* ============================================================
   HERO BADGE PULSE + ZAP
   ============================================================ */
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.5); }
  50%       { box-shadow: 0 0 0 7px rgba(167, 139, 250, 0); }
}

@keyframes zapFlicker {
  0%, 85%, 100% { opacity: 1; transform: scale(1); }
  88%            { opacity: 0.3; transform: scale(0.85); }
  92%            { opacity: 1; transform: scale(1.2); }
  96%            { opacity: 0.6; transform: scale(1); }
}

.hero-badge {
  animation: badgePulse 2.5s ease-in-out infinite;
}

.zap-icon {
  display: inline-block;
  animation: zapFlicker 3.5s ease-in-out infinite;
}

/* QR code pop-in */
@keyframes qrPopIn {
  from { opacity: 0; transform: scale(0.65) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.qr-wrapper {
  animation: qrPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s both;
}

/* Typewriter cursor */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.type-cursor {
  display: inline-block;
  width: 3px;
  height: 0.8em;
  background-color: #C4B5FD;
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: middle;
  animation: blink 0.75s step-end infinite;
}


/* ============================================================
   MISC
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 0.9rem; }
.fw-bold     { font-weight: 700; }
.mt-1        { margin-top: 0.5rem; }
.mt-2        { margin-top: 1rem; }
.mt-3        { margin-top: 1.5rem; }
.mb-1        { margin-bottom: 0.5rem; }
.mb-2        { margin-bottom: 1rem; }
.gap-1       { gap: 0.5rem; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.flex-wrap   { flex-wrap: wrap; }

/* ============================================================
   BLAZOR ERROR UI
   ============================================================ */
#blazor-error-ui {
  background: var(--danger);
  color: white;
  bottom: 0; left: 0; right: 0;
  padding: 0.7rem 1.25rem;
  position: fixed;
  display: none;
  z-index: 9999;
  font-size: 0.875rem;
  align-items: center;
  gap: 1rem;
}
#blazor-error-ui .reload { color: white; font-weight: 700; text-decoration: underline; }
#blazor-error-ui .dismiss { cursor: pointer; margin-left: auto; opacity: 0.75; }

/* ============================================================
   RESPONSIVE — NAV (hamburger at tablet / small laptop)
   ============================================================ */
@media (max-width: 1024px) {
  .nav-inner { padding: 0 1rem; gap: 1rem; }

  .nav-toggle { display: flex; }

  .nav-pill { display: none; }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 999;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h); left: 0; right: 0;
    background: var(--nav-bg);
    flex-direction: column;
    padding: 0.75rem 1rem 1rem;
    gap: 2px;
    border-top: 1px solid var(--nav-border);
    box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  }

  .nav-links.open { display: flex; }

  .nav-links li { width: 100%; }
  .nav-links li a { width: 100%; padding: 0.65rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem; }
  .nav-links li a.active { background: rgba(124,58,237,0.45); color: #fff; }

  .nav-mobile-user { display: block; }
  .nav-mobile-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--nav-border);
    gap: 0.75rem;
  }
  .nav-mobile-username {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.65);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nav-mobile-logout {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.3rem 0.65rem;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    flex-shrink: 0;
  }
  .nav-mobile-logout:hover { color: white; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.45); text-decoration: none; }
}

/* Desktop: hero fills remaining space so no gap at bottom */
@media (min-width: 1025px) {
  .content-container {
    display: flex;
    flex-direction: column;
  }
  .hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .hero-inner {
    width: 100%;
  }
}

/* ============================================================
   RESPONSIVE — CONTENT
   ============================================================ */
@media (max-width: 720px) {
  .content-container { padding: 1.5rem 1rem; animation: none; }

  .hero {
    padding: 4rem 1rem 3.5rem;
    margin: -1.5rem -1rem 2.5rem;
  }

  .hero-title { min-height: 2.8em; }

  .page-title { font-size: 1.4rem; }

  .features-grid { grid-template-columns: 1fr; }

  .create-grid { grid-template-columns: 1fr !important; }

  .result-url-row { flex-direction: column; align-items: flex-start; }
  .copy-btn { align-self: flex-start; }

  table.s-table th,
  table.s-table td { padding: 0.7rem 0.75rem; font-size: 0.875rem; }

  .stats-row { grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }
  .stat-value { font-size: 1.2rem; }

  .manage-layout { grid-template-columns: 1fr; }

  .toast-container { right: 1rem; bottom: 1rem; left: 1rem; width: auto; max-width: none; }
}

@media (max-width: 480px) {
  .hero {
    min-height: calc(100dvh - var(--nav-h));
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .hero-inner { width: 100%; }

  .stats-row { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.55rem; }
  .hero-title { font-size: 2.2rem; min-height: 3em; }
  .hero-badge { font-size: 0.72rem; }
  .page-title { font-size: 1.25rem; }
  .btn-lg { padding: 0.7rem 1.4rem; font-size: 0.9rem; }

  /* Nav: scale wide logo down so guest buttons fit on small phones */
  .nav-inner { gap: 0.5rem; }
  .nav-logo-img { height: 38px; }
  .nav-guest-actions { gap: 0.25rem; margin-right: 0; }
  .nav-guest-actions .btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 360px;
  width: calc(100vw - 3rem);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.78rem 1rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  pointer-events: all;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-success { border-left-color: var(--success); }
.toast-danger  { border-left-color: var(--danger); }
.toast-info    { border-left-color: var(--accent); }

.toast-icon { font-size: 0.95rem; font-weight: 800; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-danger  .toast-icon { color: var(--danger); }
.toast-info    .toast-icon { color: var(--accent); }

.toast-text { flex: 1; color: var(--text); line-height: 1.4; }

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition: var(--transition);
  flex-shrink: 0;
  line-height: 1;
}
.toast-close:hover { background: var(--surface-2); color: var(--text); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(calc(100% + 1.5rem)); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton-line {
  border-radius: 6px;
  background: linear-gradient(90deg,
    var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 1200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  height: 13px;
  margin-bottom: 0.4rem;
}
.skeleton-line.wide   { width: 75%; }
.skeleton-line.mid    { width: 50%; }
.skeleton-line.narrow { width: 30%; }
.skeleton-line.tall   { height: 18px; }

.skeleton-row {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.skeleton-row:last-child { border-bottom: none; }

/* ============================================================
   MEDAL BADGES
   ============================================================ */
.badge-gold   { background: #FEF9C3; color: #78350F; border: 1px solid #FDE68A; }
.badge-silver { background: #F1F5F9; color: #334155; border: 1px solid #CBD5E1; }
.badge-bronze { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }

/* ============================================================
   CLICK BAR
   ============================================================ */
.click-bar-wrap { display: flex; flex-direction: column; gap: 4px; }
.click-count    { font-size: 0.875rem; font-weight: 700; color: var(--text-secondary); }

.click-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 9999px;
  overflow: hidden;
  min-width: 60px;
}
.click-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 9999px;
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================
   STATS SUMMARY ROW
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
  word-break: break-all;
}

/* ============================================================
   TABLE COPY BUTTON
   ============================================================ */
.table-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  margin-left: 0.4rem;
  vertical-align: middle;
}
.table-copy-btn:hover { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.table-copy-btn.copied { background: var(--success-light); color: var(--success-text); border-color: var(--success-border); }

/* ============================================================
   EXPIRY CHIP
   ============================================================ */
.expiry-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.7rem;
  background: var(--accent-light);
  color: #0E7490;
  border: 1px solid #A5F3FC;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ============================================================
   SEARCHABLE LINK PICKER
   ============================================================ */
.link-picker-results {
  max-height: 230px;
  overflow-y: auto;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-top: 0.4rem;
  box-shadow: var(--shadow);
  scroll-behavior: smooth;
}

.link-picker-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.link-picker-item:last-child { border-bottom: none; }
.link-picker-item:hover      { background: var(--primary-light); }
.link-picker-item.selected   { background: var(--primary-light); border-left: 3px solid var(--primary); }

.link-picker-code { font-size: 0.95rem; font-weight: 700; color: var(--primary-dark); }
.link-picker-url  { font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.link-picker-empty { padding: 1.1rem; text-align: center; color: var(--text-muted); font-size: 0.95rem; }

/* ============================================================
   INLINE DELETE CONFIRM
   ============================================================ */
.confirm-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  animation: fadeUp 0.18s ease forwards;
}
.confirm-label {
  font-size: 0.875rem;
  color: var(--danger-text);
  font-weight: 600;
  word-break: break-all;
  flex: 1 1 100%;
}

/* ============================================================
   EVENT BADGE (history)
   ============================================================ */
.event-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.event-created  { background: var(--primary-light); color: var(--primary-dark); }
.event-modified { background: var(--success-light);  color: var(--success-text); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 0.4rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.page-btn:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.page-ellipsis { color: var(--text-muted); font-size: 0.9rem; padding: 0 0.2rem; line-height: 34px; }

/* ============================================================
   SMOOTH ENHANCEMENTS
   ============================================================ */
.card { transition: box-shadow var(--transition); }

/* .btn transition is defined in the button block above */

input.form-control, select.form-select {
  transition: border-color var(--transition), box-shadow var(--transition);
}

.link-pill { transition: background var(--transition), color var(--transition); }

.nav-toggle span { transition: transform 0.25s ease, opacity 0.2s ease; }
.nav-toggle-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.table-shell { transition: box-shadow var(--transition); }
table.s-table tbody tr { transition: background var(--transition); }

/* ============================================================
   CREATE URL GRID
   ============================================================ */
.create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.create-grid.single {
  grid-template-columns: 1fr;
}

/* ============================================================
   MANAGE PAGE LAYOUT
   ============================================================ */
.manage-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 1.25rem;
  align-items: start;
}

.manage-layout > * { min-width: 0; }

.manage-layout.no-panel { grid-template-columns: 1fr; }

/* Desktop: pin QR to column 2, spanning all rows */
.manage-qr-panel {
  grid-column: 2;
  grid-row: 1 / span 10;
  width: 100%;
}

/* Desktop: left-column cards stay in column 1 */
.manage-picker,
.manage-info,
.manage-update,
.manage-danger { grid-column: 1; }

@media (max-width: 860px) {
  .manage-layout,
  .manage-layout.no-panel {
    grid-template-columns: 1fr;
  }

  /* Mobile order: Picker → Info → QR → Update → Danger */
  .manage-picker  { order: 1; }
  .manage-info    { order: 2; }
  .manage-qr-panel { grid-column: 1; grid-row: auto; order: 3; }
  .manage-update  { order: 4; }
  .manage-danger  { order: 5; }
}

/* ============================================================
   GLOBAL SMOOTHNESS
   ============================================================ */
html { scroll-behavior: smooth; }

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ─── Scroll reveal ─── */
.scroll-out {
  opacity: 0;
  transform: translateY(28px);
}

/* ─── Smoother transitions on interactive elements ─── */
a       { transition: color 0.15s ease, opacity 0.15s ease; }
input, select, textarea { transition: border-color 0.18s ease, box-shadow 0.18s ease; }

/* ─── Focus / keyboard navigation ─── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@keyframes pageFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.content-container {
  animation: pageFade 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ============================================================
   UTILITY CLASSES (replaces scattered inline styles)
   ============================================================ */
.card-header-danger { color: var(--danger); }

.qr-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.search-bar { margin-bottom: 1rem; }

/* ============================================================
   AUTH PAGES (Login / Register)
   ============================================================ */
.auth-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  display: flex;
  justify-content: center;
  padding: 1.5rem 1.5rem 0;
}

.auth-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 500;
}

/* Nav user area */
.nav-user-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  margin-right: 0.5rem;
}

.nav-username {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.25);
}
.nav-logout:hover:not(:disabled) {
  color: white;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.45);
}

/* Hide desktop user-area when hamburger is active (must come after base definition) */
@media (max-width: 1024px) {
  .nav-user-area { display: none; }
}

.nav-guest-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  margin-right: 0.5rem;
}

/* Sign in button needs white text/border on the dark nav background */
.nav-guest-actions .btn-ghost {
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.25);
}
.nav-guest-actions .btn-ghost:hover:not(:disabled) {
  color: white;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.45);
}
