/* =========================================
   SubPage Components - 二级页面组件样式
   简约现代风格 - 全屏滑入式页面
   ========================================= */

/* ========== 二级页面容器 ========== */
.subpage {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========== 二级页面头部 ========== */
.subpage-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    min-height: 56px;
}

.subpage-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 12px;
    color: var(--primary-dark);
}

.subpage-back:active {
    background: rgba(0, 0, 0, 0.05);
}

.subpage-back i {
    font-size: 22px;
}

.subpage-title {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    color: #1a1a2e;
}

.subpage-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.subpage-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--primary-dark);
    background: transparent;
    border: none;
}

.subpage-action-btn:active {
    background: rgba(139, 92, 246, 0.1);
}

.subpage-action-btn i {
    font-size: 20px;
}

/* ========== 二级页面内容区 ========== */
.subpage-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 20px));
}

/* ========== 二级页面卡片 ========== */
.subpage-card {
    background: var(--white);
    border-radius: 16px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.subpage-card-header {
    padding: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.subpage-card-body {
    padding: 0;
}

/* ========== 列表项样式 ========== */
.subpage-list-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.subpage-list-item:last-child {
    border-bottom: none;
}

.subpage-list-item:active {
    background: rgba(0, 0, 0, 0.02);
}

.subpage-list-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 14px;
    flex-shrink: 0;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-dark);
}

.subpage-list-content {
    flex: 1;
    min-width: 0;
}

.subpage-list-title {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 2px;
}

.subpage-list-subtitle {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subpage-list-arrow {
    color: var(--primary-light);
    font-size: 18px;
    margin-left: 8px;
}

.subpage-list-badge {
    padding: 2px 8px;
    background: rgba(var(--primary-color-rgb), 0.12);
    color: var(--primary-dark);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.subpage-list-check {
    font-size: 20px;
    color: var(--primary-dark);
    margin-left: 8px;
}

.subpage-list-check.inactive {
    color: #ddd;
}

/* ========== 头像列表项 ========== */
.subpage-avatar-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.subpage-avatar-item:last-child {
    border-bottom: none;
}

.subpage-avatar-item:active {
    background: rgba(0, 0, 0, 0.02);
}

.subpage-avatar-item.active {
    background: rgba(139, 92, 246, 0.05);
}

.subpage-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 14px;
    border: 2px solid var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========== 表单样式 ========== */
.subpage-form-group {
    margin-bottom: 20px;
}

.subpage-form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
    padding-left: 4px;
}

.subpage-form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    font-size: 15px;
    color: #1a1a2e;
    background: var(--white);
    transition: all 0.2s ease;
    outline: none;
}

.subpage-form-input:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.subpage-form-input::placeholder {
    color: #bbb;
}

.subpage-form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    font-size: 15px;
    color: #1a1a2e;
    background: var(--white);
    transition: all 0.2s ease;
    outline: none;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    line-height: 1.5;
}

.subpage-form-textarea:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ========== 头像上传 ========== */
.subpage-avatar-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    position: relative;
}

.subpage-avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px dashed rgba(139, 92, 246, 0.3);
    transition: all 0.25s ease;
    position: relative;
}

.subpage-avatar-preview.has-image {
    border-style: solid;
    border-color: #8B5CF6;
}

.subpage-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.subpage-avatar-preview i {
    font-size: 32px;
    color: #8B5CF6;
}

.subpage-avatar-upload input[type="file"] {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.subpage-avatar-hint {
    font-size: 13px;
    color: #999;
    margin-top: 12px;
}

/* ========== 开关样式 ========== */
.subpage-switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.subpage-switch-item:last-child {
    border-bottom: none;
}

.subpage-switch-label {
    font-size: 15px;
    color: #1a1a2e;
}

.subpage-switch {
    width: 50px;
    height: 28px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 14px;
    position: relative;
    transition: background 0.2s ease;
    cursor: pointer;
}

.subpage-switch.active {
    background: linear-gradient(135deg, #A78BFA 0%, #8B5CF6 100%);
}

.subpage-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.subpage-switch.active .subpage-switch-thumb {
    transform: translateX(22px);
}

/* ========== 滑块样式 ========== */
.subpage-slider-item {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.subpage-slider-item:last-child {
    border-bottom: none;
}

.subpage-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.subpage-slider-label {
    font-size: 15px;
    color: #1a1a2e;
}

.subpage-slider-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-dark);
}

.subpage-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.08);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.subpage-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.3);
}

.subpage-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #999;
}

/* ========== 按钮样式 ========== */
.subpage-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.subpage-btn:active {
    transform: scale(0.98);
}

.subpage-btn-primary {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.25);
}

.subpage-btn-secondary {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-dark);
}

.subpage-btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.subpage-btn-danger:active {
    background: #ef4444;
    color: var(--white);
}

/* ========== 底部固定按钮区 ========== */
.subpage-footer {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 20px));
    background: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 12px;
}

.subpage-footer .subpage-btn {
    flex: 1;
}

/* ========== 统计卡片 ========== */
.subpage-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
}

.subpage-stat-item {
    text-align: center;
    padding: 16px 8px;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 12px;
}

.subpage-stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.subpage-stat-label {
    font-size: 12px;
    color: #999;
}

/* ========== 预设按钮网格 ========== */
.subpage-preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 16px;
}

.subpage-preset-btn {
    padding: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background: var(--white);
    color: #1a1a2e;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.subpage-preset-btn:active {
    background: var(--primary-gradient);
    color: var(--white);
    border-color: var(--primary-dark);
}

/* ========== 操作按钮网格 ========== */
.subpage-action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
}

.subpage-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(var(--primary-color-rgb), 0.08);
    color: var(--primary-dark);
}

.subpage-action-card i {
    font-size: 24px;
}

.subpage-action-card:active {
    transform: scale(0.98);
    background: var(--primary-gradient);
    color: var(--white);
}

/* ========== 标签输入 ========== */
.subpage-tag-input {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.subpage-tag-input input {
    flex: 1;
}

.subpage-tag-input button {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-dark);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subpage-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.subpage-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-dark);
    border-radius: 16px;
    font-size: 13px;
}

.subpage-tag i {
    font-size: 14px;
    cursor: pointer;
    opacity: 0.7;
}

.subpage-tag i:hover {
    opacity: 1;
}

/* ========== 空状态 ========== */
.subpage-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.subpage-empty i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 16px;
}

.subpage-empty-text {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px;
}

/* ========== 危险区域 ========== */
.subpage-danger-zone {
    margin-top: 24px;
    padding: 16px;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 16px;
}

.subpage-danger-title {
    font-size: 13px;
    font-weight: 500;
    color: #ef4444;
    margin-bottom: 12px;
}

/* ========== 页面过渡动画 ========== */
.subpage-slide-enter-active,
.subpage-slide-leave-active {
    transition: transform 0.3s ease-out;
}

.subpage-slide-enter-from {
    transform: translateX(100%);
}

.subpage-slide-leave-to {
    transform: translateX(100%);
}

/* ========== 壁纸选择器 ========== */
.subpage-wallpaper-section {
    padding: 16px;
}

.subpage-wallpaper-preview {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
}

.subpage-wallpaper-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.subpage-wallpaper-preview .placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #999;
}

.subpage-wallpaper-preview .placeholder i {
    font-size: 32px;
}

.subpage-wallpaper-actions {
    display: flex;
    gap: 12px;
}

.subpage-wallpaper-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background: var(--white);
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.subpage-wallpaper-btn:active {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-dark);
    border-color: var(--primary-color);
}

.subpage-wallpaper-btn i {
    font-size: 18px;
}
