/* 财务和分销管理后台样式 */
:root {
    --primary: #4e73df;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --secondary: #858796;
    --light: #f8f9fc;
    --dark: #5a5c69;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #f8f9fc;
}

/* 移动端顶部导航栏 */
.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    padding: 12px 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: none;
    min-height: 60px;
    box-sizing: border-box;
}

.mobile-topbar .mobile-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.mobile-topbar .mobile-menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-topbar .user-info-mobile {
    color: white;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mobile-topbar .user-info-mobile i {
    font-size: 1.2rem;
}

.sidebar {
    background: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    min-height: 100vh;
}

.sidebar .nav-item .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    margin: 0.25rem 0;
    border-radius: 0.35rem;
    transition: all 0.3s;
}

.sidebar .nav-item .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-item .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar .nav-item .nav-link i {
    margin-right: 0.5rem;
}

.topbar {
    background-color: #fff;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.card {
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
}

.table th {
    border-top: none;
    background-color: #f8f9fc;
    font-weight: 600;
}

.btn {
    border-radius: 0.35rem;
    font-weight: 600;
}

.badge {
    font-size: 0.75em;
    font-weight: 600;
}

/* 统计卡片样式 */
.stat-card {
    border-left: 0.25rem solid;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.primary {
    border-left-color: var(--primary);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.info {
    border-left-color: var(--info);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

/* 图表容器 */
.chart-container {
    position: relative;
    height: 300px;
}

/* 响应式表格 */
.table-responsive {
    border-radius: 0.35rem;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 打印样式 */
@media print {
    .sidebar, .topbar, .btn {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    /* 显示移动端顶部导航栏 */
    .mobile-topbar {
        display: block !important;
    }
    
    /* 主内容区域添加顶部padding，避免被固定导航栏遮挡 */
    .main-content {
        margin-left: 0;
        padding: 80px 15px 15px 15px;
        width: 100%;
        min-height: calc(100vh - 80px);
        box-sizing: border-box;
    }
    
    /* 侧边栏移动端适配 */
    .sidebar {
        min-height: auto;
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        z-index: 1050;
        transition: left 0.3s ease;
        overflow-y: auto;
        max-height: 100vh;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    /* 移动端侧边栏遮罩 */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    
    /* 顶部导航栏移动端 */
    .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        padding: 10px 15px;
    }
    
    /* 移动端菜单按钮 */
    .mobile-menu-btn {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #333;
        cursor: pointer;
        padding: 5px;
    }
    
    /* 统计卡片移动端布局 */
    .stat-card {
        margin-bottom: 15px;
    }
    
    .stat-card .card-body {
        padding: 15px;
    }
    
    .stat-card .h5 {
        font-size: 1.5rem;
    }
    
    .stat-card .text-xs {
        font-size: 0.75rem;
    }
    
    /* 表格移动端优化 */
    .table-responsive {
        font-size: 0.875rem;
        border: none;
    }
    
    .table th,
    .table td {
        padding: 8px 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* 按钮组移动端优化 */
    .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 2px;
    }
    
    /* 表单移动端优化 */
    .form-control {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    /* 模态框移动端优化 */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    /* 图表容器移动端优化 */
    .chart-container {
        height: 250px;
    }
    
    /* 卡片标题移动端 */
    .card-header h6 {
        font-size: 1rem;
    }
    
    /* 分页移动端优化 */
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* 搜索表单移动端 */
    .search-form .row {
        margin-bottom: 10px;
    }
    
    .search-form .col-md-3,
    .search-form .col-md-4 {
        margin-bottom: 10px;
    }
    
    /* 操作按钮移动端 */
    .action-buttons .btn {
        margin-bottom: 5px;
        width: 100%;
    }
    
    /* 用户信息移动端 */
    .user-info {
        text-align: center;
        padding: 10px;
    }
    
    .user-info .badge {
        display: block;
        margin-top: 5px;
    }
}

/* 超小屏幕优化 (手机竖屏) */
@media (max-width: 576px) {
    .main-content {
        padding: 80px 10px 10px 10px;
        min-height: calc(100vh - 80px);
        box-sizing: border-box;
    }
    
    .stat-card .h5 {
        font-size: 1.25rem;
    }
    
    .table th,
    .table td {
        padding: 6px 2px;
        font-size: 0.8rem;
    }
    
    .btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.75rem;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .chart-container {
        height: 200px;
    }
    
    .modal-dialog {
        margin: 5px;
        max-width: calc(100% - 10px);
    }
    
    .pagination .page-link {
        padding: 0.25rem 0.375rem;
        font-size: 0.8rem;
    }
}

/* 平板横屏优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
    }
    
    .stat-card .h5 {
        font-size: 1.75rem;
    }
    
    .chart-container {
        height: 280px;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 工具提示样式 */
.tooltip-inner {
    background-color: #6c757d;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* 模态框样式 */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    border-bottom: 1px solid #e3e6f0;
    background-color: #f8f9fc;
}

.modal-footer {
    border-top: 1px solid #e3e6f0;
    background-color: #f8f9fc;
}

/* 表单样式 */
.form-control:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-label {
    font-weight: 600;
    color: #5a5c69;
    margin-bottom: 0.5rem;
}

/* 分页样式 */
.pagination .page-link {
    color: #4e73df;
    border: 1px solid #ddd;
}

.pagination .page-item.active .page-link {
    background-color: #4e73df;
    border-color: #4e73df;
}

/* 警告框样式 */
.alert {
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}