/* 全局变量和基本重置 */
:root {
    --ios-radius: 20px;
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.18);
    --text-color: #ffffff;
    --text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    
    /* 图标渐变库 */
    --gradient-1: linear-gradient(135deg, #ff5e62 0%, #ff9966 100%);
    --gradient-2: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-3: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    --gradient-4: linear-gradient(135deg, #7f00ff 0%, #e100ff 100%);
    --gradient-5: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
    --gradient-6: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    --gradient-7: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-8: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    font-family: var(--font-family);
    color: var(--text-color);
    height: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* 炫彩极光背景 */
.aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background: #0f1016;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.45;
    mix-blend-mode: screen;
    animation: move 25s infinite alternate ease-in-out;
}

.blob-1 {
    background: radial-gradient(circle, #ff0844 0%, transparent 70%);
    top: -10%;
    left: -10%;
    animation-duration: 20s;
}

.blob-2 {
    background: radial-gradient(circle, #0072ff 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
    animation-duration: 25s;
}

.blob-3 {
    background: radial-gradient(circle, #e100ff 0%, transparent 70%);
    top: 35%;
    left: 30%;
    animation-duration: 30s;
}

@keyframes move {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    100% {
        transform: translate(150px, 100px) scale(1.3) rotate(360deg);
    }
}

/* 通用视图容器 */
.view-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    z-index: 1;
}

.view-container.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}

/* ================= 登录视图 ================= */
#login-view {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(15, 16, 22, 0.4);
    backdrop-filter: blur(10px);
}

.login-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 40px 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#login-view.active .login-card {
    transform: translateY(0);
}

.login-header {
    margin-bottom: 30px;
}

.app-logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.app-logo {
    font-size: 50px;
    width: 90px;
    height: 90px;
    line-height: 90px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    display: inline-block;
}

.login-header h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.login-header p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* 输入框样式 */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.85);
    padding-left: 4px;
}

.input-group input[type="text"],
.input-group input[type="password"] {
    width: 100%;
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: var(--font-family);
    font-size: 15px;
    outline: none;
    transition: all 0.3s;
}

.input-group input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}

.input-tip {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
    display: block;
    padding-left: 4px;
}

.error-msg {
    color: #ff4a5a;
    font-size: 13px;
    margin-bottom: 15px;
    min-height: 18px;
    text-align: center;
}

/* 按钮样式 */
.btn {
    font-family: var(--font-family);
    padding: 14px 24px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 100%;
}

.btn-primary {
    background: #ffffff;
    color: #0f1016;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.4);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}


/* ================= 桌面视图 ================= */
#desktop-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 顶部状态栏 */
.status-bar {
    height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.2px;
    text-shadow: var(--text-shadow);
}

.status-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-icon {
    opacity: 0.9;
}

/* 桌面主体内容 */
.desktop-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* 滚动条隐藏 */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.desktop-content::-webkit-scrollbar {
    display: none;
}

/* 图标网格 */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px 20px;
    width: 100%;
    max-width: 440px; /* 控制图标紧凑度 */
    padding: 10px 0 120px 0; /* 为底部的 Dock 留空间 */
}

@media (min-width: 768px) {
    .icon-grid {
        grid-template-columns: repeat(6, 1fr);
        max-width: 780px;
        gap: 36px 30px;
    }
}

/* 单个图标项 */
.grid-item-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.grid-item-wrapper:active:not(.jiggling) {
    transform: scale(0.9);
}

/* 经典 iOS 图标设计 (22% 圆角标准) */
.app-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px; /* 约 22% 的圆角 */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    background-size: cover;
    background-position: center;
}

@media (min-width: 768px) {
    .app-icon {
        width: 76px;
        height: 76px;
        border-radius: 18px;
        font-size: 36px;
    }
}

.app-icon-text {
    font-weight: 700;
    color: #ffffff;
    font-size: 22px;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

@media (min-width: 768px) {
    .app-icon-text {
        font-size: 28px;
    }
}

.app-label {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 500;
    max-width: 72px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: var(--text-shadow);
    color: rgba(255, 255, 255, 0.95);
}

@media (min-width: 768px) {
    .app-label {
        font-size: 13px;
        max-width: 90px;
    }
}

/* iOS 经典的编辑状态抖动动画 */
.jiggling {
    animation: jiggle 0.28s infinite ease-in-out;
}

.jiggling:nth-child(even) {
    animation-duration: 0.3s;
    animation-delay: -0.05s;
}

@keyframes jiggle {
    0% { transform: rotate(-1.2deg) translate(0, 0); }
    50% { transform: rotate(1.2deg) translate(0, -0.5px); }
    100% { transform: rotate(-1.2deg) translate(0, 0); }
}

/* 删除按钮 (iOS 标志性减号/叉) */
.delete-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ff3b30;
    border: 1.5px solid #fff;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none; /* 默认编辑模式关闭时不响应 */
}

.jiggling .delete-badge {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto; /* 编辑模式开启时响应 */
}

.delete-badge::before {
    content: '';
    width: 10px;
    height: 2px;
    background-color: white;
    border-radius: 1px;
}


/* ================= 底部 Dock 栏 ================= */
.dock-container {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 20px;
    z-index: 100;
    pointer-events: none; /* 让它在没有点击到 dock 处时透传事件 */
}

.dock {
    background: rgba(255, 255, 255, 0.16);
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 30px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-around;
    gap: 12px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    pointer-events: auto; /* 保证内部元素可以点击 */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.dock-item {
    background: none;
    border: none;
    outline: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.dock-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    margin-bottom: 5px;
    transition: background-color 0.3s;
}

@media (min-width: 768px) {
    .dock-icon {
        width: 56px;
        height: 56px;
        border-radius: 14px;
    }
}

.bg-add {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}
.bg-edit {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}
.bg-settings {
    background: linear-gradient(135deg, #8e8e93 0%, #c7c7cc 100%);
}
.bg-logout {
    background: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
}

.dock-label {
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: var(--text-shadow);
}


/* ================= 模态弹窗 ================= */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-container.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: rgba(25, 28, 36, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-radius: 24px;
    width: 90%;
    max-width: 440px;
    padding: 24px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-container.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.btn-close:hover {
    color: #fff;
}

.required {
    color: #ff3b30;
}

/* Emoji 选择组件 */
.emoji-picker-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#item-icon {
    font-size: 20px;
    text-align: center;
    width: 60px !important;
}

.quick-emojis {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.quick-emoji {
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.15s, background-color 0.15s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.quick-emoji:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.15);
}

.quick-emoji:active {
    transform: scale(0.95);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.modal-footer .btn {
    width: auto;
    padding: 12px 24px;
}


/* ================= Toast 提示 ================= */
.toast {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
}

.toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}


/* ================= 辅助类 ================= */
.hidden {
    display: none !important;
}

/* 拖拽时的样式 */
.sortable-ghost {
    opacity: 0.3;
    transform: scale(0.8);
}

.sortable-drag {
    opacity: 0.9;
    transform: scale(1.05);
}

/* ================= 图标尺寸自适应样式 ================= */

/* 1. 小尺寸 (size-small) */
body.size-small .app-icon {
    width: 50px;
    height: 50px;
    font-size: 24px;
}
body.size-small .app-icon-text {
    font-size: 18px;
}
body.size-small .app-label {
    font-size: 10px;
    max-width: 60px;
}

@media (min-width: 768px) {
    body.size-small .app-icon {
        width: 64px;
        height: 64px;
        font-size: 30px;
    }
    body.size-small .app-icon-text {
        font-size: 24px;
    }
    body.size-small .app-label {
        font-size: 11px;
        max-width: 80px;
    }
}

/* 2. 中等尺寸 (size-medium / 默认) */
/* 无需额外定义，继承默认样式 */

/* 3. 大尺寸 (size-large) */
body.size-large .app-icon {
    width: 70px;
    height: 70px;
    font-size: 32px;
}
body.size-large .app-icon-text {
    font-size: 26px;
}
body.size-large .app-label {
    font-size: 12px;
    max-width: 84px;
}

@media (min-width: 768px) {
    body.size-large .app-icon {
        width: 88px;
        height: 88px;
        font-size: 42px;
    }
    body.size-large .app-icon-text {
        font-size: 32px;
    }
    body.size-large .app-label {
        font-size: 14px;
        max-width: 100px;
    }
}


/* ================= 系统设置专属样式 ================= */
.settings-section {
    text-align: left;
    margin-bottom: 20px;
}

.settings-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
}

.settings-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin: 20px 0;
}

/* 苹果风格分段选择器 (Segmented Control) */
.segmented-control {
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 3px;
    margin-top: 8px;
}

.segment-btn {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-family: var(--font-family);
}

.segment-btn:hover {
    color: #fff;
}

.segment-btn.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ================= 模态框 Tab 切换与批量框 ================= */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 20px;
    gap: 15px;
}

.modal-tab-btn {
    background: none;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.55);
    padding: 8px 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-family: var(--font-family);
}

.modal-tab-btn:hover {
    color: #fff;
}

.modal-tab-btn.active {
    color: #fff;
    border-bottom-color: #fff;
}

#batch-paths {
    width: 100%;
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    resize: vertical;
    transition: all 0.3s;
}

#batch-paths:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}
