/* =====================================================
   家有灵犀 · layout.css
   侧边栏 + 顶栏 + 内容区布局
   ===================================================== */

/* ---------- 整体布局 ---------- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #4C1D95 0%, #6B46C1 100%);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    transition: width var(--transition-base);
}

.sidebar-header {
    padding: var(--space-5) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    min-height: var(--topbar-height);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: #FFFFFF;
    overflow: hidden;
}

.sidebar-title small {
    display: block;
    font-size: 11px;
    font-weight: 400;
    opacity: 0.75;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) var(--space-2);
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.nav-group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    padding: var(--space-3) var(--space-3) var(--space-1);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    color: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.22);
    color: #FFFFFF;
    font-weight: 600;
}

.nav-item iconify-icon,
.nav-item .nav-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ---------- 主区 ---------- */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-clock {
    font-size: 13px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.topbar-user:hover {
    background: var(--color-surface-hover);
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.topbar-user-info {
    line-height: 1.3;
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.topbar-user-role {
    font-size: 11px;
    color: var(--color-text-secondary);
}

/* ---------- 内容区 ---------- */
.content {
    flex: 1;
    padding: var(--space-6);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.page-subtitle {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

/* ---------- 认证页布局 ---------- */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
    padding: var(--space-6);
}

.auth-layout::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    top: -200px;
    right: -100px;
}

.auth-layout::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    bottom: -150px;
    left: -100px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-8);
    position: relative;
    z-index: 1;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .content {
        padding: var(--space-4);
    }

    .topbar {
        padding: 0 var(--space-4);
    }

    .topbar-clock {
        display: none;
    }
}
