/* home.css - 主屏幕、桌面、Dock、显示设置、头像上传等样式 */

/* ==================== 主容器 - 手机桌面 ==================== */
.phone-container {
    max-width: 430px;
    margin: 0 auto;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-desktop);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* 桌面区域 - 移除顶部状态栏空间 */
.desktop {
    flex: 1;
    padding: 20px 24px 20px;
    display: flex;
    flex-direction: column;
}

/* APP图标区域 */
.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.app-icon:active {
    transform: scale(0.9);
}

.app-icon-img {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 12px var(--shadow);
}

.app-icon-label {
    font-size: 11px;
    color: var(--text-primary);
    text-align: center;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 妙妙API图标 */
.app-miaomiao-api .app-icon-img {
    background: linear-gradient(135deg, #e8d5de 0%, #d4c5b9 100%);
}

/* 微信模式图标 */
.app-wechat .app-icon-img {
    background: linear-gradient(135deg, #7bb978 0%, #4caf50 100%);
}

/* Dock栏 */
.dock {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: 0 12px 20px;
    padding: 12px 16px;
    border-radius: 24px;
    display: flex;
    justify-content: space-around;
    box-shadow: 0 4px 20px var(--shadow-lg);
}

.dock-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.dock-icon:active {
    transform: scale(0.9);
}

.dock-icon.settings {
    background: linear-gradient(135deg, #a8a8a8 0%, #8e8e8e 100%);
}

.dock-icon.display {
    background: linear-gradient(135deg, #7eb8da 0%, #5a9bc9 100%);
}

.dock-icon.placeholder {
    background: linear-gradient(135deg, #ddd 0%, #ccc 100%);
}

.dock-icon svg, .dock-icon .icon {
    color: #fff;
}

/* 齿轮动画 */
.gear-icon {
    width: 26px;
    height: 26px;
    position: relative;
}
.gear-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border: 2.5px solid #fff;
    border-radius: 50%;
}
.gear-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background:
        linear-gradient(#fff, #fff) center top / 3px 6px no-repeat,
        linear-gradient(#fff, #fff) center bottom / 3px 6px no-repeat,
        linear-gradient(#fff, #fff) left center / 6px 3px no-repeat,
        linear-gradient(#fff, #fff) right center / 6px 3px no-repeat,
        linear-gradient(#fff, #fff) 3px 3px / 3px 5px no-repeat,
        linear-gradient(#fff, #fff) calc(100% - 3px) 3px / 3px 5px no-repeat,
        linear-gradient(#fff, #fff) 3px calc(100% - 3px) / 3px 5px no-repeat,
        linear-gradient(#fff, #fff) calc(100% - 3px) calc(100% - 3px) / 3px 5px no-repeat;
    transform: translate(-50%, -50%) rotate(22.5deg);
}

/* 显示设置图标 */
.display-icon {
    width: 24px;
    height: 20px;
    border: 2.5px solid #fff;
    border-radius: 3px;
    position: relative;
}
.display-icon::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 3px;
    background: #fff;
    border-radius: 1px;
}

/* 显示设置页面 - 字体选择器 */
.display-settings-section {
    padding: 12px 16px;
    background: #fff;
    margin-bottom: 12px;
}
.display-settings-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    display: block;
}
.font-selector {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.font-selector:focus {
    outline: none;
    border-color: var(--accent);
}
.font-preview {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.6;
}
/* 字体大小滑条 */
.fontsize-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.fontsize-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
}
.fontsize-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}
.fontsize-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

/* 用户头像上传区域 */
.avatar-upload-area {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.avatar-upload-area:hover {
    background: #ece7e2;
}
.avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px dashed #ccc;
}
.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-preview.has-image {
    border: none;
}
.avatar-upload-text {
    color: var(--text-secondary);
    font-size: 14px;
}
/* 壁纸选项 */
.wallpaper-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.wallpaper-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.wallpaper-preview {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    background-size: cover;
    background-position: center;
}
.wallpaper-option.active .wallpaper-preview {
    border-color: var(--accent-dark);
}
.wallpaper-option span {
    font-size: 12px;
    color: var(--text-secondary);
}
/* 自定义壁纸/背景删除按钮 */
.wallpaper-option.has-custom .wallpaper-preview,
.wechat-pattern-option.has-custom .wechat-pattern-preview {
    position: relative;
}
.custom-delete-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    display: none;
    z-index: 5;
}
.wallpaper-option.has-custom .custom-delete-btn,
.wechat-pattern-option.has-custom .custom-delete-btn {
    display: block;
}
/* 头像紧凑样式（带X删除按钮） */
.avatar-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.avatar-upload-compact {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}
.avatar-preview-compact {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px dashed #ccc;
}
.avatar-preview-compact img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-preview-compact.has-image {
    border: 2px solid var(--accent);
}
.avatar-delete-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: var(--danger, #d47f8a);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}
.avatar-upload-compact:hover .avatar-delete-btn,
.avatar-preview-compact.has-image + .avatar-delete-btn {
    display: flex;
}
.avatar-preview-compact:not(.has-image) + .avatar-delete-btn {
    display: none !important;
}
.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.slider-row .slider {
    flex: 1;
}
.slider-row .slider-value {
    min-width: 40px;
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary);
}
/* 助手头像上传 */
.assistant-avatar-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
}
.assistant-avatar-preview {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px dashed #ccc;
}
.assistant-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.assistant-avatar-preview.has-image {
    border: 2px solid var(--accent);
}
.assistant-avatar-delete {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: var(--danger, #d47f8a);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}
.assistant-avatar-upload:hover .assistant-avatar-delete {
    display: flex;
}
.assistant-avatar-preview:not(.has-image) + .assistant-avatar-delete {
    display: none !important;
}
