/* =============================================
   SGS 프론트엔드 대시보드 스타일
   syu-adm 테마 디자인 시스템 준수
   ============================================= */

/* 대시보드 컨테이너 */
.sgs-dashboard {
    max-width: 1280px;
    margin: 0 auto;
    padding: 60px 40px 50px;
}

.sgs-dashboard-title {
    text-align: center;
    font-size: 1.72em;
    font-weight: bold;
    color: #2e3235;
    line-height: 1.4em;
    margin-bottom: 8px;
}

.sgs-dashboard-subtitle {
    text-align: center;
    font-size: 1em;
    color: #888e95;
    line-height: 1.5em;
    margin-bottom: 35px;
}

/* 필터 영역 */
.sgs-filter-bar {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 35px;
    padding: 16px 24px;
    background: #f1f3f6;
    border: solid 1px #ccd0d7;
}

.sgs-filter-bar select {
    padding: 8px 16px;
    border: solid 1px #ccd0d7;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    min-width: 140px;
    transition: all ease-out 0.2s;
    -webkit-transition: all ease-out 0.2s;
}

.sgs-filter-bar select:focus {
    outline: none;
    border-color: #125fac;
}

.sgs-filter-bar label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #575d64;
}

/* 세그먼트 버튼 래퍼 */
.sgs-filter-segment-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sgs-filter-segment-label {
    font-size: 14px;
    font-weight: 500;
    color: #575d64;
    white-space: nowrap;
}

/* 세그먼트 버튼 그룹 */
.sgs-segment-group {
    display: flex;
    border: solid 1px #ccd0d7;
    border-radius: 4px;
    overflow: hidden;
}

.sgs-segment-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    border: none;
    border-right: solid 1px #ccd0d7;
    font-size: 13px;
    font-weight: 500;
    color: #575d64;
    cursor: pointer;
    transition: all ease-out 0.15s;
    -webkit-transition: all ease-out 0.15s;
    white-space: nowrap;
    line-height: 1;
}

.sgs-segment-btn:last-child {
    border-right: none;
}

.sgs-segment-btn:hover {
    background: #eef3fb;
    color: #125fac;
}

.sgs-segment-btn.active {
    background: #125fac;
    color: #fff;
}

.sgs-segment-btn.active:hover {
    background: #0e4e8f;
}

/* 건수 배지 */
.sgs-seg-badge {
    display: inline-block;
    min-width: 28px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Open Sans', sans-serif;
    border-radius: 20px;
    text-align: center;
    line-height: 1.4;
    transition: all ease-out 0.2s;
    -webkit-transition: all ease-out 0.2s;
}

/* 비활성 배지 */
.sgs-segment-btn:not(.active) .sgs-seg-badge {
    background: #e8edf5;
    color: #575d64;
}

/* 활성 배지 — 흰 반투명 */
.sgs-segment-btn.active .sgs-seg-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* 국내 버튼 비활성 배지: 파란 계열 */
#sgs-seg-domestic:not(.active) .sgs-seg-badge {
    background: #deeaf8;
    color: #125fac;
}

/* 해외 버튼 비활성 배지: 청록 계열 */
#sgs-seg-overseas:not(.active) .sgs-seg-badge {
    background: #d5f3f1;
    color: #30c0b7;
}


/* KPI 카드 그리드 */
.sgs-kpi-grid {
    display: flex;
    gap: 0;
    width: 100%;
    margin-bottom: 35px;
}

.sgs-kpi-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border-top: solid 3px #2e3235;
    border-bottom: solid 1px #ccd0d7;
    border-right: solid 1px #ccd0d7;
    padding: 20px 18px;
    position: relative;
}

.sgs-kpi-card:last-child {
    border-right: none;
}

/* 순번 원형 배지 */
.sgs-kpi-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: #e8edf5;
    color: #125fac;
    font-size: 14px;
    font-weight: bold;
    font-family: 'Open Sans', sans-serif;
}

.sgs-kpi-body {
    flex: 1;
}

.sgs-kpi-label {
    font-size: 0.82em;
    font-weight: bold;
    color: #888e95;
    margin-bottom: 4px;
    line-height: 1.4em;
}

.sgs-kpi-value-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.sgs-kpi-value {
    font-size: 2em;
    font-weight: bold;
    color: #2e3235;
    line-height: 1.1em;
    font-family: 'Open Sans', sans-serif;
}

.sgs-kpi-unit {
    font-size: 0.86em;
    color: #888e95;
    line-height: 1.4em;
}

/* Top 3 카드 */
.sgs-kpi-top3 {
    flex: 1.3;
}

.sgs-top3-icons {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.sgs-top3-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sgs-top3-icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.sgs-top3-icon svg {
    width: 28px;
    height: 28px;
}

.sgs-top3-goal-num {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 9px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Open Sans', sans-serif;
}

.sgs-top3-name {
    font-size: 10px;
    color: #575d64;
    text-align: center;
    white-space: nowrap;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* 차트 영역 */
.sgs-charts-row {
    display: table;
    table-layout: fixed;
    width: 100%;
    margin: 0 -10px 40px;
}

.sgs-chart-box {
    display: table-cell;
    vertical-align: top;
    background: #fff;
    border-top: solid 3px #2e3235;
    border-bottom: solid 1px #ccd0d7;
    padding: 24px;
    width: 50%;
}

.sgs-chart-box + .sgs-chart-box {
    border-left: solid 1px #ccd0d7;
}

.sgs-chart-box h3 {
    font-size: 1.15em;
    font-weight: bold;
    color: #2e3235;
    line-height: 1.4em;
    margin: 0 0 16px;
}

.sgs-chart-canvas-wrap {
    height: 280px;
    position: relative;
}

/* SDG 아이콘 그리드 */
.sgs-sdg-section {
    margin-bottom: 40px;
}

.sgs-sdg-section h2 {
    font-size: 1.4em;
    font-weight: bold;
    color: #2e3235;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.4em;
}

.sgs-sdg-grid {
    display: flex;
    flex-wrap: wrap;
    margin: -5px;
}

.sgs-sdg-item {
    flex: 0 0 calc(100% / 9 - 10px);
    margin: 5px;
    text-align: center;
    padding: 16px 4px;
    cursor: pointer;
    transition: all ease-out 0.2s;
    -webkit-transition: all ease-out 0.2s;
    -moz-transition: all ease-out 0.2s;
    -ms-transition: all ease-out 0.2s;
    background: #fff;
    border-bottom: solid 1px #ccd0d7;
}

.sgs-sdg-item:hover {
    background: #f6f9fd;
}

.sgs-sdg-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    padding: 10px;
}

.sgs-sdg-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.sgs-sdg-name {
    font-size: 0.86em;
    font-weight: bold;
    color: #2e3235;
    margin-bottom: 4px;
    line-height: 1.3em;
}

.sgs-sdg-stats {
    font-size: 0.86em;
    color: #888e95;
    line-height: 1.4em;
}

/* 모달 */
#sgs-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1100;
}

#sgs-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

#sgs-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    background: #fff;
    max-width: 860px;
    width: 92%;
    max-height: 82vh;
    overflow-y: auto;
    z-index: 1200;
    -webkit-box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

/* 모달 헤더 */
#sgs-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 60px 20px 24px;
    border-bottom: solid 3px #2e3235;
    position: relative;
    background: #f8f9fb;
}

#sgs-modal-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

#sgs-modal-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

#sgs-modal-title-wrap {
    flex: 1;
    min-width: 0;
}

#sgs-modal-goal-num {
    font-size: 0.86em;
    font-weight: bold;
    font-family: 'Open Sans', sans-serif;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 2px;
}

#sgs-modal-title {
    font-size: 1.4em;
    font-weight: bold;
    color: #2e3235;
    line-height: 1.3em;
    margin: 0 0 4px;
}

#sgs-modal-count {
    font-size: 0.86em;
    color: #888e95;
    line-height: 1.4em;
    margin: 0;
}

/* 모달 닫기 버튼 */
#sgs-modal-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 52px;
    height: 52px;
    background: #125fac;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #fff;
    line-height: 52px;
    text-align: center;
    padding: 0;
    transition: all ease-out 0.2s;
    -webkit-transition: all ease-out 0.2s;
}

#sgs-modal-close:hover {
    background: #3f8af9;
}

/* 모달 본문 */
#sgs-modal-body {
    padding: 24px 24px 32px;
}

.sgs-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border-top: solid 2px #2e3235;
}

.sgs-modal-table th {
    background: #f1f3f6;
    padding: 12px 8px;
    text-align: center;
    font-size: 1em;
    font-weight: bold;
    color: #2e3235;
    line-height: 1.4em;
    border-bottom: solid 1px #ccd0d7;
}

.sgs-modal-table td {
    padding: 12px 8px;
    border-bottom: solid 1px #ccd0d7;
    color: #575d64;
    text-align: center;
    line-height: 1.5em;
    vertical-align: middle;
}

.sgs-modal-table .sgs-modal-name {
    text-align: left;
    font-weight: bold;
    color: #2e3235;
}

.sgs-modal-table .sgs-modal-num {
    font-family: 'Open Sans', sans-serif;
    font-weight: bold;
    color: #125fac;
}

.sgs-modal-table tr:hover td {
    background: #f6f9fd;
}

/* 배지: 국내/해외 */
.sgs-modal-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.87em;
    border-radius: 4px;
    font-weight: bold;
    line-height: 1.4em;
}

.badge-domestic {
    color: #125fac;
    border: solid 1px #125fac;
}

.badge-overseas {
    color: #30c0b7;
    border: solid 1px #30c0b7;
}

.sgs-modal-empty {
    text-align: center;
    color: #888e95;
    padding: 40px;
    font-size: 1em;
}

/* 반응형 */
@media screen and (max-width: 1279px) and (min-width: 1024px) {
    .sgs-dashboard {
        padding: 50px 40px;
    }

    .sgs-dashboard-title {
        font-size: 1.6em;
    }

    .sgs-kpi-value {
        font-size: 1.95em;
    }
}

@media screen and (max-width: 1023px) and (min-width: 1px) {
    .sgs-dashboard {
        padding: 40px 20px;
    }

    .sgs-dashboard-title {
        font-size: 1.5em;
    }

    .sgs-dashboard-subtitle {
        margin-bottom: 25px;
    }

    .sgs-kpi-grid {
        display: block;
    }

    .sgs-kpi-card {
        display: block;
        border-left: none;
        border-top: solid 1px #ccd0d7;
    }

    .sgs-kpi-card:first-child {
        border-top: solid 3px #2e3235;
    }

    .sgs-kpi-card + .sgs-kpi-card {
        border-left: none;
    }

    .sgs-charts-row {
        display: block;
    }

    .sgs-chart-box {
        display: block;
        width: 100%;
        margin-bottom: 20px;
    }

    .sgs-chart-box + .sgs-chart-box {
        border-left: none;
    }

    .sgs-sdg-item {
        flex: 0 0 calc(100% / 6 - 10px);
    }

    .sgs-kpi-value {
        font-size: 1.7em;
    }

    #sgs-modal-content {
        padding: 0 20px;
        width: auto;
        left: 20px;
        right: 20px;
        transform: translateY(-50%);
        -webkit-transform: translateY(-50%);
        -moz-transform: translateY(-50%);
        -ms-transform: translateY(-50%);
    }
}

@media screen and (max-width: 767px) and (min-width: 1px) {
    .sgs-kpi-grid {
        display: flex;
        flex-wrap: wrap;
    }

    .sgs-kpi-card {
        width: 50%;
        display: block;
        border: solid 1px #ccd0d7;
        margin: -1px 0 0 -1px;
    }

    .sgs-kpi-card:nth-child(-n+2) {
        border-top: solid 3px #2e3235;
    }

    .sgs-sdg-item {
        flex: 0 0 calc(100% / 4 - 10px);
    }

    .sgs-filter-bar {
        flex-direction: column;
    }
}

@media screen and (max-width: 639px) and (min-width: 1px) {
    .sgs-dashboard {
        padding: 30px 20px;
    }

    .sgs-dashboard-title {
        font-size: 1.4em;
    }

    .sgs-sdg-item {
        flex: 0 0 calc(100% / 3 - 10px);
    }

    .sgs-chart-canvas-wrap {
        height: 220px;
    }

    #sgs-modal-content {
        width: 95%;
        max-height: 88vh;
    }

    #sgs-modal-header {
        padding: 16px 52px 16px 16px;
    }

    #sgs-modal-icon {
        width: 44px;
        height: 44px;
    }

    #sgs-modal-title {
        font-size: 1.2em;
    }

    #sgs-modal-close {
        width: 44px;
        height: 44px;
        line-height: 44px;
        font-size: 18px;
    }

    #sgs-modal-body {
        padding: 16px 16px 24px;
    }
}
