/**
 * Copyright：ChengDu YunSu Technology Company Ltd.
 * Author：Criss
 * File：public/assets/app/css/components.css
 * Date：2026-07-26
 */
/* 第一阶段：基础组件层 */

.erp-search-card {
    border-radius: var(--erp-radius-lg);
}

.erp-search-bar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 输入行与操作按钮同一行垂直居中；helper 放在行外，避免抬高/压低按钮 */
.erp-search-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.erp-search-main {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex: 1;
    min-width: min(100%, 24rem);
    flex-wrap: wrap;
}

.erp-search-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
    line-height: 1.25;
    margin: 0;
}

.erp-search-input-group {
    --erp-search-control-height: 2.375rem;
    flex: 1;
    min-width: 16rem;
    background: rgba(15, 23, 42, 0.03);
    border-radius: 0.625rem;
    align-items: stretch;
    min-height: var(--erp-search-control-height);
}

.erp-search-input-group .input-group-text,
.erp-search-input-group .form-control {
    background: transparent;
    border: 0;
    min-height: var(--erp-search-control-height);
}

.erp-search-input-group .input-group-text {
    display: flex;
    align-items: center;
}

.erp-search-input-group .form-control {
    height: var(--erp-search-control-height);
    padding-top: 0;
    padding-bottom: 0;
    line-height: var(--erp-search-control-height);
}

.erp-search-helper {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
    margin: 0;
}

.erp-search-actions {
    --erp-search-control-height: 2.375rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}

.erp-search-actions .btn,
.erp-search-actions .form-control,
.erp-search-actions .form-select {
    min-height: var(--erp-search-control-height);
    height: var(--erp-search-control-height);
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}

.erp-search-actions .form-control,
.erp-search-actions .form-select {
    padding-top: 0;
    padding-bottom: 0;
    line-height: calc(var(--erp-search-control-height) - 2px);
}

.erp-data-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.erp-data-table-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 767.98px) {
    .erp-search-main {
        min-width: 100%;
    }

    .erp-search-input-group {
        min-width: 100%;
    }

    .erp-search-actions {
        width: 100%;
    }

    .erp-search-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

[data-bs-theme="dark"] .erp-search-label {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .erp-search-helper {
    color: #94a3b8;
}

[data-bs-theme="dark"] .erp-search-input-group {
    background: rgba(255, 255, 255, 0.06);
}

/* 空状态 */
.erp-empty-state-icon {
    font-size: 2rem;
    opacity: 0.45;
    display: inline-block;
}

.erp-empty-state {
    padding: 2.5rem 1rem;
}

/* 分页 */
.erp-pagination-host {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--tblr-border-color, #e6e7e9);
}

.erp-pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.erp-pagination-total {
    margin-right: 0.25rem;
}

/* 页内主内容区：避免 HTMX 标签页高度塌陷 */
.erp-page-root {
    padding-block: 1.25rem 1.5rem;
    padding-inline: 0;
    min-height: 12rem;
}

.erp-tab-content .erp-page-root {
    padding-top: 1rem;
}

/* 单据表：小屏横向滚动；次要列配合 Bootstrap `.d-none.d-md-table-cell` */
.erp-doc-sheet .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.erp-doc-sheet .table {
    min-width: 36rem;
    --erp-doc-control-height: 2.25rem; /* 与表头 .form-control 一致 */
}

.erp-doc-sheet.is-readonly {
    opacity: 0.92;
}

/* 明细网格：与表头同高，单元格内贴边，接近旧版单据录入感 */
.erp-doc-sheet .table > :not(caption) > * > * {
    padding: 0.35rem 0.4rem;
    vertical-align: middle;
}

.erp-doc-sheet .table .form-control,
.erp-doc-sheet .table .form-select {
    min-height: var(--erp-doc-control-height);
    height: var(--erp-doc-control-height);
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    font-size: 0.875rem;
    line-height: 1.25;
    border-radius: var(--tblr-border-radius, 0.25rem);
}

.erp-doc-sheet .table .form-control:focus,
.erp-doc-sheet .table .form-select:focus {
    box-shadow: 0 0 0 0.15rem rgba(var(--tblr-primary-rgb, 32, 107, 196), 0.2);
    z-index: 1;
    position: relative;
}

.erp-doc-sheet .table .form-control[readonly] {
    background-color: var(--tblr-bg-surface-secondary, var(--tblr-gray-50, #f8fafc));
    opacity: 1;
}

.erp-doc-sheet tr.doc-line:focus-within {
    background-color: rgba(var(--tblr-primary-rgb, 32, 107, 196), 0.04);
}

/* 开单页表头控件统一高度，避免与明细视觉脱节 */
.erp-page-root .card .form-control:not(.form-control-sm):not(.form-control-lg),
.erp-page-root .card .form-select:not(.form-select-sm):not(.form-select-lg) {
    min-height: 2.25rem;
}

/* 列表状态图标（启用/禁用、审核等） */
.erp-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    line-height: 1;
    vertical-align: middle;
}

.erp-status-icon .ti {
    font-size: inherit;
}

.erp-doc-toolbar {
    position: sticky;
    bottom: 0.5rem;
    z-index: 5;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.erp-dict-sheet .list-group-item.active {
    background: var(--tblr-primary);
    border-color: var(--tblr-primary);
    color: #fff;
}

.erp-dict-sheet .list-group-item.active .text-secondary {
    color: rgba(255, 255, 255, 0.75) !important;
}

@media (max-width: 767.98px) {
    .erp-page-root {
        padding-block: 0.875rem 1.25rem;
        padding-inline: 0.75rem;
        min-height: 10rem;
    }

    .erp-tab-content .erp-page-root {
        padding-top: 0.75rem;
    }

    /* 未挂 Bootstrap 工具类时的次要列兜底（表头 th / 单元格 td） */
    .erp-doc-sheet .erp-col-secondary {
        display: none;
    }
}

@media (min-width: 768px) {
    .erp-doc-sheet .erp-col-secondary {
        display: table-cell;
    }
}

/* 确认弹窗状态条 */
#erp-ui-confirm-modal .modal-status {
    height: 0.25rem;
}

/* 页面头（业务页通用） */
.erp-page-header-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.erp-page-header-main {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.erp-page-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: var(--erp-radius, 0.5rem);
    background: linear-gradient(135deg, rgba(32, 107, 196, 0.12), rgba(66, 153, 225, 0.08));
    color: var(--erp-brand, #206bc4);
    font-size: 1.375rem;
    flex-shrink: 0;
}

.erp-page-header-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: #0f172a;
}

.erp-page-header-subtitle {
    margin: 0.35rem 0 0;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.45;
    max-width: 42rem;
}

.erp-page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.erp-filter-card .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
}

[data-bs-theme="dark"] .erp-page-header-title { color: #f1f5f9; }
[data-bs-theme="dark"] .erp-page-header-subtitle { color: #94a3b8; }
[data-bs-theme="dark"] .erp-page-header-icon {
    background: linear-gradient(135deg, rgba(32, 107, 196, 0.2), rgba(66, 153, 225, 0.1));
}
[data-bs-theme="dark"] .erp-filter-card .form-label { color: #cbd5e1; }

/* 键值信息列表（关于软件等） */
.erp-kv-list {
    display: grid;
    gap: 0.75rem;
}

.erp-kv-row {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 0.75rem;
    align-items: baseline;
}

.erp-kv-row dt {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
}

.erp-kv-row dd {
    margin: 0;
    font-size: 0.875rem;
    color: #0f172a;
    word-break: break-word;
}

.erp-about-tips {
    padding-left: 1.1rem;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.7;
}

@media (max-width: 575.98px) {
    .erp-kv-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
}

[data-bs-theme="dark"] .erp-kv-row dt { color: #94a3b8; }
[data-bs-theme="dark"] .erp-kv-row dd { color: #e2e8f0; }
[data-bs-theme="dark"] .erp-about-tips { color: #94a3b8; }
