/* profile-drawer.css — 共享个人中心样式（首页 + 地图页共用） */

/* 个人中心抽屉 */
.profile-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 10000;
    opacity: 0; visibility: hidden; transition: all 0.3s;
}
.profile-overlay.active { opacity: 1; visibility: visible; }
.profile-drawer {
    position: fixed; top: 0; right: -400px; width: 380px; height: 100%;
    background: #fff; z-index: 10001; transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1); overflow-y: auto;
}
.profile-drawer.active { right: 0; }
.profile-drawer-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px; border-bottom: 1px solid #eee;
}
.profile-drawer-header h3 { margin: 0; font-size: 18px; color: #333; }
.profile-close-btn { background: none; border: none; font-size: 24px; color: #999; cursor: pointer; }
.profile-close-btn:hover { color: #333; }
.profile-drawer-body { padding: 20px; }
.profile-section { margin-bottom: 24px; }
.profile-section-title { font-size: 14px; color: #666; margin-bottom: 12px; font-weight: 600; }
.profile-avatar-large {
    width: 80px; height: 80px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 32px;
    color: #fff;
}
.profile-username-large { text-align: center; font-size: 18px; font-weight: 600; color: #333; }
.profile-account { text-align: center; font-size: 13px; color: #999; margin-top: 4px; }
.profile-edit-row { display: flex; gap: 8px; }
.profile-edit-row input {
    flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px;
}
.profile-save-btn {
    padding: 8px 16px; background: var(--primary, #0f4c5c); color: #fff; border: none;
    border-radius: 6px; cursor: pointer; font-size: 14px; white-space: nowrap;
}
.profile-save-btn:hover { opacity: 0.9; }
.password-field { margin-bottom: 14px; }
.password-field label { display: block; font-size: 12px; color: #888; margin-bottom: 4px; font-weight: 500; }
.password-field input {
    width: 100%; padding: 10px 12px; border: 1px solid #e0e0e0; border-radius: 8px;
    font-size: 14px; transition: border-color 0.2s; box-sizing: border-box;
}
.password-field input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,0.15); }
.profile-password-btn {
    width: 100%; padding: 10px; background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; border: none; border-radius: 8px; cursor: pointer;
    font-size: 14px; font-weight: 500; margin-top: 4px; transition: opacity 0.2s;
}
.profile-password-btn:hover { opacity: 0.9; }
.profile-logout-btn {
    width: 100%; padding: 12px; background: #fff; color: #e74c3c;
    border: 1px solid #e74c3c; border-radius: 6px; cursor: pointer;
    font-size: 14px; margin-top: 20px;
}
.profile-logout-btn:hover { background: #e74c3c; color: #fff; }
.profile-empty { text-align: center; color: #999; padding: 20px; font-size: 14px; }

/* Section折叠 */
.profile-section-header {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; padding: 10px 0; user-select: none;
}
.profile-section-header:hover { color: #667eea; }
.profile-section-arrow { font-size: 12px; transition: transform 0.2s; color: #999; }
.profile-section-arrow.expanded { transform: rotate(90deg); }
.profile-section-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.profile-section-content.expanded { max-height: 800px; }

/* 地图列表 */
.profile-room-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; border: 1px solid #eee; border-radius: 6px;
    margin-bottom: 8px; cursor: pointer; transition: background 0.2s;
}
.profile-room-item:hover { background: #f5f5f5; }
.profile-room-name { font-size: 14px; color: #333; font-weight: 500; }
.profile-room-meta { font-size: 12px; color: #999; }
.profile-room-type { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.profile-room-type.public { background: #e8f4fd; color: #2196f3; }
.profile-room-type.private { background: #fff3e0; color: #ff9800; }
.profile-room-id { font-size: 11px; color: #ff9800; margin-top: 2px; font-family: monospace; }

/* 地图操作按钮 */
.room-manage-icon { font-size: 11px; color: #999; cursor: pointer; margin-left: 4px; transition: color 0.2s; vertical-align: middle; }
.room-manage-icon:hover { color: #667eea; }
.room-delete-btn { background: none; border: none; color: #ccc; cursor: pointer; width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; }
.room-delete-btn:hover { color: #ff4757; background: #fff0f0; }
.room-leave-btn { background: rgba(255,165,2,0.1); color: #ffa502; border: none; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; transition: background 0.2s; }
.room-leave-btn:hover { background: rgba(255,165,2,0.2); }

/* 头像 */
.avatar-wrapper { position: relative; width: 80px; height: 92px; margin: 0 auto 12px; }
.avatar-edit-btn {
    position: absolute; bottom: 0; right: 0; width: 26px; height: 26px; border-radius: 50%;
    background: #667eea; color: #fff; border: 2px solid #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15); transition: transform 0.2s;
}
.avatar-edit-btn:hover { transform: scale(1.1); }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.avatar-option { width: 52px; height: 52px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: border-color 0.2s, transform 0.2s; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.avatar-option:hover { border-color: #667eea; transform: scale(1.08); }
.avatar-option.selected { border-color: #667eea; }

/* 成员管理 */
.room-member-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #f8f9fa; border-radius: 8px; margin-bottom: 6px; }
.room-member-item .member-name { font-size: 14px; color: #333; }
.room-member-item .kick-btn { background: none; border: none; color: #ccc; cursor: pointer; font-size: 12px; padding: 4px 8px; border-radius: 4px; transition: all 0.2s; }
.room-member-item .kick-btn:hover { color: #ff4757; background: #fff0f0; }

/* 小信箱 */
.mailbox-item { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.2s; }
.mailbox-item:hover { background: #f7f8fa; }
.mailbox-item:last-child { border-bottom: none; }
.mailbox-unread { background: #fef9f9; }

/* Profile Drawer 内嵌弹窗（地图管理/选择头像）- 使用独立类名避免与地图页 .modal 冲突 */
.drawer-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 10002; display: flex; align-items: center; justify-content: center; }
.drawer-modal.hidden { display: none; }
.drawer-modal-content { background: #fff; border-radius: 16px; padding: 24px; width: 400px; max-width: 90vw; max-height: 80vh; overflow-y: auto; }

@media (max-width: 480px) { .profile-drawer { width: 100%; right: -100%; } }

/* 头像未读消息红点 - 使用 data-unread 属性 + ::after 伪元素 */
/* 这样 updateAuthUI 的 innerHTML 不会清除红点 */
.header-profile-btn,
.user-info {
  position: relative;
}
.header-profile-btn[data-unread]::after,
.user-info[data-unread]::after {
  content: attr(data-unread);
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff4757;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 10;
}
