/* ===== Auth UI — 登录按钮 + 用户头像 ===== */

/* Login button — Apple style */
.auth-login {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.auth-login:hover {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}

.auth-login svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* User area */
.auth-user {
  display: none;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
}

.auth-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  display: none;
}

.auth-user-name {
  font-size: 13px;
  color: var(--color-text);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown */
.auth-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.auth-dropdown.active {
  display: block;
}

.auth-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--color-text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.auth-dropdown-item:hover {
  background: var(--color-border);
}

/* ===== Profile Modal — 修改资料弹窗 ===== */

.profile-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.profile-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 320px;
  max-width: calc(100vw - 32px);
}

html[data-theme='dark'] .profile-modal {
  background: #1f2937;
}

.profile-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  color: #111;
}

html[data-theme='dark'] .profile-modal-title {
  color: #f3f4f6;
}

/* Avatar area */
.profile-modal-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.profile-modal-avatar {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  background: #f0f0f0;
  cursor: pointer;
  transition: opacity 0.2s;
}

.profile-modal-avatar:hover {
  opacity: 0.8;
}

html[data-theme='dark'] .profile-modal-avatar {
  background: #374151;
}

.profile-modal-hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}

html[data-theme='dark'] .profile-modal-hint {
  color: #9ca3af;
}

/* Nickname field */
.profile-modal-field {
  margin-bottom: 16px;
}

.profile-modal-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
}

html[data-theme='dark'] .profile-modal-label {
  color: #d1d5db;
}

.profile-modal-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.profile-modal-input::placeholder {
  color: #9ca3af;
}

.profile-modal-input:focus {
  border-color: #DD4C4F;
  box-shadow: 0 0 0 1px #DD4C4F;
}

html[data-theme='dark'] .profile-modal-input {
  background: #374151;
  border-color: #4b5563;
  color: #f3f4f6;
}

html[data-theme='dark'] .profile-modal-input::placeholder {
  color: #6b7280;
}

html[data-theme='dark'] .profile-modal-input:focus {
  border-color: #DD4C4F;
  box-shadow: 0 0 0 1px #DD4C4F;
}

/* Buttons */
.profile-modal-actions {
  display: flex;
  gap: 12px;
  padding-top: 16px;
}

.profile-modal-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.profile-modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-modal-btn-cancel {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #374151;
}

.profile-modal-btn-cancel:hover:not(:disabled) {
  background: #f9fafb;
}

html[data-theme='dark'] .profile-modal-btn-cancel {
  border-color: #4b5563;
  color: #d1d5db;
}

html[data-theme='dark'] .profile-modal-btn-cancel:hover:not(:disabled) {
  background: #374151;
}

.profile-modal-btn-confirm {
  background: #DD4C4F;
  color: #fff;
}

.profile-modal-btn-confirm:hover:not(:disabled) {
  background: #c43e41;
}

/* Responsive */
@media (max-width: 640px) {
  .auth-user-name {
    display: none;
  }
  .auth-login span {
    display: none;
  }
  .auth-login {
    padding: 6px 10px;
  }
}
