/* ========== 万象 App - iOS 风格设置页 ========== */

#genesis .app-content,
#genesis-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0 !important;
}

/* Tab 切换栏 */
.settings-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.settings-tab {
    flex: 1;
    padding: 14px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.settings-tab i {
    font-size: 18px;
}

.settings-tab.active {
    color: #5a7fff;
    border-bottom-color: #5a7fff;
    background: rgba(90, 127, 255, 0.05);
}

.settings-tab:hover:not(.active) {
    background: rgba(0, 0, 0, 0.02);
}

/* 可滚动内容包装器 */
.settings-content-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
}

/* Tab 内容 */
.settings-tab-content {
    display: none;
    padding: 20px;
    padding-bottom: 120px; /* 进一步增加底部留白，确保保存按钮完全可见 */
}

.settings-tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 设置组 (白色卡片) */
.settings-group {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.settings-group-title {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* 设置项 */
.settings-item {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.settings-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.settings-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    background: #f8f9fa;
    color: #333;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.settings-input:focus {
    border-color: #5a7fff;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(90, 127, 255, 0.1);
}

.settings-input::placeholder {
    color: #aaa;
}

/* Select 下拉框 */
.settings-input[type="password"],
.settings-input[type="number"],
select.settings-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

select.settings-input {
    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 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* 滑块样式 */
.settings-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #e0e0e0 0%, #5a7fff 0%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #5a7fff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(90, 127, 255, 0.4);
    transition: all 0.2s;
}

.settings-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(90, 127, 255, 0.6);
}

.settings-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #5a7fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(90, 127, 255, 0.4);
    transition: all 0.2s;
}

.settings-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 10px rgba(90, 127, 255, 0.6);
}

.settings-value-display {
    text-align: center;
    margin-top: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #5a7fff;
}

/* 文本域 */
.settings-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.6;
    background: #f8f9fa;
    color: #333;
    outline: none;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s;
}

.settings-textarea:focus {
    border-color: #5a7fff;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(90, 127, 255, 0.1);
}

.settings-textarea::placeholder {
    color: #aaa;
}

/* 模型拉取行 */
.model-fetch-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.model-input {
    flex: 1;
}

.fetch-btn {
    padding: 10px 16px;
    border: 2px solid #5a7fff;
    border-radius: 10px;
    background: rgba(90, 127, 255, 0.1);
    color: #5a7fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.fetch-btn i {
    font-size: 16px;
}

.fetch-btn:hover {
    background: rgba(90, 127, 255, 0.2);
    transform: translateY(-1px);
}

.fetch-btn:active {
    transform: translateY(0);
}

.fetch-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 状态文本 */
.status-text {
    margin-top: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s;
}

.status-text i {
    font-size: 16px;
}

.status-text:empty {
    display: none;
}

.status-loading {
    color: #5a7fff;
    background: rgba(90, 127, 255, 0.1);
}

.status-success {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.status-error {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

/* 旋转动画 */
.rotating {
    animation: rotating 1s linear infinite;
}

@keyframes rotating {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 预设管理入口链接 */
.settings-link {
    text-align: center;
    padding: 16px 0;
}

.settings-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #5a7fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    transition: all 0.2s;
}

.settings-link a:hover {
    background: rgba(90, 127, 255, 0.1);
}

.settings-link i {
    font-size: 16px;
}

/* 方案列表 */
.profiles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 方案卡片 */
.profile-card {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.3s;
}

.profile-card.active {
    background: rgba(90, 127, 255, 0.1);
    border-color: #5a7fff;
    box-shadow: 0 4px 16px rgba(90, 127, 255, 0.2);
}

.profile-card:hover:not(.active) {
    border-color: rgba(90, 127, 255, 0.3);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

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

.profile-name {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
}

.profile-model {
    font-size: 13px;
    color: #666;
    margin: 0;
}

.profile-actions-mini {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.profile-btn {
    padding: 6px 12px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    color: #666;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.profile-btn i {
    font-size: 14px;
}

.profile-btn:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.profile-btn-use {
    border-color: #5a7fff;
    color: #5a7fff;
    background: rgba(90, 127, 255, 0.1);
}

.profile-btn-use:hover {
    background: rgba(90, 127, 255, 0.2);
}

.profile-btn-delete {
    border-color: #e74c3c;
    color: #e74c3c;
}

.profile-btn-delete:hover {
    background: rgba(231, 76, 60, 0.1);
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.profile-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.profile-detail-item i {
    font-size: 16px;
    color: #999;
    flex-shrink: 0;
}

.profile-detail-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 空状态 */
.profiles-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.profiles-empty i {
    display: block;
    margin-bottom: 12px;
}

.profiles-empty p {
    margin: 6px 0;
    font-size: 14px;
}

.profiles-empty .hint {
    font-size: 12px;
    color: #bbb;
}

.profile-actions {
    margin-bottom: 0;
}

/* ========== 方案管理弹窗 ========== */
.profiles-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.profiles-modal.show {
    opacity: 1;
}

.profiles-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.profiles-modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.profiles-modal.show .profiles-modal-content {
    transform: scale(1);
}

.profiles-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.profiles-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.profiles-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.profiles-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.profiles-modal-close i {
    font-size: 20px;
    color: #666;
}

.profiles-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.profiles-modal-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profiles-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    text-align: center;
    flex-shrink: 0;
}

.profiles-modal-footer .hint {
    font-size: 13px;
    color: #999;
    margin: 0;
}

/* ========== 正则脚本卡片 ========== */
.regex-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.regex-script-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 14px;
    transition: all 0.2s;
}

.regex-script-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.regex-script-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

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

.regex-script-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.regex-script-preview {
    font-size: 13px;
    color: #666;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.regex-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.regex-toggle input {
    display: none;
}

.toggle-slider {
    width: 42px;
    height: 24px;
    background: #ddd;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: all 0.3s;
}

.regex-toggle input:checked + .toggle-slider {
    background: #007AFF;
}

.regex-toggle input:checked + .toggle-slider::before {
    left: 21px;
}

.regex-script-actions {
    display: flex;
    gap: 8px;
}

.regex-action-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    color: #007AFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.regex-action-btn:hover {
    background: #f8f9fa;
}

.regex-action-btn.danger {
    color: #e74c3c;
}

.regex-action-btn.danger:hover {
    background: #fee;
}

/* 操作按钮组 */
.settings-actions {
    display: flex;
    gap: 12px;
}

.settings-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-btn i {
    font-size: 18px;
}

.settings-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.settings-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.settings-btn-primary:active {
    transform: translateY(0);
}

.settings-btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 2px solid #e0e0e0;
}

.settings-btn-secondary:hover {
    background: #fff;
    border-color: #5a7fff;
    color: #5a7fff;
}

.settings-btn-secondary:active {
    transform: scale(0.98);
}

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

/* 提示信息 */
.settings-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(90, 127, 255, 0.1);
    border-radius: 12px;
    color: #5a7fff;
    font-size: 13px;
    line-height: 1.4;
}

.settings-hint i {
    font-size: 20px;
    flex-shrink: 0;
}

/* Toast 提示 - 极光幻白珍珠水滴样式 */
.settings-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    display: inline-flex;
    align-items: center;
    padding: 6px 24px 6px 6px;
    gap: 12px;
    border-radius: 99px 24px 8px 99px;
    background: linear-gradient(110deg, rgba(255,255,255,0.95), rgba(245,235,250,0.85), rgba(225,245,255,0.85));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 
        inset 0 2px 3px rgba(255,255,255,0.9), 
        inset 0 -1px 2px rgba(0,0,0,0.02),
        0 6px 16px rgba(180, 190, 210, 0.25);
    border: 1px solid rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.8px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settings-toast::before {
    content: '';
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #faeef5 30%, #dcd2dd 80%, #aeb4c5 100%);
    box-shadow: 
        inset -3px -3px 6px rgba(0,0,0,0.1), 
        inset 2px 2px 4px rgba(255,255,255,0.9), 
        0 2px 5px rgba(0,0,0,0.15);
}

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

.settings-toast-success {
    background: linear-gradient(110deg, rgba(255,255,255,0.95), rgba(235,250,245,0.85), rgba(225,255,240,0.85));
}

.settings-toast-success::before {
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #eef5f0 30%, #c5ddd2 80%, #8eb4a5 100%);
}

.settings-toast-error {
    background: linear-gradient(110deg, rgba(255,255,255,0.95), rgba(250,235,240,0.85), rgba(255,225,230,0.85));
}

.settings-toast-error::before {
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #f5eeef 30%, #ddc5c8 80%, #b48e92 100%);
}

.settings-toast-info {
    background: linear-gradient(110deg, rgba(255,255,255,0.95), rgba(235,240,250,0.85), rgba(225,235,255,0.85));
}

.settings-toast-info::before {
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #eef0f5 30%, #c5d2dd 80%, #8ea5b4 100%);
}

/* 旋转动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
