/**
 * DataTables 与后台 UI 统一：工具栏、搜索框、分页
 * 主色参考 style.css .btn-primary #323584
 */

.admin-dt-wrapper {
    font-family: 'CircularStd', sans-serif;
    color: #141415;
    width: 100%;
}

/* 活动名称列：避免 DataTables 自动拉得过宽（原可达 400px+） */
.admin-dt-wrapper table.dt-narrow-col-name.dataTable thead th:first-child,
.admin-dt-wrapper table.dt-narrow-col-name.dataTable tbody td:first-child,
.admin-dt-wrapper table.dt-narrow-col-name.dataTable thead th.cell-event-name,
.admin-dt-wrapper table.dt-narrow-col-name.dataTable tbody td.cell-event-name {
    max-width: 200px;
    width: 200px !important;
    min-width: 120px;
    white-space: normal !important;
    word-break: break-word;
    vertical-align: middle;
}

/* 顶部：每页条数 + 搜索 与表格留白 */
.admin-dt-wrapper .dt-row-top {
    margin-left: 0;
    margin-right: 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #ededf9;
}

.admin-dt-wrapper .dt-row-top > [class^="col-"] {
    padding-left: 0;
    padding-right: 0;
}

@media (min-width: 768px) {
    .admin-dt-wrapper .dt-row-top .dt-length-wrap {
        padding-right: 1rem;
    }
    .admin-dt-wrapper .dt-row-top .dt-filter-wrap {
        padding-left: 1rem;
    }
}

/* 每页条数 */
.admin-dt-wrapper div.dataTables_length {
    padding-top: 0;
    margin-bottom: 0;
}

.admin-dt-wrapper div.dataTables_length label {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    font-size: 13px;
    font-weight: 500;
    color: #757575;
    margin-bottom: 0;
}

.admin-dt-wrapper div.dataTables_length select {
    display: inline-block;
    min-width: 4.5rem;
    height: 38px;
    padding: 0.35rem 2rem 0.35rem 0.75rem;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3038;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333584' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 12px 10px;
    border: 1px solid #e3e6ef;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(44, 48, 56, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.admin-dt-wrapper div.dataTables_length select:focus {
    border-color: #323584;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(50, 53, 132, 0.12);
}

/* 搜索 */
.admin-dt-wrapper div.dataTables_filter {
    text-align: right;
    margin-bottom: 0;
}

.admin-dt-wrapper div.dataTables_filter label {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    font-size: 13px;
    font-weight: 500;
    color: #757575;
    margin-bottom: 0;
    width: 100%;
    max-width: 100%;
}

.admin-dt-wrapper div.dataTables_filter input[type="search"] {
    margin-left: 0 !important;
    display: inline-block;
    width: 100%;
    max-width: 280px;
    height: 38px;
    padding: 0.4rem 0.85rem 0.4rem 2.35rem;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3038;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.65rem 50%;
    background-size: 15px 15px;
    border: 1px solid #e3e6ef;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(44, 48, 56, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-dt-wrapper div.dataTables_filter input[type="search"]::placeholder {
    color: #9e9e9e;
}

.admin-dt-wrapper div.dataTables_filter input[type="search"]:focus {
    border-color: #323584;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(50, 53, 132, 0.12);
}

@media (max-width: 767px) {
    .admin-dt-wrapper div.dataTables_filter {
        text-align: left;
    }
    .admin-dt-wrapper div.dataTables_filter label {
        justify-content: flex-start;
    }
    .admin-dt-wrapper div.dataTables_filter input[type="search"] {
        max-width: 100%;
    }
}

/* 底部信息 + 分页 */
.admin-dt-wrapper .dt-row-bottom {
    margin-left: 0;
    margin-right: 0;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
    border-top: 1px solid #ededf9;
}

.admin-dt-wrapper .dt-row-bottom > [class^="col-"] {
    padding-left: 0;
    padding-right: 0;
}

.admin-dt-wrapper div.dataTables_info {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 13px;
    color: #757575;
    white-space: normal;
}

/* ---------- 页脚分页（核心脚本默认 DOM 为 a.paginate_button，不是 ul.pagination） ---------- */
.admin-dt-wrapper div.dataTables_paginate {
    padding-top: 0.35rem;
    padding-bottom: 0.25rem;
    text-align: right;
}

/* 整行分页条：横向排列、统一间距，避免「上页12345…14下页」挤成一串 */
.admin-dt-wrapper .dataTables_paginate.paging_simple_numbers,
.admin-dt-wrapper .dataTables_paginate.paging_full_numbers,
.admin-dt-wrapper .dataTables_paginate.paging_full {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    row-gap: 0.5rem;
}

/* 中间数字页码块（被 span 包住） */
.admin-dt-wrapper .dataTables_paginate > span {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.admin-dt-wrapper .dataTables_paginate a.paginate_button {
    box-sizing: border-box;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0.35rem 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    color: #2c3038;
    background-color: #fff;
    border: 1px solid #e3e6ef;
    border-radius: 8px;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(44, 48, 56, 0.04);
    text-decoration: none !important;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.admin-dt-wrapper .dataTables_paginate a.paginate_button.previous,
.admin-dt-wrapper .dataTables_paginate a.paginate_button.next {
    min-width: auto;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.admin-dt-wrapper .dataTables_paginate a.paginate_button.first,
.admin-dt-wrapper .dataTables_paginate a.paginate_button.last {
    min-width: auto;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.admin-dt-wrapper .dataTables_paginate a.paginate_button:hover:not(.disabled):not(.current) {
    color: #323584;
    background-color: #f4f5fb;
    border-color: #c5c8e8;
}

.admin-dt-wrapper .dataTables_paginate a.paginate_button.current {
    z-index: 1;
    color: #fff !important;
    background-color: #323584 !important;
    border-color: #323584 !important;
    box-shadow: 0 2px 6px rgba(50, 53, 132, 0.25);
    cursor: default;
}

.admin-dt-wrapper .dataTables_paginate a.paginate_button.disabled,
.admin-dt-wrapper .dataTables_paginate a.paginate_button.disabled:hover {
    color: #bdbdbd !important;
    background-color: #fafafa !important;
    border-color: #ededf9 !important;
    cursor: not-allowed;
    opacity: 0.9;
    box-shadow: none;
}

/* 省略号 … */
.admin-dt-wrapper .dataTables_paginate span.ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 2.25rem;
    padding: 0 0.2rem;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #9e9e9e;
    user-select: none;
}

/* 若使用 Bootstrap 分页插件（ul.pagination）时仍生效 */
.admin-dt-wrapper div.dataTables_paginate ul.pagination {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    list-style: none;
    padding-left: 0;
}

.admin-dt-wrapper .pagination .page-item {
    margin: 0;
}

.admin-dt-wrapper .pagination .page-link {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0.35rem 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    color: #2c3038;
    background-color: #fff;
    border: 1px solid #e3e6ef;
    border-radius: 8px;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(44, 48, 56, 0.04);
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.admin-dt-wrapper .pagination .page-item:first-child .page-link,
.admin-dt-wrapper .pagination .page-item:last-child .page-link {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.admin-dt-wrapper .pagination .page-link:hover {
    color: #323584;
    background-color: #f4f5fb;
    border-color: #c5c8e8;
}

.admin-dt-wrapper .pagination .page-item.active .page-link {
    z-index: 1;
    color: #fff;
    background-color: #323584;
    border-color: #323584;
    box-shadow: 0 2px 6px rgba(50, 53, 132, 0.25);
}

.admin-dt-wrapper .pagination .page-item.disabled .page-link {
    color: #bdbdbd;
    background-color: #fafafa;
    border-color: #ededf9;
    cursor: not-allowed;
    opacity: 0.85;
}

/* 表格与工具栏间距 */
.admin-dt-wrapper table.dataTable {
    margin-top: 0.75rem !important;
    margin-bottom: 0.5rem !important;
}

/* 处理中遮罩（若有） */
.admin-dt-wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #ededf9;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(44, 48, 56, 0.08);
    font-size: 14px;
    color: #323584;
    font-weight: 500;
}
