/* ========================================
   AI形象定制页面样式
   ======================================== */

/* 工作区布局 */
.avatar-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-lg);
}

/* 形象展示区 */
.avatar-display {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.avatar-canvas {
    width: 280px;
    height: 340px;
    position: relative;
    margin-bottom: var(--spacing-xl);
}

/* SVG AI形象 */
.ai-avatar-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(91, 155, 213, 0.2));
}

/* 头部基础样式 */
.avatar-head {
    fill: #FFE4C4;
}

.avatar-face-shape {
    fill: inherit;
}

/* 眼睛 */
.avatar-eye-left,
.avatar-eye-right {
    fill: #4A3728;
}

.avatar-eye-highlight {
    fill: white;
}

/* 嘴巴 */
.avatar-mouth {
    stroke: #D4766A;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
}

/* 腮红 */
.avatar-blush-left,
.avatar-blush-right {
    fill: #FFB5C2;
    opacity: 0.5;
}

/* 头发 */
.avatar-hair {
    fill: #2C1810;
}

.avatar-hair-back {
    fill: #2C1810;
}

/* 身体/衣服 */
.avatar-body {
    fill: #5B9BD5;
}

.avatar-clothes-detail {
    fill: white;
    opacity: 0.3;
}

/* 配饰 */
.avatar-glasses {
    fill: none;
    stroke: #333;
    stroke-width: 2;
}

.avatar-hat {
    fill: #8B4513;
}

.avatar-bow {
    fill: #FF69B4;
}

/* 操作按钮 */
.avatar-actions {
    display: flex;
    gap: var(--spacing-md);
}

/* 定制面板 */
.customize-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    max-height: 600px;
    overflow-y: auto;
}

/* 标签页导航 */
.panel-tabs {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

.tab-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all var(--transition-fast);
    font-family: inherit;
    position: relative;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: var(--bg-tertiary);
}

.tab-btn.active {
    color: var(--primary-color);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 3px 3px 0 0;
}

/* 标签页内容 */
.tab-content {
    animation: fadeIn 0.3s ease;
}

.tab-content h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    font-weight: 600;
}

.tab-content.hidden {
    display: none;
}

/* 选项网格 */
.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: var(--spacing-md);
}

.option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-primary);
}

.option-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.option-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(91, 155, 213, 0.1), rgba(139, 189, 233, 0.15));
    box-shadow: var(--shadow-sm);
}

.option-preview {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: var(--spacing-xs);
}

.option-card span {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.option-card.selected span {
    color: var(--primary-color);
}

/* 滑块样式 */
.slider-group {
    margin-bottom: var(--spacing-lg);
}

.slider-group label {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.custom-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    outline: none;
    transition: background var(--transition-fast);
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(91, 155, 213, 0.4);
    transition: transform var(--transition-fast);
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.custom-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(91, 155, 213, 0.4);
}

/* 颜色选择器 */
.color-options {
    margin-top: var(--spacing-lg);
}

.color-options label {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.color-palette {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.color-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all var(--transition-fast);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.color-dot:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-sm);
}

.color-dot.selected {
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.2), var(--shadow-sm);
}

/* 特定预览样式 */
.female-avatar { background: #FFF0F5; }
.male-avatar { background: #F0F8FF; }

.hair-style,
.clothes-preview,
.accessory-preview {
    font-size: 32px;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .avatar-workspace {
        grid-template-columns: 1fr;
    }

    .customize-panel {
        max-height: none;
    }
}

/* ========================================
   拟人化形象系统 v3.0 样式增强
   ======================================== */

/* 形象展示区 - 更大的画布 */
.avatar-canvas {
    width: 300px;
    height: 420px;
    position: relative;
}

/* 半写实SVG样式 */
.real-avatar-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.12));
}

/* 面板分区 */
.option-section {
    margin-bottom: var(--spacing-lg);
}

.option-section label {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.tab-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

/* 小型选项网格 */
.small-grid {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
}

.option-card.small {
    padding: var(--spacing-sm) var(--spacing-md);
}

.option-card.small span {
    font-size: 12px;
}

/* 角色预览 - 更真实风格 */
.character-preview {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: var(--spacing-xs);
    background: linear-gradient(135deg, #FFF5F0, #FFE8DD);
}

.character-preview.girl-char {
    background: linear-gradient(135deg, #FFF0F5, #F5E6FF);
}

.character-preview.boy-char {
    background: linear-gradient(135deg, #F0F8FF, #E6F2FF);
}

/* 表情网格 */
.expression-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.expr-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-primary);
}

.expr-option:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.expr-option.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(91, 155, 213, 0.1), rgba(139, 189, 233, 0.15));
}

.expr-emoji {
    font-size: 28px;
    margin-bottom: var(--spacing-xs);
}

.expr-option span {
    font-size: 12px;
    color: var(--text-secondary);
}

.expr-option.selected span {
    color: var(--primary-color);
    font-weight: 500;
}

/* 状态文字 */
.avatar-animation-status {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: linear-gradient(135deg, #FFF5F0, #FFEDE5);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: #C06030;
    text-align: center;
}

/* ========================================
   已购商品展示区（背包）
   ======================================== */
.owned-items-showcase {
    margin-top: var(--spacing-lg);
    width: 100%;
    max-width: 300px;
    background: linear-gradient(135deg, #F5F9FC, #F5F9FC);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    border: 1px dashed #FFD4B8;
}

.owned-items-showcase h5 {
    font-size: 14px;
    color: #C06030;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.owned-items-showcase h5 small {
    font-weight: 400;
    opacity: 0.7;
    font-size: 11px;
}

.owned-items-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.owned-item-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
    font-size: 12px;
}

.owned-item-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.owned-item-card.equipped {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(91,155,213,0.08), rgba(139,189,233,0.12));
}

.owned-icon { font-size: 18px; }
.owned-name { color: var(--text-primary); font-weight: 500; }
.equipped-badge {
    background: var(--primary-color);
    color: white;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
}

.empty-owned-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    padding: var(--spacing-md) 0;
}

/* ========================================
   选项详情预览弹窗
   ======================================== */
.option-detail-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.25s ease;
}
.option-detail-modal.hidden { display: none; }

.odm-container {
    background: white;
    border-radius: var(--radius-xl);
    width: 480px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.odm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}
.odm-header h3 { font-size: 18px; margin: 0; }

.odm-close {
    width: 32px; height: 32px;
    border: none; background: var(--bg-tertiary);
    border-radius: 50%; font-size: 20px;
    cursor: pointer; color: var(--text-secondary);
    transition: all var(--transition-fast);
}
.odm-close:hover { background: var(--primary-light); color: white; }

.odm-body {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: var(--spacing-lg);
    padding: var(--spacing-lg);
}

.odm-preview-area { text-align: center; }
.odm-avatar-preview {
    width: 140px; height: auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #FAFAF8;
    display: inline-block;
}
.odm-current-label {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 11px;
    color: var(--text-secondary);
}

.odm-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}
.odm-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}
.odm-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.odm-tag {
    padding: 3px 10px;
    background: linear-gradient(135deg, #FFF0E5, #FFE8D8);
    color: #C06030;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.odm-actions {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

/* ========================================
   v4.0 形象定制增强样式
   ======================================== */

/* 肤色增强面板 */
.skin-tone-enhanced {
    background: #FAFAFA;
    border-radius: 12px;
    padding: 14px;
    border: 1px solid #EEE;
}

.skin-group-label {
    font-size: 11px;
    color: #999;
    margin: 8px 4px 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.skin-group-label:first-child { margin-top: 0; }

/* 自定义取色器 */
.custom-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #F8FAFC, #F0F4F8);
    border-radius: 10px;
    border: 1px dashed #C5D5E8;
}
.custom-color-label {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}
.color-picker-input {
    width: 40px; height: 32px;
    border: 2px solid #DDD;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    transition: border-color 0.2s, transform 0.15s;
}
.color-picker-input:hover {
    border-color: var(--primary-color);
    transform: scale(1.08);
}
.custom-color-value {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    color: var(--primary-dark);
    background: white;
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 500;
}

/* 眼睛细节网格 */
.eye-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
.eye-sub-section { display: flex; flex-direction: column; gap: 8px; }
.eye-sub-section.full-width { grid-column: 1 / -1; }
.sub-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 2px;
}

/* 虹膜颜色选择器 */
.iris-color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.iris-color-dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: all 0.2s ease;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.15);
}
.iris-color-dot:hover {
    transform: scale(1.18);
    box-shadow: 0 3px 10px rgba(91,155,213,0.35);
}
.iris-color-dot.selected {
    border-color: var(--primary-color);
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(91,155,213,0.25), 0 3px 8px rgba(0,0,0,0.15);
}

/* 滑块数值显示 */
.slider-val {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 15px;
    min-width: 20px;
    text-align: center;
}

/* 脸型图标 */
.face-icon {
    font-size: 20px;
    display: block;
    margin-bottom: 3px;
    filter: grayscale(0.3);
}
.face-shape-grid .option-card.selected .face-icon,
.face-shape_grid .option-card:hover .face-icon {
    filter: none;
}

/* 微型网格 */
.micro-grid {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)) !important;
}

/* 眉毛网格 / 鼻型网格 / 刘海网格 */
.brow-grid, .nose-grid, .bang-grid, .texture-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
}

/* 发型分类展示 */
.hair-style-section { display: flex; flex-direction: column; gap: 14px; }
.hair-category {
    background: #FAFBFD;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #E8EDF3;
}
.category-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-left: 4px;
}
.hair-category .option-grid {
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)) !important;
}

/* 发色增强面板 */
.hair-color-enhanced {
    background: #FAFAFA;
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid #EEE;
}
.color-group-title {
    font-size: 11px;
    color: #AAA;
    font-weight: 600;
    margin: 8px 4px 6px;
}
.color-group-title:first-child { margin-top: 0; }

.natural-hair, .fashion-hair {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 4px 0;
}

/* 颜色点通用增强（所有palette共用） */
.color-palette .color-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: all 0.22s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.12);
}
.color-palette .color-dot::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.2s;
}
.color-palette .color-dot:hover {
    transform: scale(1.25) translateY(-2px);
    box-shadow: 0 4px 12px rgba(91,155,213,0.3);
}
.color-palette .color-dot:hover::after {
    width: 8px; height: 8px;
}
.color-palette .color-dot.selected {
    border-color: var(--primary-color);
    transform: scale(1.15);
    box-shadow:
        0 0 0 3px rgba(91,155,213,0.2),
        0 3px 8px rgba(0,0,0,0.12),
        inset 0 1px 3px rgba(255,255,255,0.3);
}
.color-palette .color-dot.selected::after {
    width: 10px; height: 10px;
}

/* section提示文字 */
.section-hint {
    font-size: 11px;
    color: #AAA;
    font-weight: normal;
    margin-left: 4px;
}

/* 增强滑块样式 */
.custom-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 10px;
    background: linear-gradient(to right, var(--primary-light), var(--primary-color));
    outline: none;
    cursor: pointer;
    margin: 8px 0 4px;
}
.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-color);
    cursor: grab;
    box-shadow: 0 2px 8px rgba(91,155,213,0.35);
    transition: all 0.15s;
}
.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(91,155,213,0.45);
}
.custom-slider::-webkit-slider-thumb:active { cursor: grabbing; }
.custom-slider::-moz-range-thumb {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-color);
    cursor: grab;
    box-shadow: 0 2px 8px rgba(91,155,213,0.35);
}
.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #AAA;
}

/* 选项卡片hover动画增强 */
.option-card.small {
    transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.option-card.small:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 4px 14px rgba(91,155,213,0.2);
}
.option-card.small.selected {
    background: linear-gradient(135deg, #EAF3FB, #DCEBF7);
    border-color: var(--primary-color);
    color: var(--primary-dark);
    font-weight: 600;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(91,155,213,0.25);
}

/* 虹膜渐变效果预览 */
@keyframes irisSparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.real-eyes .iris {
    animation: irisSparkle 3s ease-in-out infinite;
}
