@charset "UTF-8";

:root {
  --bg: #f8fafc;
  --bg-secondary: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-dark: #1e40af;
  --border: #e2e8f0;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition-fast: 0.15s ease;
  --transition: 0.2s ease;
}

html.dark {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --card: #1e293b;
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --border: #334155;
  --primary-light: rgba(37, 99, 235, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", "system-ui", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background-color var(--transition), color var(--transition);
}

html.dark body {
  background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
}

.profile-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部导航 */
.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

html.dark .profile-header {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(12px);
}

.profile-header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.profile-back-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.profile-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.profile-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

html.dark .theme-toggle-btn {
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
}

/* 主内容区 */
.profile-main {
  flex: 1;
  display: flex;
  padding: 24px 32px;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* 左侧菜单 */
.profile-sidebar {
  width: 220px;
  flex-shrink: 0;
}

.profile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: calc(100% - 400px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  position: sticky;
  top: 100px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.dark .profile-nav {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.profile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.profile-nav-item:hover {
  background: var(--bg-secondary);
  color: var(--primary);
}

html.dark .profile-nav-item:hover {
  background: rgba(37, 99, 235, 0.1);
}

.profile-nav-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* 右侧内容区 */
.profile-content {
  flex: 1;
  min-width: 0;
}

.profile-section {
  display: none;
}

.profile-section.active {
  display: block;
}

/* 卡片样式 */
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

html.dark .profile-card {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(8px);
}


.profile-card-body {
  padding: 28px;
}

.profile-card-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 头像区域 */
.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar-edit-btn {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.profile-avatar-edit-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.profile-avatar-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-avatar-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.profile-avatar-role {
  display: inline-block;
  padding: 4px 12px;
  background: var(--primary-light);
  border-radius: 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  width: fit-content;
}

/* 表单样式 */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.profile-settings-group {
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.profile-settings-group:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.profile-settings-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
  padding-left: 12px;
  border-left: 3px solid var(--primary);
}

.profile-field {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.profile-field:last-child {
  margin-bottom: 0;
}

.profile-field-label {
  width: 100px;
  flex-shrink: 0;
  padding-top: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.profile-field-value {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-input,
.profile-select {
  width: 100%;
  max-width: 280px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  transition: all var(--transition-fast);
}

.profile-input:focus,
.profile-select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card);
}

html.dark .profile-input,
html.dark .profile-select {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}

.profile-field-readonly {
  width: 100%;
  max-width: 280px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
}

.profile-field-hint {
  font-size: 12px;
  color: var(--muted);
}

/* 按钮样式 */
.profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.profile-btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.profile-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.profile-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.profile-btn-secondary {
  background: var(--bg-secondary);
  color: var(--muted);
  border: 1px solid var(--border);
}

.profile-btn-secondary:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* 状态提示 */
.profile-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  padding: 14px 24px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  z-index: 1100;
  opacity: 1;
  transition: all var(--transition);
}

.profile-toast.hidden {
  top: -100px;
  opacity: 0;
}

.profile-toast.success {
  border-left: 4px solid var(--success);
  color: #15803d;
}

html.dark .profile-toast.success {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
}

.profile-toast.error {
  border-left: 4px solid var(--danger);
  color: #b91c1c;
}

html.dark .profile-toast.error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

/* 响应式 */
@media screen and (max-width: 768px) {
  .profile-header {
    padding: 12px 16px;
  }

  .profile-title {
    font-size: 16px;
  }

  .profile-main {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }

  .profile-sidebar {
    width: 100%;
  }

  .profile-nav {
    flex-direction: row;
    position: static;
    overflow-x: auto;
  }

  .profile-nav-item {
    white-space: nowrap;
    padding: 10px 14px;
  }

  .profile-card-header,
  .profile-card-body,
  .profile-card-footer {
    padding: 20px;
  }

  .profile-field {
    flex-direction: column;
    gap: 8px;
  }

  .profile-field-label {
    width: auto;
    padding-top: 0;
  }

  .profile-input,
  .profile-select,
  .profile-field-readonly {
    max-width: 100%;
  }

  .profile-avatar-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

@media screen and (max-width: 480px) {
  .profile-header-left {
    gap: 12px;
  }

  .profile-back-btn span {
    display: none;
  }

  .profile-back-btn {
    padding: 8px 10px;
  }

  .profile-avatar-large {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }

  .profile-avatar-name {
    font-size: 18px;
  }
}

/* 密码行样式 */
.profile-password-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-password-row .profile-field-readonly {
  flex: 1;
}

.profile-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.profile-edit-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* 问号悬浮提示 */
.profile-label-tooltip {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: var(--muted);
  cursor: help;
  position: relative;
}

.profile-label-tooltip:hover {
  color: var(--primary);
}

.profile-label-tooltip::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 10;
}

html.dark .profile-label-tooltip::after {
  background: var(--bg-secondary);
}

.profile-label-tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* 弹窗样式 */
.profile-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.profile-modal.hidden {
  display: none;
}

.profile-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.profile-modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.profile-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.profile-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.profile-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.profile-modal-body {
  padding: 28px 32px;
}

.profile-modal-field {
  margin-bottom: 24px;
}

.profile-modal-field:last-child {
  margin-bottom: 0;
}

.profile-modal-label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.profile-modal-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  transition: all var(--transition-fast);
}

.profile-modal-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card);
}

html.dark .profile-modal-input {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}

.profile-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 32px;
  border-top: 1px solid var(--border);
}

.profile-email-row {
  display: flex;
  gap: 12px;
}

.profile-email-row .profile-modal-input {
  flex: 1;
}

.profile-email-row .profile-btn {
  white-space: nowrap;
  padding: 0 16px;
}

/* 头像选择弹窗 */
.profile-avatar-modal-content {
  max-width: 400px;
}

.profile-avatar-upload-modal-content {
  max-width: 420px;
}

.profile-avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 8px 0;
}

.profile-avatar-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.profile-avatar-option:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.profile-avatar-option.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.profile-avatar-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.profile-avatar-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.profile-avatar-upload-btn:hover {
  background: var(--primary-dark, #1d4ed8);
}

.profile-avatar-upload-btn svg {
  width: 20px;
  height: 20px;
}

.profile-avatar-upload-hint {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}

.profile-avatar-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}

.profile-avatar-divider::before,
.profile-avatar-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color, #e5e7eb);
}
