/**
 * 加油记账系统主样式
 */

/* 全局样式 */
:root {
    --primary-color: #3b7dd8;
    --primary-dark: #2562b2;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --transition-speed: 0.3s;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background-color: #f5f7fb;
    color: #333;
    overflow-x: hidden;
}

/* 布局样式 */
.wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    transition: all var(--transition-speed) ease;
    z-index: 1000;
    overflow-y: auto;
    position: fixed;
    left: 0;
    top: 0;
}

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

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

.sidebar-title {
    margin: 0;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-speed) ease;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    width: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin: 0;
    padding: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--secondary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    color: var(--primary-color);
    background-color: rgba(59, 125, 216, 0.05);
}

.sidebar-link i {
    font-size: 1.2rem;
    margin-right: 10px;
    width: 24px;
    text-align: center;
}

.sidebar-item.active .sidebar-link {
    color: var(--primary-color);
    background-color: rgba(59, 125, 216, 0.1);
    border-left: 3px solid var(--primary-color);
}

.sidebar.collapsed .sidebar-link span {
    opacity: 0;
    width: 0;
    display: none;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    position: absolute;
    bottom: 0;
    width: 100%;
}

/* 主内容区域样式 */
.main-content {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    transition: all var(--transition-speed) ease;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.wrapper.sidebar-collapsed .main-content {
    width: calc(100% - var(--sidebar-collapsed-width));
    margin-left: var(--sidebar-collapsed-width);
}

.navbar {
    height: var(--header-height) !important;
    min-height: var(--header-height) !important;
    max-height: var(--header-height) !important;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.navbar-brand {
    display: flex;
    align-items: center;
    height: 100%;
}

/* 用户信息区域样式 */
.nav-item {
    display: flex;
    align-items: center;
}

#logoutNavBtn {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

.content-wrapper {
    padding: 1.5rem;
    padding-top: 1rem;
    flex: 1;
}

/* 页面内容样式 */
.content-page {
    display: none;
}

.content-page.active {
    display: block;
}

.page-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.25rem;
}

.card-title {
    font-weight: 600;
    color: var(--dark-color);
}

/* 统计卡片样式 */
.stat-card {
    transition: transform 0.2s ease;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.stat-icon i {
    font-size: 1.5rem;
    color: #fff;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-info {
    background-color: var(--info-color) !important;
}

.bg-purple {
    background-color: #8a2be2;
}

.stat-content {
    flex: 1;
}

.stat-title {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stat-desc {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/* 表格样式 */
.table {
    margin-bottom: 0;
    white-space: nowrap;
    border-collapse: collapse;
    table-layout: fixed;
}

.table th,
.table td {
    border: 1px solid #dee2e6;
}

.table th {
    font-weight: 600;
    border-top: none;
    background-color: #f8f9fa;
    color: #495057;
    text-transform: none;
    text-align: center;
}

.table td {
    vertical-align: middle;
    font-size: 0.875rem;
    padding: 0.75rem;
}

/* 表格数字靠右对齐 */
.table td:nth-child(2),
.table td:nth-child(6),
.table td:nth-child(7),
.table td:nth-child(8),
.table td:nth-child(9),
.table td:nth-child(10),
.table td:nth-child(11),
.table td:nth-child(12),
.table td:nth-child(13) {
    text-align: right;
}

/* 设置备注列宽度和文本溢出处理 */
.table th:nth-child(14) {
    width: 200px;
}

.table td:nth-child(14) {
    max-width: 200px;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    min-height: 42px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    line-height: 1.4;
}

/* 设置数字列宽度一致 */
.table th:nth-child(6),
.table th:nth-child(7),
.table th:nth-child(8),
.table th:nth-child(9),
.table th:nth-child(10),
.table th:nth-child(11),
.table th:nth-child(12),
.table th:nth-child(13) {
    width: 90px;
}

/* 设置序号和状态列宽度一致 */
.table th:nth-child(2),
.table th:nth-child(3) {
    width: 60px;
}

/* 设置复选框列宽度 */
.table th:nth-child(1) {
    width: 40px;
    text-align: center;
}

/* 设置日期和客户列宽度 */
.table th:nth-child(4) {
    width: 100px; /* 日期列 */
}

.table th:nth-child(5) {
    width: 100px; /* 客户列 */
}

/* 表格行选中样式 - 使用更强的选择器 */
body .table tr.selected,
body .table-hover tbody tr.selected,
body .table-hover tbody tr.selected:hover,
body .table tbody tr.selected td,
body #recordsTable tbody tr.selected,
body #recordsTable tbody tr.selected:hover,
body #recordsTable tbody tr.selected td {
    background-color: #e6f2ff !important;
    font-weight: 500 !important;
}

.table tr {
    transition: background-color 0.15s ease-in-out;
    cursor: pointer;
}

/* 按钮样式 */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 表单样式 */
.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(59, 125, 216, 0.25);
}

/* 响应式样式 */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-show {
        transform: translateX(0);
        width: var(--sidebar-width);
    }
    
    .sidebar.mobile-show .sidebar-title,
    .sidebar.mobile-show .sidebar-link span {
        opacity: 1;
        width: auto;
        display: inline;
    }
    
    .main-content {
        width: 100%;
        margin-left: 0;
    }
    
    .wrapper.sidebar-collapsed .main-content {
        width: 100%;
        margin-left: 0;
    }
    
    .navbar {
        height: var(--header-height) !important;
        min-height: var(--header-height) !important;
        padding: 0 0.75rem;
    }
    
    .content-wrapper {
        padding: 1rem;
        padding-top: 0.75rem;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    /* 移动设备上用户信息区域样式 */
    #currentUsername {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    #logoutNavBtn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    
    /* 移动设备上备注列样式 */
    .table th:nth-child(14),
    .table td:nth-child(14) {
        width: 150px;
        max-width: 150px;
    }
}

/* 自定义间距调整 */
/* 减小卡片行之间的间距 */
#dashboard-page .row.mb-4 {
    margin-bottom: 0.75rem !important;
}

/* 调整图表行与卡片行的间距一致 */
#dashboard-page .row + .row {
    margin-top: 0.75rem;
}

/* 减小卡片自身的下边距 */
#dashboard-page .stat-card {
    margin-bottom: 0.75rem;
}

/* 调整卡片内部的间距，使整体更紧凑 */
#dashboard-page .card-body {
    padding: 1rem;
}

@media (max-width: 768px) {
    #dashboard-page .row.mb-4 {
        margin-bottom: 0.5rem !important;
    }
    
    #dashboard-page .row + .row {
        margin-top: 0.5rem;
    }
    
    #dashboard-page .stat-card {
        margin-bottom: 0.5rem;
    }
}

/* 图表控制按钮样式 */
.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-controls .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
}

.chart-controls .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chart-controls .btn i {
    font-size: 0.875rem;
}

/* 图表卡片样式 */
.chart-card {
    height: 400px; /* 固定高度 */
}

.chart-card .card-body {
    height: calc(100% - 56px); /* 减去卡片头部的高度 */
    padding: 1rem;
}

/* 确保图表容器有足够的空间 */
.chart-container {
    position: relative;
    height: 100%;
    width: 100%;
}

/* 月份选择器样式 */
.month-picker-container {
    position: absolute;
    z-index: 1000;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 320px;
    padding: 15px;
    display: none;
}

.month-picker-container.show {
    display: block;
}

.month-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.month-picker-year {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    flex-grow: 1;
}

.month-picker-nav {
    cursor: pointer;
    color: #4a89dc;
    font-size: 20px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.month-picker-nav:hover {
    background-color: #f0f0f0;
}

.month-picker-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.month-picker-month {
    padding: 10px 5px;
    text-align: center;
    border-radius: 8px;
    border: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s;
}

.month-picker-month:hover {
    background-color: #f0f0f0;
}

.month-picker-month.selected {
    background-color: #4a89dc;
    color: white;
    border-color: #4a89dc;
}

/* 筛选器和按钮样式 */
#recordFilterForm .col-md-2 {
    width: 140px;
    padding-right: 5px;
    padding-left: 5px;
}

#recordFilterForm .col-md-3 {
    width: 120px;
    padding-right: 5px;
    padding-left: 5px;
}

#recordFilterForm {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
}

/* 缩小筛选器和记录列表之间的距离 */
#fuel-records-page .mb-4 {
    margin-bottom: 0.25rem !important;
}

/* 减小卡片内部的内边距 */
#fuel-records-page .card-body {
    padding: 0.5rem;
}

/* 减小表格内部的内边距 */
#fuel-records-page .table td,
#fuel-records-page .table th {
    padding: 0.4rem;
}

/* 减小分页区域的上边距 */
#fuel-records-page .mt-4 {
    margin-top: 0.25rem !important;
}

/* 表格滚动和固定表头 */
#fuel-records-page .table-responsive {
    height: calc(100vh - 230px);
    overflow-y: auto;
    position: relative;
}

/* 分页器靠左对齐 */
#fuel-records-page .pagination {
    justify-content: flex-start !important;
}

#fuel-records-page .table {
    position: relative;
}

#fuel-records-page .table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

#fuel-records-page .table thead th {
    background-color: #f8f9fa;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

/* 选中记录合计信息样式 */
#selectedRecordsSummary {
    transition: all 0.3s ease;
    background-color: rgba(59, 125, 216, 0.05);
    padding: 8px 16px;
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

#selectedRecordsSummary .fw-bold {
    color: var(--primary-color);
}

/* 确保在移动设备上正确显示 */
@media (max-width: 768px) {
    .d-flex.justify-content-between.align-items-center.mt-4 {
        flex-direction: column;
        gap: 1rem;
    }
    
    #selectedRecordsSummary .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }
} 