/* 头部样式统一使用 css/header.css（与首页保持一致） */

/* Profile Layout */
.profile-layout {
    padding: 160px 0 40px 0;
    min-height: calc(100vh - 130px);
}

.profile-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Sidebar */
.profile-sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: fit-content;
}

.sidebar-nav {
    width: 100%;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    font-size: 15px;
    color: #666;
}

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

.menu-item.active {
    background: #ff6d31;
    color: #fff;
}

.menu-icon {
    display: none;
}

.menu-item.active .menu-icon {
    opacity: 1;
}

/* Content Area */
.profile-content {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 600px;
}

.content-tab {
    display: none;
}

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

/* Profile Card */
.profile-card {
    max-width: 600px;
}

.profile-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 32px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

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

.form-row input,
.form-row select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: #ff6d31;
}

.avatar-row {
    flex-direction: row;
    align-items: center;
    gap: 24px;
}

.avatar-uploader {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-uploader img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e0e0e0;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-danger {
    background: #ff4444;
    color: #fff;
}

.btn-danger:hover {
    background: #e63939;
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

/* 注销确认弹窗样式 */
.cancel-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.cancel-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    box-sizing: border-box;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cancel-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.cancel-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cancel-modal-body {
    padding: 20px 24px;
}

.cancel-modal-body p {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #666;
}

.cancel-modal-body p:last-child {
    margin-bottom: 0;
}

.warning-text {
    color: #ff4444 !important;
    font-weight: 500;
}

.cancel-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.cancel-modal-footer .btn {
    min-width: 100px;
    padding: 10px 20px;
    font-size: 14px;
    white-space: nowrap;
}

/* 为英文文本添加额外的间距和换行控制 */
html[lang="en"] .cancel-modal {
    max-width: 450px;
}

html[lang="en"] .cancel-modal-footer .btn {
    min-width: 120px;
}

/* 修改密码弹窗样式 */
.password-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.password-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 500px; /* 增加最大宽度以适应英文文本 */
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

.password-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.password-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.password-modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 24px; /* 增加间距 */
}

.form-group:last-child {
    margin-bottom: 0;
}

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

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #ff6d31;
    box-shadow: 0 0 0 3px rgba(255, 109, 49, 0.1);
}

.password-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.password-modal-footer .btn {
    min-width: 100px; /* 增加最小宽度 */
    padding: 10px 20px;
    font-size: 14px;
    white-space: nowrap;
}

/* 为英文文本添加额外的间距和换行控制 */
html[lang="en"] .form-group {
    margin-bottom: 24px;
}

html[lang="en"] .password-modal {
    max-width: 550px;
}

.btn-primary {
    background: #ff6d31;
    color: #fff;
}

.btn-primary:hover {
    background: #e55a2b;
}

.actions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid #f0f0f0;
}

/* Messages Card */
.messages-card {
    width: 100%;
    max-width: 100%;
}

.messages-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 32px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

/* Message Sub Navigation */
.msg-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.msg-tab {
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 999px;
    background: #fff;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.msg-tab:hover {
    border-color: #ff6d31;
    color: #ff6d31;
}

.msg-tab.active {
    background: #ff6d31;
    border-color: #ff6d31;
    color: #fff;
}

/* Overview Stats */
.msg-overview {
    margin-bottom: 16px;
}

.msg-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-item {
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 14px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-num {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 520px;
    overflow: auto;
    padding-right: 6px;
}

.message-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.message-item:hover {
    border-color: #ff6d31;
    box-shadow: 0 2px 8px rgba(255,109,49,0.1);
}

.message-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    flex: 1;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.message-sender {
    font-weight: 600;
    color: #333;
}

.message-time {
    font-size: 12px;
    color: #999;
}

.message-text {
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

/* Settings Card */
.settings-card {
    max-width: 100%;
}

.settings-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 32px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-size: 14px;
    color: #333;
    margin: 0;
}

/* Feedback */
.feedback-card {
    max-width: 100%;
}

.feedback-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 32px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.form-row textarea {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 120px;
}

.form-row textarea:focus {
    outline: none;
    border-color: #ff6d31;
}

/* 英文环境下的订单与权益订单标签优化（PC 端） */
html[lang="en"] .orders-tabs,
html[lang="en"] .equity-orders-tabs {
    gap: 8px;
}
html[lang="en"] .orders-tab,
html[lang="en"] .equity-orders-tab {
    white-space: nowrap;
}

/* Uploader */
.uploader {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.uploader-list {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.uploader-item {
    position: relative;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
    aspect-ratio: 1 / 1;
}

.uploader-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.uploader-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    background: #fff;
    color: #999;
    font-size: 28px;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    transition: all 0.2s ease;
}

.uploader-add:hover {
    border-color: #ff6d31;
    color: #ff6d31;
    background: #fff7f2;
}

.uploader-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
}

@media (max-width: 768px) {
    .uploader-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #4caf50;
}

.toast.error {
    background: #f44336;
}

/* Responsive */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }

    .profile-container {
        grid-template-columns: 1fr;
        gap: 8px;
        max-width: 100%;
        width: 100%;
        margin: 0;
    }
    
    .profile-sidebar {
        padding: 8px 10px 6px;
        box-shadow: none;
        background: transparent;
        margin: 0 -10px;
    }
    
    .profile-content {
        padding: 8px 10px 12px;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        margin: 0;
    }
    
    .avatar-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .menu-item {
        padding: 8px 12px;
        font-size: 13px;
        border: 1px solid #f1f1f1;
        background: #fff;
        margin-bottom: 0;
        flex: 0 0 auto;
    }

    .profile-layout {
        padding: calc(var(--header-height, 64px) + 2px) 8px 14px;
    }

    .msg-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .messages-list {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    /* 侧边菜单改为紧凑栅格，首屏完整展示 */
    .sidebar-menu {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
        gap: 6px;
        overflow: visible;
        padding: 0;
        margin: 0;
    }
    .menu-item {
        border-radius: 999px;
        white-space: nowrap;
        padding: 8px 10px;
        font-size: 12px;
        justify-content: center;
        box-shadow: none; /* 手机端选项卡不再有投影放大效果 */
    }
    .sidebar-menu .menu-item:hover {
        transform: none;      /* 手机端去掉选中上移效果 */
        box-shadow: none;
    }
    .menu-item.active {
        background: #ff6d31;
        color: #fff;
        border-color: #ff6d31;
        box-shadow: none; /* 选中仅颜色变化，不放大 */
    }
    .profile-content {
        margin-top: 6px;
    }

    /* 表单与内容卡片压缩内边距，避免横向拖动 */
    .profile-card,
    .drafts-card,
    .posts-card,
    .bids-card,
    .appointments-card,
    .orders-card,
    .equity-orders-card,
    .messages-card,
    .feedback-card,
    .settings-card {
        padding: 10px;
        border-radius: 10px;
    }
    .profile-card,
    .settings-card,
    .messages-card,
    .feedback-card {
        max-width: 100%;
        width: 100%;
    }
    .drafts-waterfall,
    .posts-grid,
    .drafts-card .drafts-waterfall {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    /* 个人资料及各模块标题在手机端的统一样式与间距压缩 */
    .profile-title,
    .posts-title,
    .drafts-title,
    .bids-title,
    .appointments-title,
    .orders-title,
    .equity-orders-title,
    .messages-title,
    .feedback-title,
    .settings-title {
        font-size: 18px;
        margin: 0 0 8px 0;
        padding-bottom: 6px;
    }
    /* 我的订单模块在手机端避免被右侧裁切，标签可自动换行 */
    .orders-card,
    .orders-list,
    #ordersEmptyState {
        width: 100%;
        box-sizing: border-box;
    }
    .orders-tabs {
        flex-wrap: nowrap;           /* 中文默认保持一行 */
        justify-content: space-between;
        gap: 6px;
        padding: 6px 4px;
        overflow-x: auto;            /* 若空间不足可横向滚动，避免断行 */
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }
    .orders-tab {
        flex: 1 1 24%;
        min-width: 70px;             /* 预留最小宽度，保证可读 */
        text-align: center;
        padding: 10px 8px;
        box-sizing: border-box;
        white-space: nowrap;
    }
    /* 英文环境下，订单标签改为两行排布，避免超出屏幕 */
    html[lang="en"] .orders-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
        justify-content: flex-start;
    }
    html[lang="en"] .orders-tab {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        white-space: normal;
        font-size: 12px;
        padding: 8px 6px;
    }

    /* 英文环境下，权益订单标签同样按两行排布，避免溢出 */
    .equity-orders-card,
    .equity-orders-list,
    #equityOrdersEmptyState {
        width: 100%;
        box-sizing: border-box;
    }
    html[lang="en"] .equity-orders-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
        justify-content: flex-start;
        gap: 6px;
        padding: 6px 4px;
    }
    html[lang="en"] .equity-orders-tab {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        white-space: normal;
        font-size: 12px;
        padding: 8px 6px;
    }
    .form-row {
        margin-bottom: 14px;
    }
    .avatar-row {
        margin-top: 2px;
        gap: 12px;
    }
    .avatar-uploader img {
        width: 68px;
        height: 68px;
    }

    /* 设置模块手机端压缩间距与布局 */
    .settings-card {
        padding: 10px;
        border-radius: 10px;
        box-shadow: none;
        background: #fff;
    }
    .settings-title {
        font-size: 18px;
        margin: 0 0 8px 0;
        padding-bottom: 6px;
    }
    .settings-section {
        padding: 12px;
        margin: 0 0 12px 0;
        border-radius: 10px;
        background: #fafafa;
        border: 1px solid #f0f0f0;
    }
    .settings-section h3 {
        font-size: 16px;
        margin: 0 0 12px 0;
        padding: 0;
    }
    .setting-item {
        padding: 12px 0;
        gap: 12px;
        align-items: center;
    }
    .setting-item label {
        font-size: 14px;
        color: #333;
        flex: 1 1 auto;
        min-width: 88px;          /* 预留标签宽度，避免换行 */
        white-space: nowrap;
    }
    .setting-item .btn {
        flex: 0 0 auto;
        min-width: 60px;
        max-width: 75px;
        padding: 8px 10px;
        font-size: 14px;
        border-radius: 8px;
        background: #ff6d31;
        color: #fff;
        border: 1px solid #ff6d31;
        line-height: 1.2;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
    .setting-item .btn-danger {
        width: 75px;
        min-width: 60px;
        max-width: 75px;
        padding: 8px 10px;
        font-size: 14px;
        border-radius: 8px;
        text-align: center;
        margin-left: 0;
        margin-right: 0;
        display: inline-flex;
        justify-content: center;
        align-items: center;
    }
}