/* ══════════════════════════════════════════════
   SUMEI DAO — 用户系统 CSS
   ══════════════════════════════════════════════ */

/* ═══ Login/Register Button ═══ */
.auth-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 24px;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.auth-login-btn:hover {
  background: var(--gold);
  color: #111;
}

/* ═══ Auth Modal ═══ */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.auth-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.auth-modal {
  background: #1a1a1a;
  border: 1px solid rgba(201,169,110,0.15);
  border-radius: 16px;
  width: 420px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}
.auth-modal-overlay.open .auth-modal {
  transform: translateY(0);
}
.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}
.auth-close:hover { color: #fff; }

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 6px;
}
.auth-header p {
  color: #888;
  font-size: 0.85rem;
}

/* Auth tabs */
.auth-tab { display: none; }
.auth-tab.active { display: block; }

/* Fields */
.auth-field {
  margin-bottom: 18px;
}
.auth-field label {
  display: block;
  font-size: 0.8rem;
  color: #aaa;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--gold);
}

/* Role select */
.auth-role-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.auth-role-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  background: #111;
  border: 1.5px solid #333;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.auth-role-option input { display: none; }
.auth-role-option:hover { border-color: #555; }
.auth-role-option.active { border-color: var(--gold); background: rgba(201,169,110,0.07); }
.role-icon { font-size: 1.5rem; }
.role-label { font-size: 0.85rem; color: #fff; font-weight: 600; }
.role-desc { font-size: 0.7rem; color: #888; }

/* Error */
.auth-error {
  color: #ef4444;
  font-size: 0.8rem;
  margin-bottom: 12px;
  min-height: 18px;
}

/* Submit */
.auth-submit {
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: #111;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
  font-family: inherit;
}
.auth-submit:hover { background: #d4b678; transform: translateY(-1px); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: #888;
}
.auth-switch a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}
.auth-switch a:hover { text-decoration: underline; }

/* ═══ User Dropdown ═══ */
.user-dropdown {
  position: relative;
}
.user-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 24px;
  transition: background 0.2s;
  font-family: inherit;
}
.user-dropdown-trigger:hover {
  background: rgba(255,255,255,0.08);
}
.user-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(201,169,110,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  overflow: hidden;
}
.user-avatar-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#header-user-name {
  font-size: 0.82rem;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-msg-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #1a1a1a;
  border: 1px solid rgba(201,169,110,0.15);
  border-radius: 12px;
  min-width: 200px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 9999;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.user-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #ccc;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.82rem;
  transition: all 0.15s;
}
.dropdown-item:hover {
  background: rgba(201,169,110,0.1);
  color: var(--gold);
}
.dropdown-divider {
  height: 1px;
  background: #333;
  margin: 6px 0;
}
.dropdown-badge {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ═══ User Toast ═══ */
.user-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  background: #1a1a1a;
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: 10px;
  color: #fff;
  font-size: 0.85rem;
  z-index: 99999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.user-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.user-toast.error {
  border-color: #ef4444;
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .auth-modal { 
    padding: var(--space-6); 
    width: 95vw;
  }
  .auth-login-btn span { display: none; }
  #header-user-name { display: none; }
  .user-toast {
    right: 16px;
    left: 16px;
    bottom: 16px;
    text-align: center;
    display: flex;
    justify-content: center;
  }
}
@media (max-width: 480px) {
  .auth-role-select {
    grid-template-columns: 1fr;
  }
}
