/* ==================== 基础重置 ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Lucida Grande', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== 桌面背景 (Vista Aurora 风格) ==================== */
#desktop {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0d2137 0%, #1a3a5c 20%, #2d5a87 45%, #4a7fb5 70%, #6fa8dc 100%);
    user-select: none;
}

.wallpaper-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 15% 25%, rgba(255,255,255,0.12) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 75%, rgba(255,255,255,0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(120,180,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}

/* ==================== 桌面图标 ==================== */
#desktop-icons {
    position: absolute;
    top: 36px;
    left: 16px;
    width: 200px;
    height: calc(100vh - 80px);
    z-index: 10;
}

.desktop-icon {
    position: absolute;
    width: 84px;
    text-align: center;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.desktop-icon:hover {
    background: rgba(255,255,255,0.08);
}

.desktop-icon:active {
    background: rgba(255,255,255,0.12);
}

.desktop-icon-img {
    font-size: 40px;
    margin-bottom: 4px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.desktop-icon-label {
    color: white;
    font-size: 11px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6), 0 0 8px rgba(0,0,0,0.3);
    line-height: 1.3;
}

/* ==================== 窗口容器 ==================== */
#windows-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

/* ==================== Aero Glass 窗口 ==================== */
.aero-window {
    position: absolute;
    min-width: 320px;
    min-height: 200px;
    background: rgba(30, 40, 60, 0.25);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow:
        0 12px 40px rgba(0,0,0,0.45),
        0 4px 12px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.35),
        inset 0 -1px 0 rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    overflow: hidden;
    animation: windowOpen 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes windowOpen {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.aero-window.closing {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

.aero-window.minimized {
    opacity: 0;
    transform: scale(0.5) translateY(200px);
    pointer-events: none;
}

/* 窗口标题栏 - Vista Aurora 渐变 */
.window-titlebar {
    height: 34px;
    background: linear-gradient(180deg,
        rgba(255,255,255,0.35) 0%,
        rgba(255,255,255,0.18) 50%,
        rgba(255,255,255,0.08) 100%);
    border-bottom: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    padding: 0 12px;
    cursor: default;
    position: relative;
}

/* 标题栏玻璃高光 */
.window-titlebar::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 8px;
    right: 8px;
    height: 1px;
    background: rgba(255,255,255,0.4);
    border-radius: 1px;
}

/* 红绿灯按钮 (Mac 风格) */
.window-traffic-lights {
    display: flex;
    gap: 8px;
    margin-right: 12px;
    z-index: 2;
}

.traffic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
    position: relative;
}

.traffic-light::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 3px;
    right: 3px;
    height: 3px;
    background: rgba(255,255,255,0.35);
    border-radius: 50%;
}

.aero-window:hover .traffic-light {
    opacity: 1;
}

.traffic-light.close { background: #ff5f57; }
.traffic-light.minimize { background: #febc2e; }
.traffic-light.maximize { background: #28c840; }

.traffic-light:hover {
    filter: brightness(1.1);
}

.traffic-light:active {
    filter: brightness(0.9);
}

/* 窗口标题 */
.window-title {
    flex: 1;
    text-align: center;
    color: rgba(255,255,255,0.92);
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

/* 窗口内容区 */
.window-content {
    flex: 1;
    padding: 20px;
    color: rgba(255,255,255,0.88);
    overflow: auto;
    background: rgba(20, 30, 50, 0.15);
}

.window-content h2 {
    margin: 0 0 16px;
    font-weight: 300;
    font-size: 22px;
    color: rgba(255,255,255,0.95);
}

.window-content p {
    line-height: 1.7;
    opacity: 0.85;
    font-size: 14px;
    margin-bottom: 12px;
}

.window-content .info-box {
    margin-top: 20px;
    padding: 16px;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
}

.window-content .info-box h3 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.window-content .info-box ul {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    opacity: 0.7;
    line-height: 1.8;
}

/* 滚动条美化 */
.window-content::-webkit-scrollbar {
    width: 8px;
}

.window-content::-webkit-scrollbar-track {
    background: transparent;
}

.window-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.window-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* ==================== 顶部菜单栏 ==================== */
#menu-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 26px;
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(20px) saturate(1.1);
    -webkit-backdrop-filter: blur(20px) saturate(1.1);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    padding: 0 14px;
    z-index: 1000;
    pointer-events: auto;
    font-size: 13px;
}

#menu-apple {
    color: white;
    font-size: 15px;
    margin-right: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

#menu-apple:hover {
    background: rgba(255,255,255,0.15);
}

#menu-app-name {
    color: white;
    font-weight: 700;
    margin-right: 18px;
    cursor: default;
}

.menu-item {
    color: rgba(255,255,255,0.88);
    margin-right: 16px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    position: relative;
}

.menu-item:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.menu-spacer {
    flex: 1;
}

#clock {
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    font-weight: 500;
    cursor: default;
}

/* ==================== 下拉菜单 ==================== */
#dropdown-menu {
    position: absolute;
    top: 26px;
    left: 80px;
    min-width: 180px;
    background: rgba(40, 40, 45, 0.88);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 0 0 8px 8px;
    border: 1px solid rgba(255,255,255,0.12);
    border-top: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 1001;
    padding: 6px 0;
    pointer-events: auto;
}

#dropdown-menu.hidden {
    display: none;
}

.dropdown-item {
    padding: 6px 18px;
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s;
}

.dropdown-item:hover {
    background: rgba(0, 120, 255, 0.6);
    color: white;
}

.dropdown-separator {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 4px 10px;
}

/* ==================== Spotlight 搜索 ==================== */
#spotlight-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 140px;
    pointer-events: auto;
    animation: spotlightFadeIn 0.15s ease;
}

#spotlight-overlay.hidden {
    display: none;
}

@keyframes spotlightFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spotlight-panel {
    width: 580px;
    background: rgba(35, 35, 40, 0.9);
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 24px 80px rgba(0,0,0,0.55);
    overflow: hidden;
    animation: spotlightSlideDown 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes spotlightSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.spotlight-search-row {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.spotlight-icon {
    color: rgba(255,255,255,0.5);
    font-size: 20px;
    margin-right: 12px;
}

#spotlight-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    outline: none;
    font-family: inherit;
    caret-color: rgba(255,255,255,0.7);
}

#spotlight-input::placeholder {
    color: rgba(255,255,255,0.35);
}

#spotlight-results {
    max-height: 420px;
    overflow-y: auto;
    padding: 6px 0;
}

.spotlight-result-item {
    padding: 10px 18px;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 0.12s;
    border-radius: 6px;
    margin: 0 6px;
}

.spotlight-result-item:hover,
.spotlight-result-item.selected {
    background: rgba(0, 120, 255, 0.5);
}

.spotlight-result-icon {
    font-size: 24px;
    width: 32px;
    text-align: center;
}

.spotlight-result-info {
    flex: 1;
}

.spotlight-result-name {
    font-size: 14px;
    font-weight: 500;
}

.spotlight-result-type {
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    margin-top: 1px;
}

.spotlight-result-shortcut {
    color: rgba(255,255,255,0.35);
    font-size: 12px;
    font-family: monospace;
}

.spotlight-no-results {
    padding: 30px;
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 14px;
}

/* ==================== Dock 栏 ==================== */
#dock-container {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: auto;
}

#dock {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 14px 6px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px) saturate(1.3);
    -webkit-backdrop-filter: blur(30px) saturate(1.3);
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow:
        0 10px 40px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.25),
        inset 0 -1px 0 rgba(0,0,0,0.1);
    position: relative;
}

/* Dock 玻璃高光 */
#dock::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: rgba(255,255,255,0.3);
    border-radius: 1px;
}

.dock-item {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
    position: relative;
    margin-bottom: 4px;
}

.dock-icon-inner {
    font-size: 26px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
    pointer-events: none;
}

/* Dock 图标悬停放大 (鱼眼效果) */
.dock-item:hover {
    transform: scale(1.5) translateY(-14px);
    z-index: 10;
}

.dock-item.magnify-1 {
    transform: scale(1.3) translateY(-8px);
}

.dock-item.magnify-2 {
    transform: scale(1.15) translateY(-4px);
}

/* 运行指示器 */
.dock-indicator {
    position: absolute;
    bottom: -8px;
    width: 4px;
    height: 4px;
    background: rgba(255,255,255,0.75);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(255,255,255,0.4);
}

/* 各个应用图标颜色 */
.dock-item[data-app="Finder"] {
    background: linear-gradient(180deg, #4a90d9, #2a5a9e);
}

.dock-item[data-app="Safari"] {
    background: linear-gradient(180deg, #5ac8fa, #007aff);
}

.dock-item[data-app="Mail"] {
    background: linear-gradient(180deg, #64d2ff, #0a84ff);
}

.dock-item[data-app="iChat"] {
    background: linear-gradient(180deg, #a5d6a7, #4caf50);
}

.dock-item[data-app="Terminal"] {
    background: linear-gradient(180deg, #333333, #1a1a1a);
}

.dock-item[data-app="TextEdit"] {
    background: linear-gradient(180deg, #f5f5f5, #d4d4d4);
}

.dock-item[data-app="Preview"] {
    background: linear-gradient(180deg, #ffcc80, #ff9800);
}

.dock-item[data-app="iTunes"] {
    background: linear-gradient(180deg, #ef5350, #d32f2f);
}

.dock-item[data-app="System Preferences"] {
    background: linear-gradient(180deg, #8e8e93, #636366);
}

.dock-item[data-app="Trash"] {
    background: linear-gradient(180deg, #a1a1a6, #8e8e93);
}

.dock-separator {
    width: 1px;
    height: 38px;
    background: rgba(255,255,255,0.18);
    margin: 0 2px 6px;
    align-self: flex-end;
}

/* Dock 图标 tooltip */
.dock-item::after {
    content: attr(title);
    position: absolute;
    top: -36px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.dock-item:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    top: -40px;
}

/* ==================== 窗口最小化动画目标 (Genie Effect 简化版) ==================== */
.minimize-target {
    position: fixed;
    width: 1px;
    height: 1px;
    pointer-events: none;
    opacity: 0;
}

/* ==================== 特殊桌面图标 ==================== */
.icon-new .desktop-icon-img {
    filter: drop-shadow(0 0 6px rgba(0, 180, 255, 0.6)) drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    animation: futurePulse 2s ease-in-out infinite;
}

@keyframes futurePulse {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(0, 180, 255, 0.5)) drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
    50% { filter: drop-shadow(0 0 14px rgba(0, 180, 255, 0.9)) drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
}

.icon-root .desktop-icon-img {
    filter: drop-shadow(0 0 6px rgba(0, 255, 100, 0.5)) drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.icon-root .desktop-icon-label {
    color: #aaffaa;
    text-shadow: 0 0 8px rgba(0, 255, 100, 0.4), 0 1px 3px rgba(0,0,0,0.6);
}

/* ==================== Vista 风格增强 ==================== */

/* Vista 开始按钮（左下角） */
.vista-start-btn {
    position: absolute;
    bottom: 14px;
    left: 14px;
    width: 46px;
    height: 46px;
    background: radial-gradient(ellipse at 30% 20%, #4a9eff, #0066cc);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35);
    box-shadow: 0 4px 15px rgba(0,100,200,0.4), inset 0 1px 0 rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s;
}

.vista-start-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 22px rgba(0,120,255,0.6);
}

/* Vista 窗口底部光泽反射线 */
.aero-window::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 1px;
    background: rgba(255,255,255,0.12);
    border-radius: 1px;
    pointer-events: none;
}

/* Vista 侧边栏小工具 */
.vista-sidebar {
    position: absolute;
    top: 40px;
    right: 16px;
    width: 150px;
    z-index: 10;
}

.vista-gadget {
    background: rgba(25, 45, 75, 0.3);
    backdrop-filter: blur(22px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
    color: rgba(255,255,255,0.85);
    font-size: 11px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}

.vista-gadget-title {
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 10px;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Vista 风格按钮 */
.vista-btn {
    background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 6px;
    padding: 6px 16px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 2px 6px rgba(0,0,0,0.25);
    transition: all 0.15s;
    font-family: inherit;
}

.vista-btn:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.32), rgba(255,255,255,0.12));
    border-color: rgba(255,255,255,0.4);
}

.vista-btn:active {
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.18));
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.25);
}

/* 菜单栏 Vista 渐变增强 */
#menu-bar {
    background: linear-gradient(180deg, rgba(0,0,0,0.4), rgba(0,0,0,0.15));
    border-bottom: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

/* Dock 点击展开动画 */
#dock {
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#dock.expanded {
    padding: 10px 28px 8px;
    gap: 10px;
    background: rgba(255,255,255,0.16);
}
