/* 自定义样式 */

/* 全局样式 */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    --sidebar-width: 250px;
    --navbar-height: 60px;
    
    --border-radius: 8px;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* 基础布局 */
body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f7fa;
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: all 0.3s ease;
    z-index: 1030;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar .sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar .sidebar-header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar .sidebar-header .toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.sidebar .sidebar-header .toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed .sidebar-header h4 {
    display: none;
}

/* 导航菜单 */
.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 0;
}

.sidebar-nav .nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav .nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    border-right: 3px solid white;
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

/* 主内容区域 */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: 70px;
}

/* 顶部导航栏 */
.top-navbar {
    background: white;
    height: var(--navbar-height);
    padding: 0 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--box-shadow);
}

.top-navbar .navbar-left {
    display: flex;
    align-items: center;
}

.top-navbar .navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-navbar .breadcrumb {
    margin: 0;
    background: none;
    padding: 0;
}

.top-navbar .user-menu {
    position: relative;
}

.top-navbar .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color 0.3s;
}

.top-navbar .user-info:hover {
    background-color: #f8f9fa;
}

.top-navbar .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* 内容区域 */
.content-area {
    padding: 1.5rem;
}

/* 统计卡片 */
.stats-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 120px;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.stats-card.bg-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; }
.stats-card.bg-success { background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%) !important; }
.stats-card.bg-warning { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important; }
.stats-card.bg-info { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important; }
.stats-card.bg-danger { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%) !important; }
.stats-card.bg-secondary { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%) !important; }

.stats-card.bg-primary,
.stats-card.bg-success,
.stats-card.bg-warning,
.stats-card.bg-info,
.stats-card.bg-danger,
.stats-card.bg-secondary {
    color: white;
}

/* 统计卡片内容区域 */
.stats-card .stats-content {
    position: relative;
    z-index: 2;
    padding-right: 70px;
}

.stats-card .stats-content h3,
.stats-card .stats-content .h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stats-card .stats-content p {
    margin: 0;
    opacity: 0.9;
}

/* 统计卡片图标（背景装饰） */
.stats-card .stats-icon {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 1.5rem;
    z-index: 1;
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

/* 表格样式 */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* 按钮样式 */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

/* 表单样式 */
.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* 模态框样式 */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
}

/* 分页样式 */
.pagination .page-link {
    border-radius: var(--border-radius);
    margin: 0 2px;
    border: 1px solid #dee2e6;
    color: var(--primary-color);
}

.pagination .page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 徽章样式 */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
}

/* 用户头像样式 */
.user-avatar,
.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.avatar-placeholder {
    background: #6c757d;
}

/* 活动列表样式 */
.activity-list .activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

.activity-list .activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

/* 语言切换器 */
.language-switcher {
    position: relative;
}

.language-switcher .dropdown-toggle::after {
    display: none;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast 样式 */
.toast {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.toast-header {
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar.collapsed + .main-content {
        margin-left: 0;
    }
    
    .top-navbar {
        padding: 0 1rem;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .top-navbar .user-info span {
        display: none;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: var(--border-radius);
        margin-bottom: 0.25rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* 深色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #212529;
        --dark-color: #f8f9fa;
    }
    
    body {
        background-color: #1a1a1a;
        color: #f8f9fa;
    }
    
    .card,
    .modal-content,
    .top-navbar {
        background-color: #2d2d2d;
        color: #f8f9fa;
    }
    
    .table th {
        background-color: #3d3d3d;
        color: #f8f9fa;
    }
    
    .form-control,
    .form-select {
        background-color: #3d3d3d;
        border-color: #495057;
        color: #f8f9fa;
    }
    
    .form-control:focus,
    .form-select:focus {
        background-color: #3d3d3d;
        border-color: var(--primary-color);
        color: #f8f9fa;
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 打印样式 */
@media print {
    .sidebar,
    .top-navbar,
    .btn,
    .pagination,
    .modal {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .content-area {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
    
    .table {
        font-size: 12px;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* 工具类 */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

.border-radius {
    border-radius: var(--border-radius) !important;
}

.box-shadow {
    box-shadow: var(--box-shadow) !important;
}

.box-shadow-lg {
    box-shadow: var(--box-shadow-lg) !important;
}

/* 特殊状态样式 */
.table-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.table-danger {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.table-success {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

.table-info {
    background-color: rgba(13, 202, 240, 0.1) !important;
}

.card-header-tabs {
    margin-bottom: -1px;
}

.card-header-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    background: transparent;
}

.card-header-tabs .nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: rgba(13, 110, 253, 0.3);
    background-color: rgba(13, 110, 253, 0.05);
}

.card-header-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
    font-weight: 600;
}

.card-header.bg-light {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6;
}

.settings-page .card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.settings-page .card-header {
    background-color: white;
    padding: 0;
}
