/* 基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

/* 导航栏样式 */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 600;
}

/* 卡片样式 */
.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 {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

/* 表格样式 */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 500;
    color: #6c757d;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* 按钮样式 */
.btn {
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-weight: 500;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* 表单样式 */
.form-control, .form-select {
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
}

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* 模态框样式 */
.modal-content {
    border: none;
    border-radius: 0.5rem;
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    .table-responsive {
        margin-bottom: 1rem;
    }
}

/* 自定义颜色 */
.text-success {
    color: #198754 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.bg-primary {
    background-color: #0d6efd !important;
}

/* 图表容器 */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1.5rem;
}

/* 徽章样式 */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* 金额样式 */
.amount-income {
    color: #198754;
    font-weight: 500;
}

.amount-expense {
    color: #dc3545;
    font-weight: 500;
}

/* 导航标签页 */
.nav-tabs .nav-link {
    border: none;
    color: #6c757d;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
}

.nav-tabs .nav-link.active {
    color: #0d6efd;
    background-color: transparent;
    border-bottom: 2px solid #0d6efd;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* 操作按钮组 */
.btn-group-xs > .btn, .btn-xs {
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1;
    border-radius: 0.2rem;
}

/* 统计卡片 */
.stat-card {
    border-left: 4px solid;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background-color: white;
    border-radius: 0.25rem;
}

.stat-card-income {
    border-left-color: #198754;
}

.stat-card-expense {
    border-left-color: #dc3545;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 600;
}

/* 响应式表格 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 575.98px) {
    .table-responsive-sm {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 确保表格容器不会超出视窗宽度 */
.table-container {
    max-width: 100%;
    overflow-x: auto;
}

/* 表格列默认设置，允许内容换行 */
.table th, .table td {
    white-space: normal;
    word-break: break-word;
}

/* 文本截断类，用于需要截断的长文本列 */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 表格中文本截断的优化 */
.table-fixed-layout .text-truncate {
    max-width: 100%; /* 在固定布局表格中占满单元格 */
}

/* 固定表格布局，确保列宽稳定 */
.table-fixed-layout {
    table-layout: fixed;
    width: 100%;
}

/* 添加一个新的容器类，用于控制水平滚动 */
.scroll-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

/* 确保在滚动容器内的元素不会溢出 */
.scroll-container .table-responsive {
    overflow-x: visible;
}

/* 防止按钮区域在滚动时可见 */
.action-buttons-container {
    width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
}

/* ---------- 图标统一样式 (标题/卡片/按钮) ---------- */
/*
  已移除对 .bi (Bootstrap Icons) 的专用样式：
  本项目现已使用彩色 Emoji 替代 Bootstrap Icons，保留这些规则没有必要。
  如果将来恢复使用 icon font，可在此处恢复相应样式。
*/

/* ---------- dashboard 专属小样式（从 templates/dashboard.html 提取） ---------- */
.acct-card {
    border-left: 4px solid rgba(0,123,255,0.8);
    transition: transform 0.2s, box-shadow 0.2s;
}
.acct-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    cursor: pointer;
}
.acct-icon {
    font-size: 1.6rem;
    opacity: 0.9;
}
.stat-card .card-body { padding: 0.75rem; }
.stat-card .card-title { font-size: 0.95rem; }
.table-sm th, .table-sm td { vertical-align: middle; }

/* 可点击金额单元格样式 */
.clickable-amount {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-amount:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.clickable-amount.text-success:hover {
    color: #0a58ca !important;
}

.clickable-amount.text-danger:hover {
    color: #b02a37 !important;
}

/* 明细弹窗样式 */
#transaction-details-body tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

#transaction-details-body a {
    color: #0d6efd;
    text-decoration: none;
}

#transaction-details-body a:hover {
    text-decoration: underline;
}

/* 交易详情只读弹窗表格样式 */
#transaction-detail-body table {
    margin-bottom: 0;
}

#transaction-detail-body table th {
    background-color: #f8f9fa;
    font-weight: 500;
    border-right: 1px solid #dee2e6;
}

#transaction-detail-body table td {
    vertical-align: middle;
}

#transaction-detail-body .form-control-plaintext {
    border: none;
    background: transparent;
    padding: 0.375rem 0;
    margin: 0;
    min-height: 1.5em;
}
