/* ═══════════════════════════════════════════
   Dreamscape — Auth Styles
   Magic-code sign-in panel
   ═══════════════════════════════════════════ */

/* ── Auth Button (topbar) ── */

.auth-wrapper {
  position: relative;
}

.auth-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}

.auth-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.auth-toggle.signed-in {
  padding: 3px;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  justify-content: center;
  border-color: var(--lavender);
  background: rgba(196, 181, 253, 0.1);
}

.auth-toggle.signed-in:hover {
  background: rgba(196, 181, 253, 0.2);
  box-shadow: 0 0 12px rgba(196, 181, 253, 0.15);
}

/* Avatar circle (signed-in initial) */
.auth-avatar {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--lavender);
  line-height: 1;
}

/* Sign-in label (signed-out) */
.auth-label {
  display: inline;
}

.auth-icon {
  font-size: 0.65rem;
  opacity: 0.7;
}

/* ── Auth Panel (dropdown) ── */

.auth-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 9999;
  width: 260px;
  padding: 16px;
  background: rgba(15, 10, 26, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(196, 181, 253, 0.12);
  border-radius: 12px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(196, 181, 253, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.auth-panel.open {
  display: block;
  animation: authFadeIn 0.2s var(--ease);
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Form Elements ── */

.auth-panel-title {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.auth-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input::placeholder {
  color: var(--text-secondary);
  font-weight: 400;
}

.auth-input:focus {
  border-color: rgba(196, 181, 253, 0.35);
  box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.08), 0 0 12px rgba(196, 181, 253, 0.06);
}

.auth-btn {
  width: 100%;
  padding: 8px 14px;
  margin-top: 8px;
  border: 1px solid rgba(196, 181, 253, 0.2);
  border-radius: 8px;
  background: rgba(196, 181, 253, 0.08);
  color: var(--lavender);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.auth-btn:hover {
  background: rgba(196, 181, 253, 0.15);
  border-color: rgba(196, 181, 253, 0.3);
  box-shadow: 0 0 12px rgba(196, 181, 253, 0.1);
}

.auth-btn:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* ── Google OAuth button ── */

.auth-btn--google {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  margin-top: 0;
}

.auth-btn--google:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.06);
}

.auth-btn--google svg {
  flex-shrink: 0;
}

/* ── Divider ── */

.auth-divider {
  display: flex;
  align-items: center;
  margin: 10px 0 6px;
  gap: 10px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: lowercase;
  letter-spacing: 0.5px;
}

.auth-btn--secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.auth-btn--secondary:hover {
  background: var(--overlay-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
  box-shadow: none;
}

.auth-btn--danger {
  border-color: rgba(253, 164, 175, 0.2);
  color: var(--rose);
  background: rgba(253, 164, 175, 0.06);
}

.auth-btn--danger:hover {
  background: rgba(253, 164, 175, 0.12);
  border-color: rgba(253, 164, 175, 0.3);
  box-shadow: 0 0 12px rgba(253, 164, 175, 0.08);
}

/* ── Sent-to hint ── */

.auth-sent-to {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.auth-sent-to strong {
  color: var(--moonlight);
  font-weight: 500;
}

/* ── Error message ── */

.auth-error {
  display: none;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(253, 164, 175, 0.08);
  border: 1px solid rgba(253, 164, 175, 0.15);
  color: var(--rose);
  font-size: 0.72rem;
  line-height: 1.4;
}

/* ── Signed-in state ── */

.auth-user-email {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-all;
  margin-bottom: 4px;
}

.auth-user-hint {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ── Light theme overrides ── */

[data-theme="light"] .auth-panel {
  background: rgba(237, 232, 242, 0.95);
  border-color: rgba(124, 58, 237, 0.15);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(124, 58, 237, 0.08);
}

[data-theme="light"] .auth-input {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(30, 15, 50, 0.12);
}

[data-theme="light"] .auth-input:focus {
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

[data-theme="light"] .auth-toggle {
  background: rgba(30, 15, 50, 0.03);
  border-color: rgba(30, 15, 50, 0.1);
}

[data-theme="light"] .auth-toggle:hover {
  background: rgba(30, 15, 50, 0.06);
}

[data-theme="light"] .auth-toggle.signed-in {
  border-color: var(--lavender);
  background: rgba(124, 58, 237, 0.08);
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  .auth-panel.open { animation: none; }
}
.reduce-motion .auth-panel.open { animation: none; }

/* ── Responsive ── */

@media (max-width: 600px) {
  .auth-panel {
    width: 220px;
    padding: 12px;
  }

  .auth-toggle:not(.signed-in) {
    padding: 5px 8px;
    font-size: 0.65rem;
  }

  .auth-label-text {
    display: none;
  }
}
