/* CSS 变量 */
:root {
    --primary-color: #3b82f6;
    --secondary-color: #6366f1;
    --background-color: #1e293b;
    --text-color: #f8fafc;
    --accent-color: #10b981;
    --border-color: #334155;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

/* 全局样式 */
body {
    font-family: 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, var(--background-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text-color);
}

/* 浅色主题 */
body.light-theme {
    --background-color: #f3f4f6;
    --text-color: #111827;
    --border-color: #e5e7eb;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
}

body.light-theme {
    background: var(--background-color);
}

body.light-theme .glass-effect {
    background: var(--glass-bg);
    border-color: var(--glass-border);
}

body.light-theme .text-gray-100,
body.light-theme .text-gray-200,
body.light-theme .text-gray-300,
body.light-theme .text-white {
    color: var(--text-color) !important;
}

body.light-theme .text-gray-400 {
    color: #6b7280 !important;
}

body.light-theme .taskbar {
    background: rgba(243, 244, 246, 0.95);
    border-top-color: var(--border-color);
}

body.light-theme .modal {
    background: rgba(0, 0, 0, 0.3);
}

body.light-theme .modal-content {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--border-color);
}

body.light-theme .message-item.unread {
    background: rgba(59, 130, 246, 0.2);
}

body.light-theme .message-item.read {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* 玻璃效果 */
.glass-effect {
    backdrop-filter: blur(10px);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

/* 桌面图标样式 */
.desktop-icon {
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.desktop-icon .text-sm {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.desktop-icon:hover .app-icon {
    transform: translateY(-2px) scale(1.02);
}

.desktop-icon:active .app-icon {
    transform: translateY(0) scale(0.95);
    box-shadow: inset 4px 4px 12px rgba(0, 0, 0, 0.3), inset -4px -4px 12px rgba(255, 255, 255, 0.1);
}

.desktop-icon.dragging {
    opacity: 0.5;
    transform: scale(1.1);
}

/* 应用图标样式 */
.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 auto 0.75rem;
    box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    filter: saturate(0.92);
    position: relative;
    overflow: hidden;
}

.app-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 60%, rgba(0, 0, 0, 0.05) 100%);
    pointer-events: none;
}

.app-icon svg,
.app-icon img {
    filter: drop-shadow(1px 1px 0 rgba(255, 255, 255, 0.3)) drop-shadow(-1px -1px 0 rgba(0, 0, 0, 0.3));
}

/* 应用图标具体样式 */
.app-icon.meeting {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.app-icon.document {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.app-icon.attendance {
    background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
}

.app-icon.department {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

.app-icon.position {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.app-icon.structure {
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
}

.app-icon.personnel {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.app-icon.salary {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.app-icon.tailitem {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

/* 任务栏样式 */
.taskbar {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
}

/* 开始菜单样式 */
.start-menu {
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.start-menu:not(.hidden) {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* 开始菜单项样式 */
.start-menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #e5e7eb;
    font-size: 14px;
    border-left: 3px solid transparent;
}

.start-menu-item:hover {
    background: rgba(59, 130, 246, 0.15);
    border-left-color: #3b82f6;
    color: #ffffff;
}

.start-menu-item:active {
    background: rgba(59, 130, 246, 0.25);
}

.start-menu-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(107, 114, 128, 0.5), transparent);
    margin: 8px 12px;
}

/* 窗口样式 */
.window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* 消息中心样式 */
.message-item {
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    min-height: 80px;
}

.message-item.unread {
    background: rgba(30, 64, 175, 0.3);
    border-left: 4px solid #3b82f6;
}

.message-item.read {
    background: rgba(31, 41, 55, 0.5);
}

/* 模态框样式 */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 42rem;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
}

/* 按钮样式 */
.btn {
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #4b5563;
    color: white;
}

.btn-secondary:hover {
    background: #374151;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .desktop-icon {
        width: 100%;
        min-width: 0;
    }

    .app-icon {
        width: 72px;
        height: 72px;
        font-size: 1.75rem;
    }

    .app-icon svg {
        width: 36px;
        height: 36px;
    }

    .app-icon img {
        width: 48px;
        height: 48px;
    }

    /* 图标网格间距：32px 在手机上过大 */
    #desktopIconsContainer,
    div:has(> .desktop-icon) {
        gap: 1rem;
    }

    /* 图标标签两行截断，长名称不错位 */
    .desktop-icon .text-sm {
        font-size: 0.9rem;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: break-all;
    }

    .desktop-icon .text-xs {
        font-size: 0.75rem;
    }

    .modal-content {
        margin: 1rem;
        max-height: 80vh;
    }
}

/* 超小屏（手机竖屏）进一步紧凑 */
@media (max-width: 480px) {
    .app-icon {
        width: 64px;
        height: 64px;
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .app-icon svg {
        width: 32px;
        height: 32px;
    }

    .app-icon img {
        width: 40px;
        height: 40px;
    }

    .desktop-icon .text-sm {
        font-size: 0.85rem;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* 科幻风格状态栏 */
.statusbar-sci-fi {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.95) 100%);
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.statusbar-sci-fi::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
}

/* 科幻风格图标容器 */
.sci-fi-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}

.sci-fi-icon:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(99, 102, 241, 0.2) 100%);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3), inset 0 0 10px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.sci-fi-icon:active {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.sci-fi-icon svg {
    width: 22px;
    height: 22px;
    color: #60a5fa;
    filter: drop-shadow(0 0 3px rgba(96, 165, 250, 0.5));
}

/* 状态栏时间显示 */
.statusbar-time {
    font-family: 'Orbitron', 'Noto Sans SC', monospace;
    font-size: 0.875rem;
    color: #60a5fa;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    min-width: 180px;
    text-align: center;
}

/* 状态栏消息图标 */
.statusbar-message {
    position: relative;
}

.statusbar-message .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 9px;
    font-size: 0.65rem;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* 状态栏用户信息 */
.statusbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
}

.statusbar-user:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(99, 102, 241, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.4);
}

.statusbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* 状态栏按钮 */
.statusbar-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.statusbar-btn-login {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.statusbar-btn-login:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

.statusbar-btn-register {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.statusbar-btn-register:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

/* 开始菜单按钮 */
.start-menu-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(99, 102, 241, 0.15) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.start-menu-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4) 0%, rgba(99, 102, 241, 0.3) 100%);
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    transform: scale(1.05);
}

.start-menu-btn:active {
    transform: scale(0.95);
}

.start-menu-btn svg {
    width: 24px;
    height: 24px;
    color: #60a5fa;
    filter: drop-shadow(0 0 3px rgba(96, 165, 250, 0.5));
}

/* Logo容器 */
.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: logo-shine 3s infinite;
}

@keyframes logo-shine {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.logo-icon svg {
    width: 26px;
    height: 26px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    position: relative;
    z-index: 1;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(96, 165, 250, 0.3);
}

/* 状态栏右侧区域 */
.statusbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 状态栏分隔线 */
.statusbar-divider {
    width: 1px;
    height: 24px;
    background: linear-gradient(180deg, transparent, rgba(59, 130, 246, 0.3), transparent);
    margin: 0 0.5rem;
}

/* 下拉菜单样式 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.95) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    padding: 0.5rem;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: #e2e8f0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.dropdown-menu-item:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(99, 102, 241, 0.1) 100%);
    color: #60a5fa;
}

.dropdown-menu-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.dropdown-menu-item:hover svg {
    opacity: 1;
}

.dropdown-menu-divider {
    height: 1px;
    background: rgba(59, 130, 246, 0.2);
    margin: 0.5rem 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .statusbar-time {
        display: none;
    }

    .dropdown-menu {
        max-width: calc(100vw - 2rem);
        right: 0;
    }

    .logo-text {
        font-size: 1rem;
        max-width: 8rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .logo-container {
        min-width: 0;
    }

    .statusbar-btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
        min-height: 36px;
    }

    .statusbar-btn-register {
        display: none;
    }

    .statusbar-right {
        gap: 0.5rem;
    }

    .statusbar-sci-fi .sci-fi-icon {
        margin-right: 0.5rem;
    }

    .statusbar-sci-fi {
        padding: 0.5rem 0.75rem;
    }

    /* 小屏收纳状态栏：隐藏装饰性分隔线与用户名，确保 375px 不换行溢出 */
    .statusbar-divider {
        display: none;
    }

    .statusbar-user span {
        display: none;
    }

    .statusbar-user svg {
        display: none;
    }
}

/* 全局顶栏收纳：覆盖所有使用 nav.glass-effect + 标准ID 的页面（settings/calendar/neitem/drive/meeting 等） */
@media (max-width: 768px) {
    nav #currentTime {
        display: none;
    }

    nav #registerBtn {
        display: none;
    }

    nav #userName {
        display: none;
    }

    nav #logoutBtn {
        display: none;
    }

    nav.glass-effect {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    nav.glass-effect h1 {
        font-size: 1.05rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    nav.glass-effect>div:first-child {
        min-width: 0;
    }

    nav.glass-effect button {
        padding: 8px;
    }
}

/* 表单输入框样式 */
.form-input {
    background-color: #374151;
    border: 1px solid #4b5563;
    color: #f3f4f6;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.form-input::placeholder {
    color: #9ca3af;
}

/* 下拉选择框样式 */
.form-input option {
    background-color: #374151;
    color: #f3f4f6;
}