/* ============================================================
   MetaLab Settings Styles — 个人设置页样式
   左侧导航 + 右侧卡片信息展示，只读
   ============================================================ */

/* ---------- Page Body ---------- */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Toast Notification ---------- */
.settings-toast {
    position: fixed;
    top: 55px; /* 紧贴导航栏下方 */
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: .6rem 1.5rem;
    font-size: .88rem;
    font-weight: 500;
    color: #fff;
    background: #2ecc71;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    max-width: calc(100% - 40px);
    white-space: nowrap;
}

.settings-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.settings-toast.error {
    background: #e74c3c;
}

/* ---------- Layout ---------- */
.settings-layout {
    display: flex;
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 20px;
    gap: 2rem;
}

/* ---------- Left Sidebar Nav ---------- */
.settings-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
    padding: 1.25rem 1rem;
    align-self: flex-start;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem 1rem;
    border-radius: var(--radius);
    font-size: .92rem;
    color: var(--color-secondary);
    font-weight: 500;
    transition: all .15s ease;
}

.settings-nav-item:hover {
    background: rgba(52, 152, 219, .06);
    color: var(--color-accent);
}

.settings-nav-item.active {
    background: rgba(52, 152, 219, .1);
    color: var(--color-accent);
    font-weight: 600;
}

.settings-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ---------- Right Content Area ---------- */
.settings-main {
    flex: 1;
    min-width: 0;
}

.settings-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
}

.settings-card-header {
    padding: 1.5rem 2rem 0;
}

.settings-card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: .3rem;
}

.settings-card-desc {
    font-size: .85rem;
    color: var(--color-text-light);
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
}

/* 审核状态提示 */
.settings-audit-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 2rem;
    background: #fff8e1;
    border-bottom: 1px solid #ffe082;
    color: #e65100;
    font-size: .85rem;
}

.settings-card-body {
    padding: 1.25rem 2rem 1.5rem;
}

/* ---------- Input Field ---------- */
.settings-text-input {
    width: 100%;
    max-width: 260px;
    padding: .45rem .7rem;
    font-size: .92rem;
    font-family: inherit;
    color: var(--color-text);
    background: #f9fafb;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.settings-text-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, .15);
    background: #fff;
}

/* ---------- Textarea Field ---------- */
.settings-textarea {
    width: 100%;
    max-width: 460px;
    height: 80px;
    padding: .5rem .7rem;
    font-size: .92rem;
    font-family: inherit;
    color: var(--color-text);
    background: #f9fafb;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    outline: none;
    resize: vertical;
    transition: border-color .15s ease, box-shadow .15s ease;
    line-height: 1.5;
}

.settings-textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, .15);
    background: #fff;
}

/* ---------- Character Counter ---------- */
.char-counter {
    font-size: .78rem;
    color: #aaa;
    margin-top: 4px;
    display: block;
}

/* ---------- Save Button ---------- */
.settings-card-footer {
    padding: 1rem 2rem 1.5rem;
    border-top: 1px solid var(--color-border);
    margin-top: .25rem;
}

.settings-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .55rem 1.5rem;
    font-size: .88rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--color-accent);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
}

.settings-save-btn:hover {
    background: #2980b9;
}

.settings-save-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* ---------- Info Rows ---------- */
.info-row {
    display: flex;
    align-items: flex-start;
    padding: .9rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    width: 100px;
    flex-shrink: 0;
    font-size: .88rem;
    color: var(--color-text-light);
    font-weight: 500;
    padding-top: 1px;
}

.info-value {
    flex: 1;
    font-size: .92rem;
    color: var(--color-text);
    min-width: 0;
    word-break: break-all;
}

.info-muted {
    color: #aaa;
}

.info-mono {
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    font-size: .85rem;
    background: #f5f5f5;
    padding: 1px 8px;
    border-radius: 4px;
}

/* ---------- Avatar Upload ---------- */
.avatar-upload-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    cursor: pointer;
    user-select: none;
}

.avatar-upload-wrap:hover .avatar-hint {
    opacity: 1;
}

.avatar-upload-wrap:hover .avatar-preview,
.avatar-upload-wrap:hover .avatar-placeholder {
    opacity: .7;
    border-color: var(--color-accent);
}

.avatar-preview {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
    transition: opacity .15s ease, border-color .15s ease;
}

.avatar-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f0f0f0;
    border: 2px dashed var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    transition: opacity .15s ease, border-color .15s ease;
}

.avatar-hint {
    font-size: .8rem;
    color: var(--color-accent);
    font-weight: 500;
    opacity: 0;
    transition: opacity .15s ease;
}

.avatar-input-hidden {
    display: none;
}

/* ---------- Crop Modal ---------- */
.crop-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.crop-overlay.active {
    display: flex;
}

.crop-dialog {
    background: var(--color-surface);
    border-radius: 12px;
    overflow: hidden;
    max-width: 94vw;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .15);
}

.crop-header {
    padding: .75rem 1.25rem;
    font-size: .9rem;
    color: var(--color-primary);
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.crop-stage {
    position: relative;
    width: min(85vw, 480px);
    height: min(85vw, 480px);
    overflow: hidden;
    background: #edf0f4;
    cursor: grab;
}

.crop-stage img {
    position: absolute;
    max-width: none;
    user-select: none;
    pointer-events: none;
}

/* 裁切框外的半透明暗色遮罩 */
.crop-mask {
    position: absolute;
    pointer-events: none;
    border-radius: 2px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45);
}

/* 裁切框白色边框（纯视觉，不可交互） */
.crop-frame {
    position: absolute;
    pointer-events: none;
    border: 2px solid #fff;
    border-radius: 2px;
    box-sizing: border-box;
}

/* 网格参考线 */
.crop-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, .3) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, .3) 1px, transparent 1px);
    background-size: 33.33% 33.33%;
}

.crop-footer {
    display: flex;
    gap: .75rem;
    padding: .75rem 1rem;
    border-top: 1px solid var(--color-border);
    justify-content: flex-end;
}

.crop-btn {
    padding: .45rem 1.25rem;
    font-size: .85rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s ease, opacity .15s ease;
}

.crop-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.crop-btn-cancel {
    background: #f0f0f0;
    color: var(--color-text-light);
}

.crop-btn-cancel:hover {
    background: #e0e0e0;
}

.crop-btn-confirm {
    background: var(--color-accent);
    color: #fff;
}

.crop-btn-confirm:hover {
    background: #2980b9;
}

/* ---------- Role Tag ---------- */
.role-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: .82rem;
    font-weight: 600;
}

.role-user    { background: #e3f2fd; color: #1976d2; }
.role-moderator { background: #e8f5e9; color: #2e7d32; }
.role-admin   { background: #fce4ec; color: #c62828; }
.role-owner   { background: #fff3e0; color: #e65100; }

/* ---------- Status Badge ---------- */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: .82rem;
    font-weight: 600;
}

.status-active  { background: #e8f5e9; color: #2e7d32; }
.status-banned  { background: #ffebee; color: #c62828; }
.status-deleted { background: #fff3e0; color: #e65100; }
.status-locked  { background: #eceff1; color: #546e7a; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .settings-layout {
        flex-direction: column;
        padding: 1rem 16px;
        gap: 1rem;
    }

    .settings-sidebar {
        width: 100%;
        align-self: auto;
    }

    .settings-nav {
        flex-direction: row;
        gap: 2px;
    }

    .settings-nav-item {
        padding: .5rem .9rem;
        font-size: .85rem;
    }

    .settings-card-header {
        padding: 1.25rem 1.25rem 0;
    }

    .settings-card-body {
        padding: 1rem 1.25rem 1.25rem;
    }
}

/* ---------- Form Group (Password / Delete) ---------- */
.settings-card + .settings-card {
    margin-top: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

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

.form-label {
    display: block;
    font-size: .85rem;
    color: var(--color-text-light);
    font-weight: 500;
    margin-bottom: .35rem;
}

.form-hint {
    font-size: .8rem;
    color: #bbb;
    margin-left: .75rem;
}

/* ---------- Danger Card (Delete Account) ---------- */
.settings-card-danger {
    border: 1px solid #ffcdd2;
}

.settings-card-danger .settings-card-header h2 {
    color: var(--color-danger);
}

.settings-danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .55rem 1.5rem;
    font-size: .88rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--color-danger);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
}

.settings-danger-btn:hover {
    background: #c0392b;
}

.settings-danger-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* ---------- Session Management ---------- */
.session-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.session-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.session-item.session-current {
    background: rgba(46, 204, 113, .04);
    margin: 0 -2rem;
    padding: 1.1rem 2rem;
    border-radius: 6px;
    border-bottom: none;
}

.session-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fa;
    border-radius: 10px;
    color: var(--color-text-light);
    margin-top: 2px;
}

.session-current .session-icon {
    background: rgba(46, 204, 113, .1);
    color: #2ecc71;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-title {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    margin-bottom: .3rem;
}

.session-browser {
    font-size: .92rem;
    font-weight: 600;
    color: var(--color-text);
}

.session-os {
    font-size: .85rem;
    color: var(--color-text-light);
}

.session-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 600;
    background: #e8f5e9;
    color: #2e7d32;
    margin-left: .2rem;
}

.session-meta {
    display: flex;
    gap: .8rem;
    flex-wrap: wrap;
    font-size: .8rem;
    color: #aaa;
    margin-bottom: .5rem;
}

.session-ip {
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    font-size: .78rem;
    background: #f5f5f5;
    padding: 1px 6px;
    border-radius: 3px;
}

.session-remark-row {
    margin-top: .25rem;
}

.session-remark-input {
    width: 100%;
    max-width: 320px;
    padding: .35rem .6rem;
    font-size: .82rem;
    font-family: inherit;
    color: var(--color-text);
    background: #f9fafb;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.session-remark-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, .15);
    background: #fff;
}

.session-remark-input[readonly] {
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.session-remark-input[readonly]:focus {
    box-shadow: none;
    border-color: transparent;
}

.session-action {
    flex-shrink: 0;
    align-self: center;
}

.session-kick-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .35rem .9rem;
    font-size: .82rem;
    font-weight: 600;
    font-family: inherit;
    color: #e74c3c;
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 5px;
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
}

.session-kick-btn:hover {
    background: #fee2e2;
    border-color: #e74c3c;
}

.session-kick-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.session-empty {
    text-align: center;
    padding: 2rem 0;
    color: #bbb;
    font-size: .9rem;
}

/* ---------- Session Responsive ---------- */
@media (max-width: 768px) {
    .session-item {
        flex-wrap: wrap;
        gap: .75rem;
    }

    .session-item.session-current {
        margin: 0 -1.25rem;
        padding: 1.1rem 1.25rem;
    }

    .session-action {
        width: 100%;
    }

    .session-kick-btn {
        width: 100%;
        justify-content: center;
    }

    .session-remark-input {
        max-width: 100%;
    }
}
