/* ============================================
   Dashboard Styles - KRDS Library Only
   Cavity Platform 대시보드
   ============================================ */

/* 페이지 헤더 */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    margin-bottom: 0.5rem;
    color: #1a1a1a;
    font-weight: 700;
}

.page-description {
    color: #6c757d;
    font-size: 1.1rem;
    margin-bottom: 0;
}

/* 메인 컨텐츠 그리드 (공지사항 3 : 지도 7) */
.main-content-grid {
    display: grid;
    grid-template-columns: 3fr 7fr;
    gap: 2rem;
    align-items: start;
}

/* 왼쪽 컬럼: 공지사항 + 지역 정보 */
.left-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .main-content-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .left-column {
        gap: 1.5rem;
    }
}

/* 공지사항 섹션 개선 */
.notice-section {
    margin-bottom: 0; /* 그리드 레이아웃에서는 margin 제거 */
}

.notice-section .krds-card {
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.notice-section .krds-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.notice-section .krds-card-header {
    padding: 1.5rem;
}

.notice-list {
    min-height: 120px;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.notice-item {
    padding: 1rem;
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.2s ease;
}

.notice-item:last-child {
    border-bottom: none;
}

.notice-item:hover {
    background-color: #f8f9fa;
}

.notice-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.notice-date {
    font-size: var(--krds-pc-font-size-label-xsmall);
    color: #6c757d;
}

.notice-title {
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    transition: color 0.2s ease;
}

.notice-title:hover {
    color: #0057b8;
    text-decoration: underline;
}

.notice-summary {
    color: #6c757d;
    font-size: var(--krds-pc-font-size-label-small);
    line-height: 1.4;
    margin: 0;
}

.loading-message {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-style: italic;
}

/* 통계 카드 그리드 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.bg-primary {
    background: linear-gradient(135deg, #0057b8 0%, #0041a0 100%);
}

.stat-icon.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.stat-icon.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

.stat-icon.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
}

.stat-icon .svg-icon {
    width: 1.75rem;
    height: 1.75rem;
    color: #fff;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin: 0.5rem 0;
}

.stat-value.danger {
    color: #dc3545;
}

.stat-value.success {
    color: #28a745;
}

.stat-value.warning {
    color: #ffc107;
}

/* 지도 섹션 개선 */
.map-section {
    margin-bottom: 2rem;
}

.map-section .krds-card {
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.map-section .krds-card-header {
    padding: 1.5rem;
}

.krds-card-header .header-content {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 0;
    flex-wrap: wrap;
    align-items: flex-start;
}

.header-text h2 {
    color: #1a1a1a;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header-text .text-muted {
    color: #6c757d;
    font-size: var(--krds-pc-font-size-label-small);
}

.year-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.year-selector select {
    min-width: 120px;
}

/* 지도 컨텐츠 레이아웃 개선 - seoul-map-wrapper 100% 너비 */
.map-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 600px;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

/* 지도 영역을 100% 너비로 확장 */
.seoul-map-container {
    width: 100%;
    order: 1;
}

/* 데이터 패널 - 공지사항 아래 배치 */
.left-column .data-panel {
    width: 100%;
    max-width: 100%;
}

.legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.legend-item .krds-badge {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

/* 서울시 지도 래퍼 - 크기 문제 해결 */
.seoul-map-wrapper {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #e9ecef;
    min-height: 650px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: auto;
}

/* SVG 크기 최적화 - 130% 확대 */
.seoul-map-wrapper svg {
    width: 130%;
    height: 130%;
    max-width: 130%;
    max-height: 650px;
    min-height: 520px;
    transform-origin: center center;
}

/* SVG 내부 요소 스타일링 */
#seoul-map path,
#busan-map path {
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
}

#seoul-map path:hover,
#busan-map path:hover {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

/* SVG 내부 텍스트 크기 130% 확대 */
#seoul-map text,
#busan-map text {
    font-size: 130%;
}

/* 부산 지도 라벨 포인터 이벤트 (클릭이 path로 전달되도록) */
#busan-map [id^="label-"] {
    pointer-events: none;
}

/* 부산 지도 라벨 크기 (JS font-size 10 고정) */
#busan-map [id^="label-"] text {
    font-size: 12px !important;
}

/* 데이터 패널 개선 */
.data-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: fit-content;
}

.district-info h3 {
    color: #1a1a1a;
    font-weight: 700;
    margin-bottom: 0.75rem;
    font-size: 1.75rem;
}

.district-info p {
    color: #6c757d;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.district-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.district-stats-detail {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.district-stats-detail .stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.stat-row:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    transform: translateX(4px);
}

.stat-row .label {
    font-weight: 600;
    color: #495057;
}

.stat-row .value {
    font-weight: 700;
    font-size: 1.1rem;
}

.stat-row .value.danger {
    color: #dc3545;
}

.stat-row .value.success {
    color: #28a745;
}

.map-controls {
    display: flex;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e9ecef;
}

.map-controls button {
    flex: 1;
    font-weight: 600;
    transition: all 0.2s ease;
}

.map-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 최근 활동 */
.recent-activity {
    margin-bottom: 2rem;
}

.recent-activity .krds-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background 0.2s;
}

.activity-item:hover {
    background: #e9ecef;
}

.activity-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.bg-primary {
    background: rgba(0, 87, 184, 0.1);
}

.activity-icon .svg-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: #0057b8;
}

.activity-content {
    flex: 1;
}

/* 반응형 디자인 개선 */
@media (max-width: 1200px) {
    .map-content {
        grid-template-columns: 1.5fr 1fr;
        gap: 1.5rem;
    }
    
    .seoul-map-wrapper {
        min-height: 585px;
    }
    
    .seoul-map-wrapper svg {
        max-height: 585px;
        min-height: 455px;
    }
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .map-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .seoul-map-wrapper {
        min-height: 520px;
    }
    
    .seoul-map-wrapper svg {
        max-height: 520px;
        min-height: 390px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .krds-card-header .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .year-selector {
        width: 100%;
        justify-content: space-between;
    }
    
    .year-selector select {
        flex: 1;
        margin-right: 0.75rem;
    }
    
    .map-controls {
        flex-direction: column;
    }
    
    .seoul-map-wrapper {
        padding: 1rem;
        min-height: 455px;
    }
    
    .seoul-map-wrapper svg {
        max-height: 455px;
        min-height: 325px;
    }
}

@media (max-width: 480px) {
    .seoul-map-wrapper {
        padding: 0.75rem;
        min-height: 390px;
    }
    
    .seoul-map-wrapper svg {
        max-height: 390px;
        min-height: 260px;
    }
    
    .data-panel {
        padding: 1rem;
    }
    
    .legend {
        justify-content: center;
    }
}

/* ============================================
   KRDS 고대비 모드 지원
   ============================================ */

[data-krds-mode="high-contrast"] .seoul-map-wrapper {
    background: var(--krds-high-contrast-color-surface-gray-subtle);
    border-color: var(--krds-high-contrast-color-border-gray);
}

[data-krds-mode="high-contrast"] .data-panel {
    background-color: var(--krds-high-contrast-color-surface-white-subtler);
    border-color: var(--krds-high-contrast-color-border-gray-light);
}

[data-krds-mode="high-contrast"] .district-title {
    color: var(--krds-high-contrast-color-text-bolder);
}

[data-krds-mode="high-contrast"] .district-description {
    color: var(--krds-high-contrast-color-text-subtle);
}

[data-krds-mode="high-contrast"] .stat-row {
    background: var(--krds-high-contrast-color-surface-gray-subtler);
    border-color: var(--krds-high-contrast-color-border-gray-light);
}

[data-krds-mode="high-contrast"] .year-selector {
    background-color: var(--krds-high-contrast-color-surface-gray-subtle);
    border-color: var(--krds-high-contrast-color-border-gray-light);
}