/**
 * [INPUT]: 无外部依赖
 * [OUTPUT]: 认证模块样式，登录/注册表单
 * [POS]: 前端样式模块，被 index.html 引用，配合 auth.js
 * [PROTOCOL]: 变更时更新此头部，然后检查 /CLAUDE.md
 *
 * 内容: 认证模态框, 登录表单, 注册表单, 验证码输入, 用户菜单
 */

/* Auth Modal */
#authModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

#authModal.active {
    display: flex;
}

.auth-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

.auth-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.auth-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.auth-modal-close:hover {
    color: #333;
}

/* Tab Navigation */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid #e5e5e5;
}

.auth-tab-btn {
    flex: 1;
    padding: 14px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab-btn:hover {
    background: #f9f9f9;
    color: #333;
}

.auth-tab-btn.active {
    color: #333;
    border-bottom-color: #333;
}

/* Tab Content */
.auth-tab-content {
    display: none;
    padding: 24px;
}

.auth-tab-content.active {
    display: block;
}

/* Form Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.auth-form-group input {
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.auth-form-group input:focus {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.auth-form-group input::placeholder {
    color: #999;
}

/* Code Input Group */
.auth-code-group {
    display: flex;
    gap: 10px;
}

.auth-code-group input {
    flex: 1;
}

.auth-code-btn {
    padding: 12px 16px;
    background: #333;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.auth-code-btn:hover:not(:disabled) {
    background: #555;
}

.auth-code-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Checkbox */
.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.auth-checkbox input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.auth-checkbox span {
    font-size: 14px;
    color: #666;
}

/* Submit Button */
.auth-submit-btn {
    padding: 14px;
    background: #333;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.auth-submit-btn:hover:not(:disabled) {
    background: #555;
}

.auth-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Error Message */
.auth-error {
    display: none;
    padding: 12px;
    background: #fff3f3;
    border: 1px solid #ffcdd2;
    border-radius: 6px;
    color: #c62828;
    font-size: 13px;
}

/* Links */
.auth-link {
    text-align: center;
    margin-top: 8px;
}

.auth-link a {
    color: #666;
    font-size: 13px;
    text-decoration: none;
}

.auth-link a:hover {
    color: #333;
    text-decoration: underline;
}

/* User Section in Sidebar */
.user-section {
    padding: 16px;
    margin-top: 16px;
    border-top: 1px solid #e5e5e5;
}

.user-logged-out {
    text-align: center;
}

.user-login-btn {
    width: 100%;
    padding: 12px;
    background: #333;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.user-login-btn:hover {
    background: #555;
}

.user-logged-in {
    display: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e5e5;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-nickname {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.user-menu-item:hover {
    background: #f5f5f5;
}

.user-menu-item svg {
    width: 18px;
    height: 18px;
    color: #666;
}

.user-menu-item.logout {
    color: #c62828;
}

.user-menu-item.logout svg {
    color: #c62828;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .auth-modal-content {
        width: 95%;
        max-height: 85vh;
        border-radius: 12px 12px 0 0;
        position: absolute;
        bottom: 0;
    }

    .auth-tab-content {
        padding: 20px;
    }

    .auth-code-group {
        flex-direction: column;
    }

    .auth-code-btn {
        width: 100%;
    }

    /* Hide user section in mobile sidebar */
    .sidebar .user-section {
        display: none;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====================================
   User Profile Modal Styles
   ==================================== */

/* Clickable User Info in Sidebar */
.user-info.user-info-clickable {
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
    padding: 10px;
    margin: -10px;
    margin-bottom: 0;
    border-bottom: none;
}

.user-info.user-info-clickable:hover {
    background: #f5f5f5;
}

.user-arrow {
    color: #999;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.user-info-clickable:hover .user-arrow {
    transform: translateX(3px);
    color: #666;
}

/* User Profile Modal */
.user-profile-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.user-profile-modal.active {
    display: flex;
}

.user-profile-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Profile Header */
.user-profile-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafafa;
}

.user-profile-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
    text-align: center;
}

.user-profile-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    width: 24px;
}

.user-profile-close:hover {
    color: #333;
}

.profile-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
}

.profile-back-btn:hover {
    color: #333;
}

/* Profile Card */
.user-profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-bottom: 1px solid #e5e5e5;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
    overflow: hidden;
}

.profile-nickname {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-email {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Profile Menu */
.user-profile-menu {
    padding: 12px 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.profile-menu-item:hover {
    background: #f5f5f5;
}

.profile-menu-item svg {
    color: #666;
    flex-shrink: 0;
}

.profile-menu-item .menu-text {
    flex: 1;
    font-size: 15px;
}

.profile-menu-item .menu-arrow {
    color: #ccc;
}

/* Profile Footer */
.user-profile-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e5e5;
}

.profile-logout-btn {
    width: 100%;
    padding: 12px;
    background: white;
    color: #c62828;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.profile-logout-btn:hover {
    background: #fff3f3;
    border-color: #ef9a9a;
}

.profile-logout-btn svg {
    color: #c62828;
}

/* Profile Edit View */
.profile-edit-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.profile-edit-body {
    padding: 24px 20px;
    flex: 1;
}

.profile-form-group {
    margin-bottom: 16px;
}

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

.profile-form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.profile-form-group input:focus {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.profile-form-group input::placeholder {
    color: #999;
}

.profile-error {
    display: none;
    padding: 12px;
    background: #fff3f3;
    border: 1px solid #ffcdd2;
    border-radius: 6px;
    color: #c62828;
    font-size: 13px;
    margin-top: 8px;
}

.profile-edit-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e5e5;
}

.profile-save-btn {
    width: 100%;
    padding: 14px;
    background: #333;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-save-btn:hover:not(:disabled) {
    background: #555;
}

.profile-save-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mobile Styles for Profile Modal */
@media (max-width: 768px) {
    .user-profile-content {
        width: 95%;
        max-height: 85vh;
        border-radius: 12px 12px 0 0;
        position: absolute;
        bottom: 0;
    }
}
