/* MainLayout 响应式样式 */

:root {
    --primary-color: #052767;
    --primary-dark: #3a0647;
    --primary-light: #0d5ba8;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    width: 100%;
}

body {
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

.main-container {
    display: flex;
    height: 100vh;
    width: 100%;
    flex-direction: column;
    overflow: hidden;
}

/* ===== 顶部导航栏 ===== */
.navbar-top {
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: none;
    flex-shrink: 0;
    height: 3.5rem;
    width: 100%;
    z-index: 1000;
}

.navbar-top.show {
    display: flex;
    justify-content: space-between;
    align-items: center;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand:hover {
    color: #fff;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-actions .dropdown-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 0.875rem;
}

.navbar-actions .dropdown-toggle:hover,
.navbar-actions .dropdown-toggle:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.navbar-actions .dropdown-menu {
    min-width: 180px;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.navbar-actions .dropdown-header {
    color: var(--primary-color);
    font-weight: 600;
}

.navbar-actions .dropdown-item {
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    padding: 0.5rem 1rem;
}

.navbar-actions .dropdown-item:hover {
    background-color: #f8f9fa;
}

.toggle-sidebar {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 内容区域 ===== */
.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    width: 100%;
    min-width: 0;
}

/* ===== 侧边栏 ===== */
.sidebar {
    background: linear-gradient(180deg, #052767 0%, #3a0647 70%);
    width: 250px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-header h5 {
    color: white;
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}

.sidebar-header small {
    color: rgba(255,255,255,0.7);
}

.nav-menu {
    padding: 1rem 0;
}

.nav-menu .nav-item {
    margin: 0;
}

.nav-menu .nav-link {
    color: #d7d7d7;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
}

.nav-menu .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    padding-left: 1.75rem;
}

.nav-menu .nav-link.active {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border-left: 3px solid var(--primary-light);
    padding-left: 1.47rem;
}

.nav-menu .nav-link i {
    min-width: 1.25rem;
    flex-shrink: 0;
}

/* ===== 主要内容区 ===== */
main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem 1rem;
    width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

article {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ===== 屏幕遮罩 ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== 错误框 ===== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 6px 12px;
    position: fixed;
    right: 0;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 3px;
    top: 0.75rem;
}

/* ===== 统计页面样式 ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    border-radius: 10px;
    padding: 1.5rem;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin: 0.5rem 0;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-change {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    font-weight: 500;
    color: #666;
}

.metric-value {
    font-weight: bold;
    color: #333;
}

/* ===== 响应式断点 ===== */

/* 手机端 (≤767px) */
@media (max-width: 767px) {
    .navbar-top.show {
        display: flex;
        height: 3rem;
    }

    .sidebar {
        position: fixed;
        top: 3rem;
        left: 0;
        height: calc(100vh - 3rem);
        z-index: 999;
        transform: translateX(-100%);
        width: 70vw;
        max-width: 300px;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .content-wrapper {
        flex-direction: column;
        height: calc(100vh - 3rem);
    }

    main {
        padding: 1rem 0.75rem;
        width: 100%;
        flex: 1;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .metric-row {
        padding: 0.75rem 0;
    }

    .metric-label,
    .metric-value {
        font-size: 0.9rem;
    }
}

/* 平板及以上 (≥768px) */
@media (min-width: 768px) {
    .navbar-top {
        display: none !important;
    }

    .navbar-top.show {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .sidebar {
        position: static;
        top: auto;
        left: auto;
        height: 100%;
        z-index: auto;
        transform: none !important;
        width: 200px;
        flex-shrink: 0;
    }

    .sidebar.show {
        transform: none !important;
    }

    .content-wrapper {
        flex-direction: row;
        height: 100%;
    }

    main {
        padding: 1rem;
        width: 100%;
        flex: 1;
    }
}

/* 大屏幕 (≥992px) */
@media (min-width: 992px) {
    .sidebar {
        width: 250px;
    }

    main {
        padding: 2rem;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}
