/* 主题变量定义 */
:root[data-theme="dark"] {
    --primary: #2D46B9;
    --primary-light: #3D56C9;
    --secondary: #00F5FF;
    --dark: #121212;
    --gray: #2A2A2A;
    --light-gray: #3A3A3A;
    --text: #FFFFFF;
    --text-secondary: #CCCCCC;
    --background: #121212;
    --card-bg: #2A2A2A;
    --border-color: rgba(255, 255, 255, 0.15);
    --primary-rgb: 45, 70, 185;
    --secondary-rgb: 0, 245, 255;
}

:root[data-theme="light"] {
    --primary: #2D46B9;
    --primary-light: #3D56C9;
    --secondary: #0095AC;
    --dark: #FFFFFF;
    --gray: #F5F5F5;
    --light-gray: #EEEEEE;
    --text: #333333;
    --text-secondary: #555555;
    --background: #FFFFFF;
    --card-bg: #F5F5F5;
    --border-color: rgba(0, 0, 0, 0.1);
    --primary-rgb: 45, 70, 185;
    --secondary-rgb: 0, 181, 204;
}

/* 默认使用深色主题 */
:root {
    color-scheme: dark;
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    overflow-x: hidden;
    height: 100vh;
    display: flex;
}

/* 汉堡菜单按钮 */
.nav-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 36px;
    height: 36px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    display: none; /* 默认隐藏，在移动端显示 */
    flex-direction: column;
    justify-content: space-around;
    padding: 8px;
    z-index: 1002;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.nav-toggle-bar {
    width: 100%;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.nav-toggle.active .nav-toggle-bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.nav-toggle.active .nav-toggle-bar:nth-child(2) {
    transform: scaleX(0);
    opacity: 0;
}

.nav-toggle.active .nav-toggle-bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 左侧导航菜单 */
.side-nav {
    width: 80px;
    height: 100vh;
    background: var(--background);
    backdrop-filter: blur(10px);
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 0;
    z-index: 100;
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
}

.side-nav:hover {
    width: 200px;
}

.nav-logo {
    width: 50px;
    height: 50px;
    margin-bottom: 40px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-logo-svg {
    width: 40px;
    height: 40px;
    transition: all 0.3s ease;
}

.side-nav:hover .nav-logo-svg {
    width: 45px;
    height: 45px;
}

.nav-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 20px;
    color: white;
    box-shadow: 0 5px 15px rgba(0, 245, 255, 0.2);
}

.nav-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    width: 100%;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    fill: var(--text-secondary);
    transition: all 0.3s ease;
    min-width: 24px;
}

.nav-item-label {
    margin-left: 15px;
    color: var(--text-secondary);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 14px;
}

.side-nav:hover .nav-item-label {
    opacity: 1;
}

.nav-item:hover {
    background: rgba(61, 86, 201, 0.2);
}

.nav-item:hover svg {
    fill: var(--secondary);
    transform: scale(1.1);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(45, 70, 185, 0.3), transparent);
}

.nav-item.active svg {
    fill: var(--secondary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--secondary);
    box-shadow: 0 0 8px var(--secondary);
}

.nav-item.active .nav-item-label {
    color: var(--text);
}

.nav-footer {
    margin-top: auto;
    width: 100%;
    padding: 10px 0;
}

/* ICP备案信息样式 */
.icp-beian {
    width: 100%;
    text-align: center;
    padding: 8px 0;
    margin-top: 10px;
    font-size: 12px;
    opacity: 0;  /* 默认隐藏 */
    transition: opacity 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.side-nav:hover .icp-beian {
    opacity: 1;  /* 鼠标悬停时显示 */
}

.icp-beian a {
    color: var(--text-secondary);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.icp-beian a:hover {
    opacity: 1;
}

/* 主内容区域 */
.main-container {
    flex: 1;
    margin-left: 80px;
    position: relative;
    overflow-y: auto;
    height: 100vh;
    -webkit-overflow-scrolling: touch; /* 增强iOS滚动体验 */
}

.content {
    padding: 40px;
    width: 100%;
    min-height: 100%;
    position: relative;
    overflow-y: visible; /* 确保内容可以正常溢出和滚动 */
}

/* 移动端触控反馈 */
.touch-active {
    background: rgba(var(--primary-rgb), 0.2) !important;
    transform: scale(0.97);
}

.nav-item:active svg,
.button:active,
.action-btn:active {
    transform: scale(0.95);
}

/* 主题切换按钮样式 */
.theme-toggle {
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-icon {
    width: 24px;
    height: 24px;
    fill: var(--text-secondary);
    transition: all 0.3s ease;
}

.theme-icon.dark {
    display: none;
}

.theme-toggle:hover .theme-icon {
    fill: var(--text);
    transform: rotate(30deg);
}

/* 主题切换动画 */
:root[data-theme] {
    transition: all 0.3s ease;
}

/* 加载动画 */
.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--primary);
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 创新元素：导航提示工具 */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    left: 90px;
    transform: translateY(-50%);
    z-index: 1000;
}

.tooltip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    border-width: 6px 6px 6px 0;
    border-style: solid;
    border-color: transparent rgba(0, 0, 0, 0.8) transparent transparent;
}

.nav-item:hover .tooltip {
    opacity: 1;
}

/* 统一提示样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--dark);
    color: var(--text);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 350px;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-message {
    font-size: 0.95rem;
    line-height: 1.4;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    width: 100%;
    transform-origin: left;
}

.toast-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* 不同类型的提示样式 */
.toast.info .toast-progress {
    background: var(--primary);
}

.toast.success .toast-progress {
    background: #4CAF50;
}

.toast.error .toast-progress {
    background: #FF5252;
}

.toast.warning .toast-progress {
    background: #FFC107;
}

/* 页面加载失败显示样式 */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 80%;
    background-color: #fff3f3;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    color: #d32f2f;
    text-align: center;
}

/* 404错误页面样式 */
.error-404-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 20px;
    text-align: center;
}

.error-404-content {
    background: var(--card-bg, rgba(30, 30, 30, 0.7));
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease;
}

.error-404-icon {
    margin-bottom: 20px;
}

.error-404-title {
    font-size: 6rem;
    font-weight: 700;
    color: var(--primary, #4285f4);
    margin: 0;
    line-height: 1;
}

.error-404-subtitle {
    font-size: 2rem;
    font-weight: 600;
    margin: 10px 0;
}

.error-404-description {
    font-size: 1.1rem;
    color: var(--text-secondary, #a0a0a0);
    margin-bottom: 30px;
}

.error-404-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.error-404-actions .home-btn,
.error-404-actions .back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.error-404-actions .home-btn {
    background-color: var(--primary, #4285f4);
    color: #ffffff;
    text-decoration: none;
}

.error-404-actions .back-btn {
    background-color: transparent;
    color: var(--text, #ffffff);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.error-404-actions .home-btn:hover {
    background-color: var(--primary-dark, #3367d6);
    transform: translateY(-2px);
}

.error-404-actions .back-btn:hover {
    background-color: var(--gray, rgba(255, 255, 255, 0.1));
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .error-404-content {
        padding: 30px 20px;
    }
    
    .error-404-title {
        font-size: 5rem;
    }
    
    .error-404-subtitle {
        font-size: 1.5rem;
    }
    
    .error-404-actions {
        flex-direction: column;
    }
}

:root[data-theme="light"] .tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

:root[data-theme="dark"] .tooltip {
    background: rgba(255, 255, 255, 0.9);
    color: black;
}
