/**
 * YYPAY 管理后台样式
 */

:root {
    --tblr-primary: #206bc4;
    --pay-alipay: #1677ff;
    --pay-wechat: #07c160;
    --pay-usdt: #26a17b;
}

/* ========== 登录页面 ========== */
.login-page {
    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: 380px;
    margin: 1rem;
}
.login-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--tblr-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ========== 主界面 ========== */
.main-app {
    min-height: 100vh;
    display: block !important;
}

/* ========== 侧边栏 ========== */
.navbar-vertical {
    width: 240px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1030;
    background: #1e293b;
    color: #94a3b8;
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.navbar-vertical .navbar-brand {
    color: #fff;
    font-weight: 700;
    padding: 1.25rem 1rem;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    background: #1e293b;
    z-index: 10;
}
@media (max-width: 991.98px) {
    .navbar-vertical .navbar-brand {
        display: none !important;
    }
}
.navbar-vertical .nav-link {
    color: #94a3b8;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.navbar-vertical .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}
.navbar-vertical .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: var(--tblr-primary);
}
.navbar-vertical .nav-link i {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

/* ========== 内容区 ========== */
.page-wrapper {
    margin-left: 240px;
    min-height: 100vh;
    background: #f1f5f9;
}

/* ========== 顶部栏 ========== */
.page-header-bar {
    background: #fff;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.page-header-bar .header-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}
.page-header-bar .header-time {
    color: #64748b;
    font-size: 0.875rem;
}

/* ========== 页面内容 ========== */
.page-body {
    padding: 1.5rem;
}

/* ========== 状态徽章 ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-success { background: #d1fae5; color: #065f46; }
.status-closed { background: #f3f4f6; color: #4b5563; }
.status-refund { background: #fee2e2; color: #991b1b; }

/* ========== 支付方式徽章 ========== */
.pay-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}
.pay-alipay { background: #eff6ff; color: var(--pay-alipay); }
.pay-wechat { background: #f0fdf4; color: var(--pay-wechat); }
.pay-usdt { background: #f0fdfa; color: var(--pay-usdt); }

/* ========== 统计卡片 ========== */
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    height: 100%;
}
.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    word-break: break-all;
}
.stat-card .stat-label {
    color: #64748b;
    font-size: 0.875rem;
}

/* ========== 图表卡片 ========== */
.chart-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.chart-card .chart-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

/* ========== 表格 ========== */
.table-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}
.table-card .card-header {
    background: transparent;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.table-card .card-title {
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}
.table-card .table {
    margin: 0;
}
.table-card .table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}
.table-card .table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}
.table-card .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

/* ========== 模态框 ========== */
.modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.modal-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* ========== 代码块 ========== */
.code-block {
    background: #282c34;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
}
.code-block pre {
    margin: 0;
    color: #abb2bf;
    font-size: 0.875rem;
    line-height: 1.6;
}
.code-block code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* ========== 文档页面 ========== */
.doc-section {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.doc-section h3 {
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--tblr-primary);
}
.doc-section h4 {
    color: #334155;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}
.doc-table {
    width: 100%;
    font-size: 0.875rem;
}
.doc-table th {
    background: #f8fafc;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.doc-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}
.doc-table code {
    background: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.8125rem;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

/* ========== 移动端菜单遮罩 ========== */
.menu-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1028;
    opacity: 0;
    transition: opacity 0.3s;
}
.menu-backdrop.active {
    display: block;
    opacity: 1;
}

/* ========== 移动端顶部栏 ========== */
.mobile-header {
    display: none;
}

/* ========== 桌面端 ========== */
@media (min-width: 992px) {
    .navbar-vertical {
        display: block !important;
        transform: none !important;
    }
    .mobile-header {
        display: none !important;
    }
    .menu-backdrop {
        display: none !important;
    }
}

/* ========== 移动端响应式 ========== */
@media (max-width: 991.98px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    .main-app {
        overflow-x: hidden;
    }
    .navbar-vertical {
        position: fixed;
        transform: translateX(-100%);
        width: 260px;
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        top: 0;
        left: 0;
    }
    .navbar-vertical.open {
        transform: translateX(0);
    }
    .page-wrapper {
        margin-left: 0;
        width: 100%;
        min-width: 0;
    }
    .mobile-header {
        display: flex !important;
        width: 100%;
        background: #1e293b;
        padding: 0.75rem 1rem;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1020;
        box-sizing: border-box;
    }
    .mobile-header .brand {
        color: #fff;
        font-weight: 700;
        font-size: 1.125rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-shrink: 0;
    }
    .mobile-header .navbar-toggler {
        border: none;
        color: #fff;
        padding: 0.5rem;
        background: transparent;
        font-size: 1.5rem;
        line-height: 1;
        cursor: pointer;
        flex-shrink: 0;
    }
    .hide-mobile {
        display: none !important;
    }
    .page-body {
        padding: 0.75rem;
    }
    /* 统计卡片优化 */
    .stat-card {
        padding: 0.75rem;
    }
    .stat-card .d-flex {
        gap: 0.5rem !important;
    }
    .stat-card .stat-value {
        font-size: 1.125rem;
    }
    .stat-card .stat-label {
        font-size: 0.6875rem;
    }
    .stat-card .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        flex-shrink: 0;
    }
    .row.g-3 {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.5rem;
    }
    /* 图表卡片优化 */
    .chart-card {
        padding: 0.875rem;
    }
    .chart-card .chart-title {
        font-size: 0.875rem;
    }
    /* 表格优化 */
    .table-card {
        border-radius: 0;
        margin: 0 -0.75rem;
    }
    .table-card .card-header {
        padding: 0.75rem;
        flex-direction: column;
        align-items: stretch;
    }
    .table-card .card-title {
        font-size: 0.9375rem;
        margin-bottom: 0.5rem;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    .table-card .table th,
    .table-card .table td {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }
    .table-card .empty-state {
        padding: 2rem 1rem;
        font-size: 0.875rem;
    }
    /* 分页优化 */
    .pagination-wrapper {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }
    .pagination-wrapper .pagination {
        flex-wrap: wrap;
    }
    .pagination .page-link {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    /* 模态框优化 */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    .modal-body {
        padding: 1rem;
    }
    .modal .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .modal .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    /* 文档页面优化 */
    .doc-section {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 0;
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }
    .doc-section h3 {
        font-size: 1rem;
    }
    .doc-section h4 {
        font-size: 0.875rem;
    }
    .doc-table {
        font-size: 0.75rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .doc-table th,
    .doc-table td {
        padding: 0.375rem 0.5rem;
        white-space: nowrap;
    }
    .code-block {
        padding: 0.75rem;
        border-radius: 4px;
        margin: 0 -0.25rem;
    }
    .code-block pre {
        font-size: 0.75rem;
    }
    /* 按钮优化 */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    .btn-group-sm .btn {
        padding: 0.25rem 0.375rem;
    }
    /* 下拉菜单优化 */
    .dropdown-menu {
        font-size: 0.8125rem;
    }
    .dropdown-item {
        padding: 0.5rem 0.75rem;
    }
}

/* ========== 超小屏幕 ========== */
@media (max-width: 374px) {
    .stat-card .stat-value {
        font-size: 1rem;
    }
    .stat-card .stat-icon {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }
    .page-body {
        padding: 0.5rem;
    }
    .row.g-3 {
        --bs-gutter-x: 0.375rem;
        --bs-gutter-y: 0.375rem;
    }
}

/* ========== 筛选表单 ========== */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.filter-form .form-control,
.filter-form .form-select {
    width: auto;
    min-width: 120px;
}
@media (max-width: 767.98px) {
    .filter-form {
        width: 100%;
        gap: 0.375rem;
    }
    .filter-form .form-control,
    .filter-form .form-select {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
        font-size: 0.8125rem;
        padding: 0.375rem 0.5rem;
    }
    .filter-form .btn {
        flex: 0 0 auto;
    }
}

/* ========== 分页 ========== */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.pagination-wrapper .pagination {
    margin: 0;
}

/* ========== 页面隐藏 ========== */
.page-content {
    display: none;
}
.page-content.active {
    display: block;
}

/* ========== 按钮图标 ========== */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
