/* ============================================================
   shortenurl.id — AUTH MODAL + USER NAV STATE
   ============================================================ */

/* ---------- Backdrop ---------- */
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(14, 20, 16, 0.45);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s cubic-bezier(.2,.85,.2,1);
}
.auth-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Card ---------- */
.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 36px 36px 32px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 30px 80px -20px rgba(14, 20, 16, 0.35),
    0 0 0 1px rgba(14, 20, 16, 0.04);
  transform: translateY(24px) scale(.96);
  opacity: 0;
  transition: transform .45s cubic-bezier(.2,.95,.18,1.02), opacity .35s ease;
}
.auth-backdrop.is-open .auth-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(212,255,58,.35), transparent 40%, rgba(74,43,217,.18));
  z-index: -1;
  filter: blur(20px);
  opacity: .55;
  pointer-events: none;
}

/* ---------- Close ---------- */
.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--ink);
  transition: background .15s ease, transform .15s ease, border-color .15s ease;
}
.auth-close:hover { background: var(--canvas); border-color: var(--ink); }
.auth-close:active { transform: scale(.92); }
.auth-close::before, .auth-close::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 1.5px;
  background: var(--ink);
}
.auth-close::before { transform: rotate(45deg); }
.auth-close::after  { transform: rotate(-45deg); }

/* ---------- Header ---------- */
.auth-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.auth-eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px rgba(212,255,58,.25);
}

.auth-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 3.4vw, 42px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 14px 0 6px;
}
.auth-title em {
  font-style: italic;
  color: var(--ink-soft);
}
.auth-sub {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 24px;
  line-height: 1.5;
}

/* ---------- Tabs ---------- */
.auth-tabs {
  display: inline-flex;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 24px;
  position: relative;
  isolation: isolate;
  width: 100%;
}
.auth-tabs::before {
  content: "";
  position: absolute;
  inset: 4px auto 4px 4px;
  width: calc(50% - 4px);
  background: var(--ink);
  border-radius: 999px;
  z-index: -1;
  transition: transform .45s cubic-bezier(.2,.85,.2,1);
}
.auth-tabs.signup::before { transform: translateX(100%); }
.auth-tabs button {
  flex: 1;
  padding: 10px 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color .3s ease;
  position: relative;
  z-index: 1;
}
.auth-tabs button.is-active { color: var(--paper); }

/* ---------- Fields ---------- */
.auth-form { display: grid; gap: 14px; }

.auth-field {
  position: relative;
}
.auth-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.auth-input {
  width: 100%;
  height: 50px;
  background: var(--canvas);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-md);
  padding: 0 16px;
  font-size: 15px;
  font-family: var(--font-mono);
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  outline: none;
}
.auth-input::placeholder { color: var(--ink-muted); }
.auth-input:focus {
  background: var(--paper);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(212,255,58,.35);
}

/* Password toggle (eye) */
.auth-field.with-toggle .auth-input { padding-right: 48px; }
.auth-toggle-eye {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: color .15s ease, background .15s ease;
}
.auth-toggle-eye:hover { color: var(--ink); background: var(--canvas); }
.auth-toggle-eye svg { width: 16px; height: 16px; }

/* ---------- Error / OK ---------- */
.auth-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(224, 67, 46, 0.08);
  border: 1px solid rgba(224, 67, 46, 0.25);
  color: #b1361f;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  animation: authShake .35s cubic-bezier(.36,.07,.19,.97);
}
.auth-msg.ok {
  background: rgba(31, 156, 77, 0.08);
  border-color: rgba(31, 156, 77, 0.25);
  color: #15793b;
  animation: none;
}
@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

/* ---------- Submit ---------- */
.auth-submit {
  height: 52px;
  font-size: 15px;
  font-weight: 500;
  margin-top: 6px;
  position: relative;
}
.auth-submit[disabled] { opacity: .65; cursor: progress; }
.auth-submit .spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Divider + alt ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.auth-alt {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.auth-alt button {
  height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color .15s ease, background .15s ease;
}
.auth-alt button:hover { border-color: var(--ink); }
.auth-alt button svg { width: 16px; height: 16px; }

/* ---------- Footer line ---------- */
.auth-foot {
  margin-top: 20px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink-muted);
  text-align: center;
  letter-spacing: 0.04em;
}
.auth-foot a { color: var(--ink); text-decoration: underline; }
.auth-foot.legal { font-size: 11px; line-height: 1.5; margin-top: 14px; }

/* ============================================================
   USER NAV STATE (logged in)
   ============================================================ */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 6px 0 14px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
  position: relative;
}
.user-chip:hover { border-color: var(--ink); }
.user-chip .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--signal);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.user-chip .email {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip .caret {
  width: 14px; height: 14px;
  color: var(--ink-muted);
  margin-right: 4px;
}

/* Dropdown */
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 6px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 20px 50px -16px rgba(14, 20, 16, 0.25);
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
}
.user-chip.is-open .user-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.user-menu .menu-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--hairline-soft);
  margin-bottom: 4px;
}
.user-menu .menu-head .em {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
}
.user-menu .menu-head .small {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 2px;
}
.user-menu a, .user-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink);
  transition: background .15s ease;
}
.user-menu a:hover, .user-menu button:hover { background: var(--canvas); }
.user-menu .sep {
  height: 1px;
  background: var(--hairline-soft);
  margin: 6px 0;
}
.user-menu .danger { color: #b1361f; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .auth-backdrop, .auth-card, .auth-msg { animation: none !important; transition: none !important; }
}

/* Mobile */
@media (max-width: 480px) {
  .auth-card { padding: 28px 24px 24px; border-radius: var(--r-md); }
  .auth-title { font-size: 30px; }
  .user-chip .email { display: none; }
}
