/* ============================================================
   BZOA-PHP 自定义样式（Bootstrap 5 补充）
   ============================================================ */

/* ---- 全局 ---- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: #f5f6fa;
    min-height: 100vh;
}

/* ---- 登录页 ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.login-card .card-body {
    padding: 2.5rem;
}

.login-card .card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-card .card-subtitle {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-card .form-label {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.login-card .form-control {
    border-radius: 8px;
    padding: 0.625rem 1rem;
    border: 1px solid #ddd;
    font-size: 0.95rem;
}

.login-card .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.login-card .btn-login {
    padding: 0.625rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    transition: opacity 0.2s;
}

.login-card .btn-login:hover {
    opacity: 0.9;
}

.login-card .btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-card .input-group-text {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #888;
}

.login-card .input-group .form-control {
    border-left: none;
    border-radius: 0 8px 8px 0;
}

.login-card .input-group:focus-within .input-group-text {
    border-color: #667eea;
}

/* ---- 侧边栏 ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    background: #1e1e2d;
    z-index: 1000;
    overflow-y: auto;
    transition: width 0.3s;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand > i {
    margin-right: 0.5rem;
    color: #667eea;
    flex-shrink: 0;
}

.sidebar-brand > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 折叠切换按钮 */
.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.875rem;
    flex-shrink: 0;
    margin-left: 0.5rem;
    transition: color 0.2s;
    line-height: 1;
}

.sidebar-toggle:hover {
    color: #fff;
}

.sidebar .nav-section {
    padding: 0.75rem 1.25rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar .nav-link {
    padding: 0.625rem 1.25rem;
    color: rgba(255, 255, 255, 0.65);
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #667eea;
}

.sidebar .nav-link.active {
    color: #fff;
    background: rgba(102, 126, 234, 0.15);
    border-left-color: #667eea;
}

.sidebar .nav-link i {
    margin-right: 0.625rem;
    width: 1.25rem;
    text-align: center;
}

/* ---- 侧边栏折叠状态 ---- */
body.sidebar-collapsed .sidebar {
    width: 60px;
}

body.sidebar-collapsed .sidebar .nav-link span,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar-brand > span {
    display: none;
}

body.sidebar-collapsed .sidebar-brand {
    padding: 1rem;
    justify-content: center;
}

body.sidebar-collapsed .sidebar-brand > i {
    margin-right: 0;
    font-size: 1.2rem;
}

body.sidebar-collapsed .sidebar-toggle {
    margin-left: 0;
    padding: 0.5rem 0.6rem;
}

body.sidebar-collapsed .sidebar .nav-link {
    text-align: center;
    padding: 0.75rem;
    justify-content: center;
}

body.sidebar-collapsed .sidebar .nav-link i {
    margin-right: 0;
    font-size: 1.2rem;
}

body.sidebar-collapsed .sidebar .nav-link span {
    display: none;
}

body.sidebar-collapsed .main-content {
    margin-left: 60px;
}

body.sidebar-collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* ---- 主内容区 ---- */
.main-content {
    margin-left: 240px;
    min-height: 100vh;
    padding: 0;
}

.main-header {
    background: #fff;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 999;
}

.main-header .page-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.main-header .user-info {
    font-size: 0.875rem;
    color: #666;
}

.main-header .user-info i {
    margin-right: 0.375rem;
    color: #667eea;
}

.page-content {
    padding: 1.5rem;
}

/* ---- 统计卡片 ---- */
.card-stat {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.card-stat .card-body {
    padding: 1.25rem;
}

.card-stat .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.card-stat .stat-icon.bg-income {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.card-stat .stat-icon.bg-expense {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.card-stat .stat-icon.bg-profit {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

.card-stat .stat-icon.bg-reminder {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.card-stat .stat-label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.card-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

/* ---- 通用卡片 ---- */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
    border-radius: 10px 10px 0 0 !important;
}

/* ---- 表格 ---- */
.table-ledger {
    font-size: 0.9rem;
}

.table-ledger th {
    font-weight: 600;
    color: #555;
    background: #f8f9fa;
    border-bottom: 2px solid #e8eaed;
    white-space: nowrap;
}

.table-ledger td {
    vertical-align: middle;
}

.table-ledger .badge-income {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.table-ledger .badge-expense {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* ---- 筛选表单 ---- */
.filter-form .form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 0.25rem;
}

.filter-form .form-control,
.filter-form .form-select {
    font-size: 0.9rem;
    border-radius: 6px;
    border-color: #ddd;
}

.filter-form .form-control:focus,
.filter-form .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.15rem rgba(102, 126, 234, 0.2);
}

/* ---- 模态框 ---- */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 1rem 1.5rem;
}

/* ---- Toast 提示 ---- */
.toast-container .toast {
    min-width: 280px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-container .toast .toast-body {
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
}

/* ---- 空状态 ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #aaa;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.empty-state p {
    font-size: 0.95rem;
    margin: 0;
}

/* ---- 进度条（仪表盘项目盈亏） ---- */
.progress-stat {
    margin-bottom: 1rem;
}

.progress-stat .progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.progress-stat .progress-label .name {
    color: #555;
}

.progress-stat .progress-label .value {
    font-weight: 600;
}

.progress-stat .progress {
    height: 6px;
    border-radius: 3px;
}

/* ---- 项目卡片 ---- */
.project-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.project-card .card-body {
    padding: 1.25rem;
}

.project-card .project-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.project-card .project-address {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.25rem;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar .nav-link span,
    .sidebar .nav-section,
    .sidebar-brand > span {
        display: none;
    }

    .sidebar-brand {
        padding: 1rem;
        justify-content: center;
    }

    .sidebar-brand > i {
        margin-right: 0;
    }

    .sidebar-toggle {
        display: none;
    }

    .sidebar .nav-link {
        text-align: center;
        padding: 0.75rem;
        justify-content: center;
    }

    .sidebar .nav-link i {
        margin-right: 0;
        font-size: 1.2rem;
    }

    .main-content {
        margin-left: 60px;
    }
}

/* ============================================================
   移动端适配
   ============================================================ */

/* 移动端顶部栏 */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #1e1e2d;
    color: #fff;
    z-index: 1020;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
}

.mobile-topbar .btn-link {
    text-decoration: none;
    color: #fff !important;
}

/* 移动端侧栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

/* 小屏幕：768px 以下 */
@media (max-width: 767.98px) {
    .mobile-topbar {
        display: flex;
    }

    body {
        padding-top: 50px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px;
        z-index: 999;
    }

    body.sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-mobile-open .sidebar-overlay {
        display: block;
    }

    body.sidebar-mobile-open {
        overflow: hidden;
    }

    /* 移动端强制显示菜单文字 */
    .sidebar .nav-link span,
    .sidebar .nav-section,
    .sidebar-brand > span {
        display: inline !important;
    }

    .sidebar-brand {
        justify-content: flex-start !important;
        padding: 1rem 1.25rem !important;
    }

    .sidebar-brand > i {
        margin-right: 0.5rem !important;
    }

    .sidebar .nav-link {
        justify-content: flex-start !important;
        text-align: left !important;
        padding: 0.625rem 1.25rem !important;
    }

    .sidebar .nav-link i {
        margin-right: 0.625rem !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .main-header {
        padding: 0.625rem 1rem;
    }

    .main-header .page-title {
        font-size: 1rem;
    }

    .page-content {
        padding: 0.75rem;
    }

    .card {
        border-radius: 8px;
    }

    /* 表格在小屏上滚动 */
    .table-responsive {
        font-size: 0.8rem;
    }

    .table-responsive .btn-sm {
        padding: 0.15rem 0.3rem;
        font-size: 0.75rem;
    }

    .table-responsive th,
    .table-responsive td {
        white-space: nowrap;
        padding: 0.4rem 0.5rem;
    }

    /* 统计卡片 */
    .stat-card .stat-value {
        font-size: 1.2rem;
    }

    .stat-card .stat-label {
        font-size: 0.75rem;
    }

    /* 筛选栏行间距 */
    .row.g-2 > [class*="col-"] {
        margin-bottom: 0.5rem;
    }

    /* 模态框全屏 */
    .modal-dialog:not(.modal-xl) {
        margin: 0.5rem;
    }
}

/* 平板：768-992px */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        width: 200px;
    }
    .main-content {
        margin-left: 200px;
    }
    body.sidebar-collapsed .main-content {
        margin-left: 60px;
    }
}
