/* 现代清新管理后台布局样式 */

:root {
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    
    --bg-main: #f8fafc;
    --bg-white: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-active: #e0e7ff;
    
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --text-dark: #1e293b;
    --text-main: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
}

.app-container {
    display: flex;
    height: 100vh;
    background: var(--bg-main);
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: var(--bg-white);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.logo-text span {
    color: var(--text-muted);
    font-weight: 400;
}

/* 导航区域 */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 32px;
}

.nav-section-title {
    padding: 0 20px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    margin: 0 12px;
    border-radius: var(--radius);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-dark);
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--primary);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item span {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

/* 子菜单样式 */
.nav-submenu {
    position: relative;
}

.nav-submenu-toggle {
    justify-content: space-between;
}

.nav-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.nav-submenu-items {
    display: none;
    background: var(--bg-main);
    margin: 4px 12px;
    border-radius: var(--radius);
    overflow: hidden;
}

.nav-subitem {
    display: block;
    padding: 10px 20px 10px 50px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    margin: 2px 8px;
    border-radius: var(--radius);
    cursor: pointer;
}

.nav-subitem:hover {
    background: var(--bg-hover);
    color: var(--text-dark);
}

.nav-subitem.active {
    background: var(--bg-active);
    color: var(--primary);
}

/* 徽章样式 */
.nav-badge {
    background: #10b981;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 0;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    min-width: 18px;
    max-width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 18px;
    text-align: center;
    flex-shrink: 0;
    overflow: hidden;
}

.nav-badge:empty {
    display: none;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-light);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    color: white;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: var(--bg-hover);
    color: var(--text-dark);
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: all 0.3s ease;
}

/* 顶部栏 */
.topbar {
    height: 60px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.menu-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-dark);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-money {
    font-size: 14px;
    color: var(--text-muted);
}

.topbar-time {
    font-size: 14px;
    color: var(--text-light);
    font-family: 'Monaco', 'Menlo', monospace;
}

/* 内容区域 */
.content-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.page-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-white);
}

/* 侧边栏收缩状态 */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-logo .logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-details,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-arrow {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    padding: 24px 15px;
    text-align: center;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 15px;
    margin: 0 10px;
}

.sidebar.collapsed .nav-submenu-items {
    display: none !important;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}

.sidebar.collapsed .logout-btn {
    display: none;
}

.main-content.sidebar-collapsed {
    margin-left: 0;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 999;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        width: 100%;
    }
    
    .topbar {
        padding: 0 16px;
    }
    
    .page-title {
        font-size: 16px;
    }
    
    .topbar-money {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 260px;
    }
    
    .topbar-time {
        display: none;
    }
    
    .page-title {
        font-size: 16px;
    }
}

/* 主页导航项样式 - 简洁版本 */
.nav-item.home-item {
    background: var(--bg-hover);
    color: var(--primary);
    margin: 0 12px 8px;
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    transition: all 0.2s ease;
}

.nav-item.home-item:hover {
    background: var(--bg-active);
    color: var(--primary-dark);
    transform: translateX(2px);
}

.nav-item.home-item svg {
    color: var(--primary);
}

.nav-item.home-item span {
    font-weight: 600;
    color: var(--primary);
}

/* 主页徽章 */
.home-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* 滚动条样式 */
.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 2px;
    transition: background 0.2s ease;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
}

.sidebar-nav::-webkit-scrollbar-thumb:active {
    background: rgba(148, 163, 184, 0.8);
}

/* Firefox 滚动条样式 */
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}