/**
 * 布局样式
 */

/* ========== 主布局 ========== */
.app-container {
    min-height: 100vh;
    display: flex;
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: var(--sidebar-width);
    background-color: #001529;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width var(--transition-normal);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    font-size: 18px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-logo {
    display: none;
}

.sidebar-menu {
    padding: 12px 0;
    height: calc(100vh - var(--header-height) - 60px);
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.65);
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
    border-left: 3px solid transparent;
}

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

.menu-item.active {
    color: white;
    background-color: var(--primary-color);
    border-left-color: var(--secondary-color);
}

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

.menu-text {
    margin-left: 12px;
    font-size: 14px;
    white-space: nowrap;
}

.sidebar.collapsed .menu-text {
    display: none;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 12px;
}

.sidebar-toggle {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    color: white;
}

/* 子菜单 */
.menu-group {
    position: relative;
}

.menu-group-title {
    padding: 8px 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar.collapsed .menu-group-title {
    display: none;
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-normal);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ========== 顶部导航 ========== */
.header {
    height: var(--header-height);
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.header-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-toggle:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-notification {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.header-notification:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--error-color);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-user:hover {
    background-color: var(--bg-color);
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

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

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 100;
}

.header-user:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--bg-color);
}

.dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-light);
    margin: 4px 0;
}

/* ========== 内容区 ========== */
.content {
    flex: 1;
    padding: 24px;
    background-color: var(--bg-color);
}

/* ========== 底部 ========== */
.footer {
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--border-color);
    background-color: white;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 200;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 150;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header-title {
        font-size: 16px;
    }
    
    .user-info {
        display: none;
    }
}

/* 登录页布局 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0D47A1 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 50%);
    animation: pulse 15s linear infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.login-container {
    width: 420px;
    max-width: 90%;
    background-color: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    position: relative;
    z-index: 10;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

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

.login-form .input-group:last-child {
    margin-bottom: 24px;
}

.login-captcha {
    display: flex;
    gap: 12px;
}

.login-captcha .input {
    flex: 1;
}

.login-captcha img {
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.login-btn {
    width: 100%;
    height: 48px;
    font-size: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .login-container {
        padding: 30px 24px;
    }
}

/* 统计概览网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* 最近列表 */
.recent-list {
    max-height: 400px;
    overflow-y: auto;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-item:hover {
    background-color: var(--bg-color);
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
}

.recent-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background-color: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.recent-info {
    flex: 1;
    min-width: 0;
}

.recent-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.recent-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}
