/**
 * WenKing App - 应用页面专用样式
 * 包含侧边栏、布局、表单、动画等样式
 */

/* ============================================
   1. 侧边栏样式
   ============================================ */

/* 侧边栏基础样式 */
.app-sidebar {
    overflow-y: auto;
    overflow-x: hidden;
}

.app-sidebar::-webkit-scrollbar {
    width: 4px;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* 侧边栏链接 */
.sidebar-link {
    position: relative;
    text-decoration: none;
    overflow: hidden;
    isolation: isolate;
}

/* 背景渐变填充效果 */
.sidebar-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        rgba(139, 92, 246, 0.15) 0%, 
        rgba(6, 182, 212, 0.08) 100%);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

/* 悬停状态 */
.sidebar-link:hover::before {
    transform: translateX(0);
}

.sidebar-link:hover svg {
    transform: scale(1.1) rotate(-5deg);
    color: #a78bfa;
    filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.4));
}

.sidebar-link:hover span {
    color: rgba(255, 255, 255, 0.95);
    transform: translateX(4px);
}

/* 点击效果 */
.sidebar-link:active {
    transform: scale(0.98);
}

/* 图标和文字 */
.sidebar-link svg {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.sidebar-link span {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
    font-weight: 500;
}

/* 激活状态 */
.sidebar-link.active::before {
    transform: translateX(0);
    background: linear-gradient(90deg, 
        rgba(139, 92, 246, 0.2) 0%, 
        rgba(6, 182, 212, 0.1) 100%);
}

.sidebar-link.active svg {
    color: #a78bfa;
    filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.5));
}

.sidebar-link.active span {
    color: #ffffff;
    transform: translateX(4px);
}

/* 移动端遮罩层 */
.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* 移动端汉堡按钮 */
.sidebar-toggle {
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   2. 布局样式
   ============================================ */

/* 主内容区域 - 桌面端左侧留出侧边栏空间 */
.app-layout main {
    margin-left: 0;
    padding: 2rem;
    min-height: 100vh;
}

@media (min-width: 1024px) {
    .app-layout main {
        margin-left: 256px; /* 侧边栏宽度 260px - padding */
        padding: 2rem 2.5rem;
    }
}

/* 内容容器 */
.app-content {
    max-width: 1280px;
    margin: 0 auto;
}

/* 页面标题区域 */
.app-page-header {
    padding-top: 1rem;
}

@media (max-width: 1023px) {
    .app-page-header {
        padding-top: 4rem; /* 为汉堡按钮留出空间 */
    }
}

/* ============================================
   3. 表单元素样式
   ============================================ */

/* 输入框 */
.app-input {
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    color: #fff;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    outline: none;
}

.app-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3);
}

.app-input[readonly] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 下拉框 */
.app-select {
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    color: #fff;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' opacity='0.4'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.app-select:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3);
}

.app-select option {
    background: #12121a;
    color: #fff;
}

/* 开关 Toggle */
.app-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.app-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.app-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.app-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.app-toggle input:checked + .app-toggle-slider {
    background: #8b5cf6;
}

.app-toggle input:checked + .app-toggle-slider::before {
    transform: translateX(20px);
}

/* 表单组 */
.app-form-group {
    margin-bottom: 1.5rem;
}

/* ============================================
   4. 页面切换动画
   ============================================ */

.page-enter {
    animation: pageEnter 0.3s ease forwards;
}

.page-exit {
    animation: pageExit 0.2s ease forwards;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageExit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* 加载指示器 */
.page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.page-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
