/* ========== 全局样式重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========== CSS变量定义 ========== */
:root {
    --bg-primary:
    rgba(242, 242, 247, 0.8);
    --bg-secondary:
    rgba(255, 255, 255, 0.6);
    --bg-tertiary:
    rgba(242, 242, 247, 0.3);
    --border-color:
    rgba(255, 255, 255, 0.2);
    --text-primary:
    rgba(0, 0, 0, 0.8);
    --text-secondary:
    rgba(0, 0, 0, 0.6);
    --accent-color: #8500ff;
    --shadow-light:
    rgba(0, 0, 0, 0.1);
    --shadow-medium:
    rgba(0, 0, 0, 0.15);
    --shadow-heavy:
    rgba(0, 0, 0, 0.2);
    --hover-bg:
    rgba(0, 122, 255, 0.05);
    --active-bg:
    rgba(0, 122, 255, 0.15);
    --easing-bounce:
    cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --transition-normal: 0.3s;
}

/* ========== 字体设置 ========== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    background-color: #f2f2f7;
    overflow: hidden;
    user-select: none;
    transition: all var(--transition-normal);
}

/* ========== 桌面样式 ========== */
.desktop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('./webp/wallpaper.webp');
    background-size: cover;
    background-position: center;
    background-color: #1e1e2e;
    z-index: 0;
    padding-top: 28px;
    padding-bottom: 78px;
    transition: filter 0.3s ease;
}

/* 深色模式壁纸 */
body.dark-mode .desktop {
    background-image: url('./webp/wallpaper-dark.webp');
    background-color: #1a1a2e;
}

/* 如果本地壁纸加载失败，使用备用在线壁纸 */
.desktop {
    background-image: url('./webp/wallpaper.webp'), url('https://images.unsplash.com/photo-1506905925346-21bda4d32df4?q=80&w=2070&auto=format');
}

body.dark-mode .desktop {
    background-image: url('./webp/wallpaper-dark.webp'), url('https://images.unsplash.com/photo-1544197150-b99a580bb7a8?q=80&w=2070&auto=format');
}

/* ========== 深色模式通用样式 ========== */
body.dark-mode {
    --cc-bg: rgba(28, 28, 30, 0.9);
}

body.dark-mode .menu-bar,
body.dark-mode .context-menu,
body.dark-mode .window {
    background: rgba(30, 30, 40, 0.85);
    backdrop-filter: blur(20px);
    color: #f0f0f0;
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .window-header,
body.dark-mode .window-toolbar,
body.dark-mode .window-footer {
    background: rgba(50, 50, 55, 0.8);
}

body.dark-mode .window-title,
body.dark-mode .path-item {
    color: #eee;
}

body.dark-mode .file-item span {
    color: white;
    text-shadow: 0 1px 2px black;
}

body.dark-mode .sidebar-item {
    color: #eee;
}

body.dark-mode .sidebar-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .breadcrumb {
    background: rgba(0, 0, 0, 0.3);
    color: #eee;
}

/* ========== 桌面图标样式 ========== */
.desktop-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, 80px);
    gap: 20px;
    padding: 20px;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.18s var(--easing-bounce), filter 0.2s ease;
    width: 80px;
}

.desktop-icon:nth-child(1) { animation-delay: 0.05s; }
.desktop-icon:nth-child(2) { animation-delay: 0.1s; }
.desktop-icon:nth-child(3) { animation-delay: 0.15s; }
.desktop-icon:nth-child(4) { animation-delay: 0.2s; }
.desktop-icon:nth-child(5) { animation-delay: 0.25s; }

/* 修改：移除悬停时的缩放和上移效果 */
.desktop-icon:hover {
    /* 无任何悬浮位移/缩放效果 */
}

.desktop-icon:active {
    transform: scale(0.98);
}

.desktop-icon .icon-container {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}

.desktop-icon .icon-container img,
.desktop-icon .icon-container i {
    max-width: 100%;
    max-height: 100%;
}

.desktop-icon img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 10px;
}

.desktop-icon span {
    font-size: 12px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.desktop-icon:hover span {
    background-color: rgba(0, 122, 255, 0.7);
    color: white;
}

/* ========== 菜单栏样式 ========== */
.menu-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 28px;
    background: rgba(30, 30, 40, 0.25);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    z-index: 10000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-left, .menu-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.menu-item {
    position: relative;
    margin: 0 2px;
    height: 28px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s var(--easing-bounce), transform 0.1s ease;
    color: rgba(255, 255, 255, 0.9);
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.menu-item:active {
    transform: scale(0.97);
}

.menu-title {
    font-size: 13px;
    font-weight: 500;
}

.menu-item i {
    transition: transform 0.2s var(--easing-bounce);
}

.menu-item:hover i {
    transform: scale(1.1);
}

/* 下拉子菜单 */
.submenu {
    position: absolute;
    top: 28px;
    left: 0;
    background: rgba(40, 30, 60, 0.75);
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    min-width: 220px;
    z-index: 10001;
    display: none;
    overflow: hidden;
    padding: 6px 0;
    transform-origin: top left;
    animation: submenuAppear 0.2s var(--easing-bounce) forwards;
}

@keyframes submenuAppear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.menu-item:hover .submenu {
    display: block;
}

.submenu ul {
    list-style: none;
}

.submenu li {
    padding: 0 6px;
}

.submenu li a {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    transition: background-color 0.15s ease, padding-left 0.2s var(--easing-bounce);
    gap: 12px;
    border-radius: 6px;
    margin: 1px 0;
}

.submenu li a:hover {
    background-color: rgba(191, 90, 242, 0.6);
    color: white;
    padding-left: 16px;
}

.submenu li a i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.separator {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    margin: 4px 6px;
}

.menu-right .menu-item .menu-title i {
    font-size: 13px;
}

/* 深色模式菜单栏适配 */
body.dark-mode .menu-bar {
    background: rgba(20, 20, 30, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-mode .submenu {
    background: rgba(30, 25, 45, 0.85);
}

body.dark-mode .submenu li a {
    color: rgba(255, 255, 255, 0.85);
}
/* ========== 窗口样式 ========== */
.window {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 12px;
    box-shadow: 0 12px 40px var(--shadow-medium);
    min-width: 450px;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: box-shadow 0.2s ease, opacity 0.3s;
}

.window:hover {
    box-shadow: 0 16px 50px var(--shadow-heavy);
}

.window-header {
    height: 46px;
    background: linear-gradient(135deg, rgba(242, 242, 247, 0.7), rgba(229, 229, 234, 0.7));
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    padding: 0 14px;
    cursor: grab;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    user-select: none;
    touch-action: none;
}

.window-header:active {
    cursor: grabbing;
}

.window-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 16px;
}

.window-close,
.window-minimize,
.window-maximize {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.window-close {
    background-color: #ff5f56;
}

.window-minimize {
    background-color: #ffbd2e;
}

.window-maximize {
    background-color: #27c93f;
}

.window-close:hover {
    transform: scale(1.15);
    background-color: #ff3b30;
}

.window-minimize:hover {
    transform: scale(1.15);
    background-color: #ff9f0a;
}

.window-maximize:hover {
    transform: scale(1.15);
    background-color: #34c759;
}

.window-close:active,
.window-minimize:active,
.window-maximize:active {
    transform: scale(0.95);
}

.window-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
    flex-grow: 1;
    text-align: center;
    letter-spacing: -0.2px;
}

.window-content {
    flex-grow: 1;
    overflow: hidden !important;
    background: rgba(255, 255, 255, 0.5);
}

iframe {
    width: 100%;
    height: 100%;
    overflow: auto !important;
    border: none;
    pointer-events: auto;
}

.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    z-index: 30;
    background: transparent;
}

.resize-nw { top: -4px; left: -4px; cursor: nw-resize; }
.resize-ne { top: -4px; right: -4px; cursor: ne-resize; }
.resize-sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.resize-se { bottom: -4px; right: -4px; cursor: se-resize; }
.resize-n { top: -4px; left: 12px; right: 12px; height: 8px; cursor: n-resize; }
.resize-s { bottom: -4px; left: 12px; right: 12px; height: 8px; cursor: s-resize; }
.resize-w { left: -4px; top: 12px; bottom: 12px; width: 8px; cursor: w-resize; }
.resize-e { right: -4px; top: 12px; bottom: 12px; width: 8px; cursor: e-resize; }

.window.minimized { display: none; }

.window.maximized {
    top: 28px !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 106px) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-radius: 0 !important;
}

/* 深色模式窗口阴影 */
body.dark-mode .window {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

body.dark-mode .window:hover {
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
}

/* ========== 右键菜单 ========== */
.context-menu {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 10002;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 0;
    transform-origin: top left;
}

.context-menu ul { list-style: none; }

.context-menu li a {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    text-decoration: none;
    color: #1c1c1e;
    font-size: 13px;
    gap: 12px;
    transition: background-color 0.15s, padding-left 0.2s;
}

.context-menu li a:hover {
    background-color: #a200ff;
    color: white;
    padding-left: 20px;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .desktop-icons {
        grid-template-columns: repeat(auto-fill, 60px);
        gap: 12px;
    }

    .desktop-icon {
        width: 60px;
    }

    .window {
        min-width: 320px;
        min-height: 280px;
    }
}

/* ========== 滚动条样式 ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

body.dark-mode ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== GPU加速辅助类 ========== */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ========== 窗口动画辅助类 ========== */
.window-dragging {
    cursor: grabbing !important;
    opacity: 0.95;
}

.window-resizing {
    opacity: 0.95;
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}