/*
 * Report Designer
 */

/* ============================================================
   Layout
   ============================================================ */
.report-designer {
    display: flex;
    gap: 12px;
    height: 100%;
    overflow: hidden;
}

.report-build-left {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    width: 354px;
}

.report-build-right {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   Section common
   ============================================================ */
.report-build-section {

    border: 1px solid var(--color-gray-300);
}

.report-build-section:not(:last-child) {
    margin-bottom: 10px;
}

.report-build-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 7px;
}

.reset-active {
    color: red !important;
}

.reset-active .ico-filtering {
    background-image: url('../../../images/new2020/reset-filtering-red.png');
}

.report-build-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--table-header-bg-color);
    border-bottom: 1px solid var(--color-gray-300);
    color: var(--color-gray-800);
    font-size: 12px;
}

.report-build-head .section-title,
.report-build-section-head .section-title {
    font-weight: 700;
    line-height: 19px;
}

/* ============================================================
   Mapping Design — search bar
   ============================================================ */
.report-build-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.report-build-search .select-crf {
    width: 110px;
    flex-shrink: 0;
}

.input-search-wrap {
    flex: 1;
    position: relative;
}

.input-search-wrap .input-btn-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 0;
    background: url('../../../images/new2020/search.svg') no-repeat center / contain;
    cursor: pointer;
}

/* ============================================================
   Mapping Design — table
   ============================================================ */
.report-build-table-wrap {
    overflow-y: auto;
    position: relative;
    max-height: 426px;
}

.report-build-table-wrap table {
    border-collapse: separate;
    width: 100%;
    font-size: 12px;
}

.report-build-table-wrap table thead th {
    position: sticky;
    top: 0;
}

.report-build-table-wrap table thead tr:first-child th {
    border-top: 0;
}

/* ============================================================
   Formula
   ============================================================ */
.formula-tag-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
}

.tag-formula {
    height: 24px;
    padding: 0 8px 0 28px;
    border-radius: 4px;
    border: 1px solid var(--primary);
    background: var(--color-white) url('../../../images/new2020/function-on.svg') no-repeat 8px center;
    font-size: 12px;
    font-family: inherit;
    color: var(--text-color);
    white-space: nowrap;
    cursor: grab;
    outline: none;
}

.tag-formula:hover {
    background-color: var(--primary-wt-6);
}

.tag-formula:active {
    cursor: grabbing;
    background-color: var(--primary-wt-4);
}

.tag-formula.reset {
    border-color: var(--color-gray-300);
    background-color: var(--color-gray-50);
    background-image: url('../../../images/new2020/function.svg');
}

.tag-formula.reset:hover {
    background-color: var(--color-gray-200);
}

.tag-formula.reset:active {
    border-color: #363636;
    background-color: var(--color-gray-200);
}

.tag-filter {
    height: 24px;
    padding: 0 8px 0 28px;
    border-radius: 4px;
    border: 1px solid var(--primary);
    background: url('../../../images/new2020/tbfilter-on.svg') no-repeat 8px center;
    font-size: 12px;
    font-family: inherit;
    color: var(--text-color);
    white-space: nowrap;
    cursor: pointer;
    outline: none;
}

.mapping-filter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ============================================================
   Advanced Filters
   ============================================================ */
.adv-filter-wrap {
    padding: 6px 0;
}

.adv-filter-logic {
    margin-bottom: 8px;
    padding-inline: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-gray-300);
}

.adv-filter-row-wrap {
    overflow: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 370px;
}

.adv-filter-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-inline: 10px;
}

.adv-filter-row select {
    flex: 1;
}

.btn-trash {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 0;
    background: url('../../../images/new2020/trash.svg') no-repeat center / contain;
    text-decoration: none;
    cursor: pointer;
}

.btn-mapping-refresh {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 0;
    background: url('../../../images/new2020/reset-circle.svg') no-repeat center / contain;
    text-decoration: none;
    cursor: pointer;
}

.btn-mapping-setting {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 0;
    background: url('../../../images/new2020/settings.svg') no-repeat center / contain;
    text-decoration: none;
    cursor: pointer;
}

.adv-no-data {
    color: #99A0AE;
    font-size: 12px;
    text-align: center;
    line-height: 30px;
}


/* Add Filter button (+) */
.btn-add-circle {
    width: 20px;
    height: 20px;
    border: 0;
    background: url('../../../images/new2020/add-on.svg') no-repeat center center;
    cursor: pointer;
}

/* ============================================================
   Mapping Layout
   ============================================================ */
.mapping-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* ============================================================
   Mapping Card Item
   ============================================================ */
.mapping-card-item-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}
.mapping-card-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--color-gray-200);
    background: var(--color-white);
}

.mapping-card-item:hover {
    border-color: #979797;
}

/* drag handle */
.mapping-drag-handle {
    display: inline-block;
    width: 20px;
    height: 20px;
    padding-top: 4px;
    background: url('../../../images/new2020/handle.svg') no-repeat center / contain;
    cursor: grab;
    opacity: 0.5;
}

.mapping-drag-handle:active {
    cursor: grabbing;
}

/* card body */
.mapping-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mapping-card-row,
.mapping-card-sub-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    color: var(--color-gray-400);
    font-size: 12px;
}

.mapping-card-row > span,
.mapping-card-sub-row > span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* BASE toggle button */
.mapping-btn-base {
    background-color: var(--color-gray-300);
    border: 1px solid var(--color-gray-300);
    color: #fff;
}

/* tag Selected */
.mapping-card-item.is-selected {
    border-color: var(--primary);
    background-color: var(--primary-wt-6);
}

.mapping-card-item.is-selected:hover {
    border-color: var(--primary-dk-4);
}

.mapping-card-item.is-selected .mapping-btn-base {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* 함수가 적용된 상태 */
.mapping-card-item.mapping-card-apply {
    background-color: var(--primary-wt-6);
}

/* error */
.mapping-card-item.mapping-error {
    border: 1px dashed var(--color-error);
}

.mapping-card-item.mapping-error:hover {
    border-color: var(--color-error);
}

/* pressed */
.mapping-card-item.is-pressed {
    border-color: var(--primary-dk-4);
    box-shadow: 0 6px 14px 0 rgba(0, 0, 0, 0.24);
}

.mapping-card-item.is-pressed .mapping-drag-handle {
    opacity: 1;
}

/* Visit tag (green) */
.mapping-tag {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    border-radius: 3px;
    background: var(--primary-wt-2);
    color: var(--color-gray-800);
    font-size: 12px;
    flex-shrink: 0;
}

/* Column-specific filter indicator badge */
.tag-col-filter {
    display: inline-flex;
    align-items: center;
    height: 16px;
    padding: 0 5px;
    border-radius: 3px;
    border: 1px solid var(--primary);
    background: var(--color-white);
    color: var(--color-primary);
    font-size: 10px;
    font-weight: 500;
    flex-shrink: 0;
}

/* mapping text */
.mapping-item-label,
.mapping-sep,
.mapping-formula-row-data {
    color: var(--text-color);
    font-size: 12px;
}

/* mapping formula */
.mapping-formula {
    height: 24px;
    padding: 0 8px 0 28px;
    border-radius: 4px;
    border: 1px solid var(--primary);
    background: url('../../../images/new2020/function-on.svg') no-repeat 8px center;
    font-size: 12px;
    color: var(--text-color);
    white-space: nowrap;
    box-sizing: border-box;
}

.mapping-sep {
    margin:0 4px;
}

.mapping-display-name input {
    width: 79px;
}

/* sub-row (집계기준 / 분모) */
/* action buttons */
.mapping-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-top: 1px;
}

.btn-mapping-action {
    display: inline-block;
    width: 20px;
    height: 20px;

}

.btn-mapping-action:hover {
    opacity: 1;
}

.ico-mapping-setting::before {
    content: '⚙';
    font-size: 14px;
    color: var(--color-gray-500);
    line-height: 1;
}

.ico-mapping-refresh {
    background-image: url('../../../images/new2020/ico-gh-refresh.svg');
}

.ico-mapping-delete {
    background-image: url('../../../images/new2020/btn-close.png');
}

/* ============================================================
   Mapping Layout
   ============================================================ */
.mapping-layout {
    margin-top: 12px;
    border: 1px solid var(--color-gray-200);
}


/* ============================================================
   Modal Content
   ============================================================ */
.review-table-wrap .log-table1 {
    border-block: 1px solid var(--border-table-border-color);
}

.review-table-wrap .log-table1 tfoot td {
    background-color: var(--primary-wt-5);
    font-weight: 700;
}

.specific-filter-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex: 1 0 0;
    padding: 10px;
    border: 1px solid var(--color-gray-300);
    background-color: #F4F6F9;
    box-sizing: border-box;
}

.specific-filter-wrap .no-filter {
    color: var(--color-gray-400);
}

.specific-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid var(--color-gray-300);
    background-color: #fff;
    box-sizing: border-box;
}
