/* ==============================
   차트 패널 스타일 (KRDS 퍼블리싱)
   ============================== */

/* 차트 패널 전체 너비 설정 */
#barChartPanelContent,
#pieChartPanelContent,
#lineChartPanelContent,
#boxplotPanelContent,
#histogramPanelContent {
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

#barChartPanelContent .box-area,
#pieChartPanelContent .box-area,
#lineChartPanelContent .box-area,
#boxplotPanelContent .box-area,
#histogramPanelContent .box-area {
    width: 100%;
}

#barChartPanelContent .box-inner,
#pieChartPanelContent .box-inner,
#lineChartPanelContent .box-inner,
#boxplotPanelContent .box-inner,
#histogramPanelContent .box-inner {
    width: 100%;
}

#barChartPanelContent .form-wrap,
#pieChartPanelContent .form-wrap,
#lineChartPanelContent .form-wrap,
#boxplotPanelContent .form-wrap,
#histogramPanelContent .form-wrap {
    width: 100%;
}

#barChartPanelContent .custom-select,
#pieChartPanelContent .custom-select,
#lineChartPanelContent .custom-select,
#boxplotPanelContent .custom-select,
#histogramPanelContent .custom-select {
    width: 100%;
}

#barChartPanelContent .tab-content,
#pieChartPanelContent .tab-content,
#lineChartPanelContent .tab-content,
#boxplotPanelContent .tab-content,
#histogramPanelContent .tab-content {
    width: 100%;
}

/* ==============================
   탭 영역 스타일 (KRDS)
   ============================== */

.krds-tab-area {
    width: 100%;
}

.krds-tab-area .tab-list {
    display: flex;
    gap: 0.4rem;
    padding: 0.4rem;
    background-color: var(--krds-color-light-gray-90, #e5e5e5);
    border-radius: var(--krds-radius-medium1, 6px);
}

.krds-tab-area .btn-tab {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: none;
    background-color: transparent;
    border-radius: var(--krds-radius-small, 4px);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--krds-color-light-gray-40, #666);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.krds-tab-area .btn-tab:hover {
    color: var(--krds-color-light-gray-20, #333);
    background-color: var(--krds-color-light-gray-95, #f5f5f5);
}

.krds-tab-area .btn-tab.active {
    background-color: var(--krds-color-white, #fff);
    color: var(--krds-color-light-primary-40, #0066cc);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.krds-tab-area.small .btn-tab {
    padding: 0.6rem 1rem;
    font-size: 1.3rem;
}

/* 탭 컨텐츠 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 색상/슬라이스 리스트 */
#color-list {
    max-height: 400px;
    overflow-y: auto;
}

/* 레이어 그룹 래퍼 */
.layer-group-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* 차트 패널 레이어 그룹 스타일 */
#chartActiveLayersList .layer-group {
    cursor: pointer;
    transition: all 0.2s ease;
    padding-top: 12px;
    padding-bottom: 12px;
}

#chartActiveLayersList .layer-group:hover {
    background-color: var(--krds-color-light-gray-90);
}

#chartActiveLayersList .layer-group.layer-selected {
    border-color: var(--krds-color-light-primary-40);
    background-color: var(--krds-color-light-primary-95);
}

/* 레이어 아이템 (town-list 스타일 적용) */
.layer-item {
    width: 100%;
    padding: var(--krds-padding-3) var(--krds-padding-5);
    background-color: var(--krds-color-light-gray-95);
    border-radius: var(--krds-radius-medium1);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.8rem;
}

.layer-item:hover {
    background-color: var(--krds-color-light-gray-90);
}

.layer-item:last-child {
    margin-bottom: 0;
}

.layer-item-content {
    display: flex;
    flex-direction: column;
    row-gap: 0.6rem;
    width: 100%;
}

.layer-item-icon {
    width: 1.2rem;
    height: 1.2rem;
    background-color: var(--krds-color-light-primary-40);
    border-radius: 50%;
    flex-shrink: 0;
}

.layer-item-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.layer-item-name {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--krds-color-light-gray-10);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.layer-item-type {
    font-size: 1.2rem;
    color: var(--krds-color-light-gray-50);
    margin-top: 0.4rem;
}

.layer-item-content > .svg-icon {
    flex-shrink: 0;
    color: var(--krds-color-light-gray-50);
}
/* 선택된 레이어 정보 */
.selected-layer-info-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
}

/* 토글 스위치 래퍼 */
.toggle-switch-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
}

/* 로딩/빈 상태 메시지 */
.layer-group-wrapper .layer-empty-text {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.4rem 1.6rem;
}

.layer-group-wrapper .layer-empty-text.show {
    display: flex;
}

/* 레이어 선택 섹션 빈 상태 */
#layerSelectionSection .layer-group-wrapper {
    width: 100%;
}

#layerSelectionSection .layer-empty-text {
    width: 100%;
}

.empty-text {
    font-size: 1.4rem;
    color: var(--krds-color-light-gray-50);
    text-align: center;
}

.loading-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 2.4rem;
    width: 100%;
    background-color: var(--krds-color-light-gray-95);
    border-radius: 0.6rem;
}

.loading-message .empty-text {
    margin-top: 0.8rem;
}

/* ==============================
   차트 섹션 (KRDS 모달 구조)
   ============================== */

/* 차트 섹션을 KRDS 모달로 스타일링 */
.chart-section.krds-modal {
    position: fixed;
    z-index: 9999;
}

.chart-section.krds-modal .modal-dialog {
    width: 80rem;
    max-width: 90vw;
}

.chart-section.krds-modal .modal-content {
    background-color: #ffffff;
}

.chart-section.krds-modal .modal-conts {
    overflow: visible;
}

.chart-section.krds-modal .figure-area {
    width: 100%;
    overflow: visible;
    background-color: #ffffff;
}

/* 차트 높이 클래스 */
.chart-section.krds-modal .figure-area.h400 {
    height: 40rem;
    background-color: #ffffff;
}

.chart-section.krds-modal .figure-area.h200 {
    height: 20rem;
    background-color: #ffffff;
}

/* SVG 요소 스타일 */
.chart-section.krds-modal .figure-area svg {
    display: block;
}

/* 차트 편집 중 하이라이트 */
.chart-section.krds-modal .modal-header.chart-header-editing {
    background: linear-gradient(to bottom, #dbeafe, #bfdbfe) !important;
    border-bottom: 2px solid var(--krds-color-light-primary-40) !important;
    box-shadow: 0 2px 8px rgba(26, 92, 255, 0.3) !important;
    animation: pulse-highlight 2s ease-in-out infinite;
}

@keyframes pulse-highlight {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(26, 92, 255, 0.3);
    }
    50% {
        box-shadow: 0 2px 12px rgba(26, 92, 255, 0.5);
    }
}

/* 차트 닫기 버튼 */
.chart-section .chart-close-btn {
    display: none;
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    background: transparent;
    border: none;
    font-size: 2.4rem;
    color: var(--krds-color-light-gray-50);
    cursor: pointer;
    width: 2.8rem;
    height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.4rem;
    transition: all 0.2s ease;
}

.chart-section .chart-close-btn:hover {
    background-color: var(--krds-color-light-danger-90);
    color: var(--krds-color-light-danger-40);
}

/* 대시보드 추가 버튼 하단 고정 */
#finalActions {
    margin-top: auto;
    border-top: 1px solid var(--krds-color-light-gray-90);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* ==============================
   숫자 필드 선택 모달 (KRDS 스타일)
   ============================== */

/* 모달 오버레이 */
.field-select-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.field-select-modal.show {
    display: flex;
}

/* 모달 컨텐츠 */
.field-select-modal-content {
    background-color: var(--krds-color-white, #fff);
    border-radius: var(--krds-radius-medium2, 8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 36rem;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 모달 헤더 */
.field-select-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.6rem 2rem;
    border-bottom: 1px solid var(--krds-color-light-gray-90, #e5e5e5);
    background-color: var(--krds-color-light-gray-95, #f5f5f5);
}

.field-select-modal-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--krds-color-light-gray-10, #1a1a1a);
}

.field-select-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.8rem;
    border: none;
    background-color: transparent;
    border-radius: var(--krds-radius-small, 4px);
    cursor: pointer;
    color: var(--krds-color-light-gray-50, #666);
    transition: all 0.2s ease;
}

.field-select-modal-close:hover {
    background-color: var(--krds-color-light-gray-90, #e5e5e5);
    color: var(--krds-color-light-gray-10, #1a1a1a);
}

/* 모달 바디 */
.field-select-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 검색 영역 */
.field-search-wrap {
    position: relative;
    padding: 1.2rem 1.6rem;
    border-bottom: 1px solid var(--krds-color-light-gray-90, #e5e5e5);
}

.field-search-wrap .krds-input {
    padding-left: 3.6rem;
}

.field-search-icon {
    position: absolute;
    left: 2.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--krds-color-light-gray-50, #666);
    font-size: 1.4rem;
    pointer-events: none;
}

/* 필드 옵션 목록 */
.field-options-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem;
    max-height: 32rem;
}

/* 필드 옵션 아이템 */
.field-options-wrap .option {
    display: flex;
    align-items: center;
    padding: 1.2rem 1.4rem;
    margin-bottom: 0.4rem;
    border-radius: var(--krds-radius-small, 4px);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1.4rem;
    color: var(--krds-color-light-gray-20, #333);
    background-color: var(--krds-color-white, #fff);
    border: 1px solid transparent;
    word-break: break-all;
}

.field-options-wrap .option:last-child {
    margin-bottom: 0;
}

.field-options-wrap .option:hover {
    background-color: var(--krds-color-light-gray-95, #f5f5f5);
    border-color: var(--krds-color-light-gray-80, #ccc);
}

.field-options-wrap .option.selected {
    background-color: var(--krds-color-light-primary-95, #e6f0ff);
    border-color: var(--krds-color-light-primary-40, #0066cc);
    color: var(--krds-color-light-primary-40, #0066cc);
    font-weight: 500;
}

.field-options-wrap .option.selected::before {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 0.8rem;
    font-size: 1.2rem;
}

/* 빈 상태 */
.field-options-wrap:empty::before {
    content: '선택 가능한 필드가 없습니다.';
    display: block;
    padding: 2.4rem 1.6rem;
    text-align: center;
    color: var(--krds-color-light-gray-50, #666);
    font-size: 1.4rem;
}

/* 모달 푸터 */
.field-select-modal-footer {
    padding: 1.2rem 1.6rem;
    border-top: 1px solid var(--krds-color-light-gray-90, #e5e5e5);
    background-color: var(--krds-color-light-gray-95, #f5f5f5);
}

.field-select-complete-btn {
    width: 100%;
}

/* ==============================
   숫자 필드 목록 (value-fields-list) - 태그 방식
   ============================== */

.value-fields-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    min-height: 3.2rem;
    width: 100%;
}

/* 숫자 필드 태그 */
.value-field-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.6rem;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 1.3rem;
    color: var(--krds-color-light-gray-20, #333);
    animation: fadeInTag 0.2s ease-out;
}

.value-field-tag .tag-label {
    font-weight: 500;
}

.value-field-tag .tag-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--krds-color-light-primary-40, #0066cc);
    transition: all 0.15s ease;
}

.value-field-tag .tag-remove-btn:hover {
    background: var(--krds-color-light-primary-40, #0066cc);
    color: var(--krds-color-white, #fff);
}

.value-field-tag .tag-remove-btn i {
    font-size: 1rem;
}

@keyframes fadeInTag {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 색상 아이템 (계열 탭) */
.color-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    padding: 1rem 1.2rem;
    background-color: var(--krds-color-light-gray-95, #f5f5f5);
    border-radius: var(--krds-radius-small, 4px);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.6rem;
}

.color-item:last-child {
    margin-bottom: 0;
}

.color-item:hover {
    background-color: var(--krds-color-light-gray-90, #e5e5e5);
}

.color-item .color-label {
    font-size: 1.4rem;
    color: var(--krds-color-light-gray-20, #333);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 색상 썸네일 (계열 탭) */
.color-thumbnail {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border-radius: var(--krds-radius-small, 4px);
    border: 1px solid var(--krds-color-light-gray-80, #ccc);
    flex-shrink: 0;
}

#histogramPanelContent input[type="range"] {
    position: relative !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    z-index: 1 !important;
    height: auto !important;
    width: 100% !important;
    -webkit-appearance: auto !important;
    appearance: auto !important;
}

#barChartPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::before,
#pieChartPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::before,
#lineChartPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::before,
#boxplotPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::before,
#histogramPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::before {
    content: none;
}

#barChartPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::after,
#pieChartPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::after,
#lineChartPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::after,
#boxplotPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::after,
#histogramPanelContent .krds-form-check.medium > input[type=checkbox] ~ label::after {
    content: none;
}

#barChartPanelContent input[type=checkbox],
#pieChartPanelContent input[type=checkbox],
#lineChartPanelContent input[type=checkbox],
#boxplotPanelContent input[type=checkbox],
#histogramPanelContent input[type=checkbox] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px !important;
    height: 16px !important;
    border: 2px solid #888;
    border-radius: 4px;
    background-color: var(--krds-light-color-surface-white, #fff);
    cursor: pointer;
    position: relative !important;
}

#barChartPanelContent input[type=checkbox]:checked,
#pieChartPanelContent input[type=checkbox]:checked,
#lineChartPanelContent input[type=checkbox]:checked,
#boxplotPanelContent input[type=checkbox]:checked,
#histogramPanelContent input[type=checkbox]:checked {
    background-color: var(--krds-color-light-primary-40, #0066cc);
    border: 1px solid var(--krds-color-light-primary-30, #0052a3) !important;
}

#barChartPanelContent input[type=checkbox]:checked::after,
#pieChartPanelContent input[type=checkbox]:checked::after,
#lineChartPanelContent input[type=checkbox]:checked::after,
#boxplotPanelContent input[type=checkbox]:checked::after,
#histogramPanelContent input[type=checkbox]:checked::after {
    content: "";
    background: url(/static/uis/images/common/ico/ico_checkbox_checked.svg) no-repeat;
    width: 8px;
    height: 8px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

#barChartPanelContent input[type=checkbox]:disabled,
#pieChartPanelContent input[type=checkbox]:disabled,
#lineChartPanelContent input[type=checkbox]:disabled,
#boxplotPanelContent input[type=checkbox]:disabled,
#histogramPanelContent input[type=checkbox]:disabled {
    background-color: var(--krds-color-light-gray-80, #ccc);
    border: 1px solid var(--krds-color-light-gray-70, #bbb) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

#barChartPanelContent input[type=checkbox]:checked:disabled,
#pieChartPanelContent input[type=checkbox]:checked:disabled,
#lineChartPanelContent input[type=checkbox]:checked:disabled,
#boxplotPanelContent input[type=checkbox]:checked:disabled,
#histogramPanelContent input[type=checkbox]:checked:disabled {
    background-color: var(--krds-color-light-gray-80, #ccc);
    border: 1px solid var(--krds-color-light-gray-70, #bbb) !important;
    cursor: not-allowed;
}

#barChartPanelContent input[type=checkbox]:checked:disabled::after,
#pieChartPanelContent input[type=checkbox]:checked:disabled::after,
#lineChartPanelContent input[type=checkbox]:checked:disabled::after,
#boxplotPanelContent input[type=checkbox]:checked:disabled::after,
#histogramPanelContent input[type=checkbox]:checked:disabled::after {
    content: "";
    background: url(/static/uis/images/common/ico/ico_checkbox_checked_disabled.svg) no-repeat center center;
    width: 8px;
    height: 8px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.5;
}

.figure-area {
    color: #000000;
  }