/* static/magic_link.css
   Styles for src/components/magic_link.rs
   - Header sign-in button / logged-in avatar + dropdown
   - Fullscreen OTP modal (email -> code -> username)
   - Works with your palette variables from static/colors.css (if present)
*/

:root{
  --auth-radius: 16px;
  --auth-radius-sm: 12px;

  --auth-bg: var(--bg, #0b0f14);
  --auth-elev: var(--bg-elevated, rgba(255,255,255,.04));
  --auth-elev-2: var(--bg-elevated-2, rgba(255,255,255,.06));
  --auth-border: var(--border, rgba(255,255,255,.12));
  --auth-text: var(--text, rgba(255,255,255,.92));
  --auth-muted: var(--muted, rgba(255,255,255,.66));

  --auth-primary: var(--accent, #67e8f9);
  --auth-danger: var(--danger, #ff5c7a);

  --auth-shadow: 0 18px 60px rgba(0,0,0,.55);
  --auth-ring: 0 0 0 3px rgba(103,232,249,.18);
}

/* =========================
   Header auth controls
   ========================= */

.auth-wrapper{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

/* Logged-in row */
.auth-logged-in{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .25rem .25rem .25rem .6rem;
  border: 1px solid var(--auth-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--auth-elev) 85%, transparent);
  backdrop-filter: blur(10px);
}

.user-email{
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .9rem;
  color: var(--auth-text);
  opacity: .9;
}

.avatar-btn{
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

/* Avatar bubble */
.avatar{
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--auth-border);
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.9);
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .04em;
  user-select: none;
}

/* Dropdown */
.profile-dropdown{
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  padding: .35rem;
  border-radius: var(--auth-radius-sm);
  border: 1px solid var(--auth-border);
  background: color-mix(in srgb, var(--auth-bg) 78%, rgba(0,0,0,.35));
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(14px);
  z-index: 2000;
}

.profile-item{
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .6rem .65rem;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--auth-text);
  text-decoration: none;
  font-size: .95rem;
  cursor: pointer;
}

.profile-item:hover{
  background: color-mix(in srgb, var(--auth-elev-2) 90%, transparent);
}

.profile-item.danger{
  color: color-mix(in srgb, var(--auth-danger) 85%, white 15%);
}

.profile-item.danger:hover{
  background: color-mix(in srgb, var(--auth-danger) 15%, transparent);
}

/* =========================
   Buttons (generic helpers)
   ========================= */

.btn{
  border: 1px solid var(--auth-border);
  background: color-mix(in srgb, var(--auth-elev) 90%, transparent);
  color: var(--auth-text);
  border-radius: 999px;
  padding: .6rem 1rem;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
}

.btn:hover{
  background: color-mix(in srgb, var(--auth-elev-2) 92%, transparent);
}

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

.btn.small{
  padding: .45rem .85rem;
  font-size: .9rem;
}

.btn.primary{
  border-color: color-mix(in srgb, var(--auth-primary) 35%, var(--auth-border));
  background: color-mix(in srgb, var(--auth-primary) 12%, var(--auth-elev));
}

.btn.primary:hover{
  background: color-mix(in srgb, var(--auth-primary) 16%, var(--auth-elev-2));
}

/* =========================
   Auth modal overlay
   ========================= */

.auth-overlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 5000;

  /* soft vignette */
  background:
    radial-gradient(1200px 700px at 50% 10%, rgba(103,232,249,.10), transparent 60%),
    radial-gradient(900px 500px at 80% 90%, rgba(124,58,237,.12), transparent 55%),
    rgba(0,0,0,.62);
  backdrop-filter: blur(10px);
}

.auth-modal{
  position: relative;
  width: min(440px, 92vw);
  border-radius: var(--auth-radius);
  border: 1px solid var(--auth-border);
  background: color-mix(in srgb, var(--auth-bg) 82%, rgba(0,0,0,.35));
  box-shadow: var(--auth-shadow);
  padding: 18px 18px 16px;
}

.auth-close{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--auth-border);
  background: color-mix(in srgb, var(--auth-elev) 88%, transparent);
  color: var(--auth-text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.auth-close:hover{
  background: color-mix(in srgb, var(--auth-elev-2) 92%, transparent);
}

/* Brand + title */
.auth-brand{
  display: flex;
  justify-content: center;
  margin-top: 6px;
  margin-bottom: 10px;
}

.auth-brand .badge{
  font-weight: 800;
  letter-spacing: .14em;
  font-size: .75rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--auth-primary) 40%, var(--auth-border));
  background: color-mix(in srgb, var(--auth-primary) 10%, var(--auth-elev));
  color: var(--auth-text);
  opacity: .95;
}

.auth-title{
  margin: 6px 0 4px;
  text-align: center;
  font-size: 1.25rem;
  color: var(--auth-text);
}

.auth-sub{
  margin: 0 0 14px;
  text-align: center;
  color: var(--auth-muted);
  font-size: .95rem;
}

/* Form fields */
.auth-modal form{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-row{
  display: flex;
  gap: 10px;
}

.auth-input{
  width: 100%;
  padding: .72rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--auth-border);
  background: color-mix(in srgb, var(--auth-elev) 90%, transparent);
  color: var(--auth-text);
  outline: none;
  font-size: 1rem;
}

.auth-input::placeholder{
  color: color-mix(in srgb, var(--auth-muted) 80%, transparent);
}

.auth-input:focus{
  border-color: color-mix(in srgb, var(--auth-primary) 45%, var(--auth-border));
  box-shadow: var(--auth-ring);
}

/* Primary / secondary buttons in modal */
.auth-primary,
.auth-secondary{
  width: 100%;
  padding: .72rem .9rem;
  border-radius: 12px;
  border: 1px solid var(--auth-border);
  cursor: pointer;
  font-size: 1rem;
}

.auth-primary{
  border-color: color-mix(in srgb, var(--auth-primary) 40%, var(--auth-border));
  background: color-mix(in srgb, var(--auth-primary) 16%, var(--auth-elev));
  color: var(--auth-text);
  font-weight: 700;
}

.auth-primary:hover{
  background: color-mix(in srgb, var(--auth-primary) 20%, var(--auth-elev-2));
}

.auth-secondary{
  background: transparent;
  color: var(--auth-muted);
}

.auth-secondary:hover{
  background: color-mix(in srgb, var(--auth-elev-2) 88%, transparent);
  color: var(--auth-text);
}

.auth-primary:disabled,
.auth-secondary:disabled{
  opacity: .55;
  cursor: not-allowed;
}

/* Notice / status line */
.auth-note{
  margin: 12px 2px 0;
  text-align: center;
  font-size: .92rem;
  color: var(--auth-muted);
  min-height: 1.2em;
}

/* Make numeric code feel nicer */
input[inputmode="numeric"].auth-input{
  letter-spacing: .18em;
  text-align: center;
  font-weight: 700;
}

/* Mobile tweaks */
@media (max-width: 520px){
  .user-email{ max-width: 120px; }
  .auth-modal{ padding: 16px 14px 14px; }
}
