/* --- 기본 스타일 --- */
:root {
    --primary-blue: #0d47a1;
    --light-blue: #e3f2fd;
    --background-grey: #f4f6f9;
    --text-dark: #333;
    --text-light: #777;
    --border-color: #e0e0e0;
    --warning-color: #ffc107;
    --critical-color: #d32f2f;
    --safe-color: #4caf50;
}

body {
    margin: 0;
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--background-grey);
    color: var(--text-dark);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- 레이아웃 --- */
.sidebar {
    width: 260px;
    background-color: #ffffff;
    padding: 20px;
    box-sizing: border-box;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex: 0 0 260px; /* 사이드바 폭 고정 및 수축 방지 */
}

.main-content {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
    min-width: 0; /* 그리드 컨텐츠로 인해 사이드바가 수축되는 현상 방지 */
}

/* --- 사이드바 --- */
.sidebar-header {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
}
.sidebar-header i {
    margin-right: 10px;
    font-size: 24px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 15px;
    text-decoration: none;
    color: var(--text-light);
    border-radius: 8px;
    margin-bottom: 5px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-nav li a:hover {
    background-color: var(--light-blue);
    color: var(--primary-blue);
}

.sidebar-nav li a.active {
    background-color: var(--primary-blue);
    color: #fff;
}

.sidebar-nav li a.disabled {
    color: #ccc;
    cursor: not-allowed;
}
.sidebar-nav li a.disabled:hover {
    background-color: transparent;
}

.sidebar-nav li i {
    width: 20px;
    margin-right: 15px;
    text-align: center;
}

/* --- 메인 콘텐츠 --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}
.header h1 {
    margin: 0;
    font-size: 28px;
}

.user-profile {
    display: flex;
    align-items: center;
    font-weight: 500;
}
.user-profile i {
    margin-right: 8px;
    font-size: 18px;
    color: var(--primary-blue);
}

/* KPI 카드 */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-bottom: 25px;
}

.card {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); /* 카드 그림자 원복 */
}
.card-header {
    display: flex;
    align-items: center;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 15px;
    box-shadow: none; /* 헤더 영역 그림자 제거 */
}
.card-header i {
    font-size: 20px;
    margin-right: 12px;
    color: var(--primary-blue);
}
.card-body h2 {
    margin: 0;
    font-size: 32px;
}
.card-body p {
    margin: 5px 0 0 0;
    color: var(--text-light);
    font-size: 14px;
}
.critical-text {
    color: var(--critical-color);
    font-weight: 700;
}

/* 하단 패널 */
.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}
@media (max-width: 1024px) {
    .panels {
        grid-template-columns: 1fr;
    }
}
.panel {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.panel h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

/* 시스템 설정 > 계정 관리 탭 헤더 여백/정렬 */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 15px;
}
.admin-header .title {
    margin: 0;
}

/* 시스템 설정 탭 공통: 각 탭 콘텐츠 상단 여백 확보 */
.tab-content {
    padding-top: 10px;
}

/* 시스템 설정 > 두 번째(계정 관리) 탭만 1,3과 동일 간격 보장 */
#tab-content-container .tab-content[data-content="2"] {
    padding: 20px;
}

.chart-container {
    position: relative;
    height: 300px; /* 차트의 높이를 고정 */
    width: 100%;
}

/* 실시간 경고 피드 테이블 */
.alert-table {
    width: 100%;
    border-collapse: collapse;
}
.alert-table th, .alert-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.alert-table th:nth-child(1), .alert-table td:nth-child(1) { min-width: 110px; white-space: nowrap; }
.alert-table th:nth-child(2), .alert-table td:nth-child(2) { min-width: 90px; white-space: nowrap; }
.alert-table th:nth-child(3), .alert-table td:nth-child(3) { min-width: 120px; white-space: nowrap; }
.alert-table th:nth-child(4), .alert-table td:nth-child(4) { min-width: 280px; }
.alert-table th:nth-child(5), .alert-table td:nth-child(5) { min-width: 100px; white-space: nowrap; }
.alert-table th {
    font-weight: 500;
    color: var(--text-light);
}
.alert-table tbody tr:last-child td {
    border-bottom: none;
}
.alert-table tbody tr {
    transition: background-color 0.2s ease;
}
.alert-table tbody tr:hover {
    background-color: #f9f9f9;
    cursor: pointer;
}
.status-tag {
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    color: #fff;
    font-size: 12px;
}
.status-critical { background-color: var(--critical-color); }
.status-warning { background-color: var(--warning-color); }
.status-safe { background-color: var(--safe-color); }

/* --- 모달 공통 스타일 --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow: hidden;
}
.modal.is-active {
    display: flex;
}
.modal .loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.modal.is-loading .loading-overlay { display: flex; }
.lds-dual-ring { display: inline-block; width: 48px; height: 48px; }
.lds-dual-ring:after { content: " "; display: block; width: 36px; height: 36px; margin: 1px; border-radius: 50%; border: 4px solid #0d47a1; border-color: #0d47a1 transparent #0d47a1 transparent; animation: lds-dual-ring 1.2s linear infinite; }
@keyframes lds-dual-ring { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Global Page Loading Overlay --- */
.page-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}
.page-loading-overlay.is-active { display: flex; }
.modal-background {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.75);
}
.modal-content {
    background-color: #fff;
    border-radius: 8px;
    max-width: 640px;
    width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    position: relative; /* To stack above the background */
}
.modal-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: #f5f5f5;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}
.modal-card-title {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-dark);
}
.modal-card-body {
    padding: 20px;
    overflow-y: auto;
}
.modal-card-foot {
    display: flex;
    justify-content: flex-end;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background-color: #f5f5f5;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}
.delete {
    -moz-appearance: none;
    -webkit-appearance: none;
    background-color: rgba(10,10,10,.2);
    border: none;
    border-radius: 29px;
    cursor: pointer;
    display: inline-block;
    height: 24px;
    width: 24px;
    position: relative;
}
.delete::before, .delete::after {
    background-color: #fff;
    content: "";
    display: block;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translateX(-50%) translateY(-50%) rotate(45deg);
    transform-origin: center center;
    width: 2px;
    height: 12px;
}
.delete::after {
    transform: translateX(-50%) translateY(-50%) rotate(-45deg);
}

/* --- AI 시각화 스타일 (통계 차트 스타일) --- */
.ai-visualization-container {
    background-color: #f0f2f5;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 15px;
}
#ai-visualization-space {
    position: relative;
    height: 320px;
    width: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fdfdfd;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.07) 1px, transparent 1px);
    background-size: 25px 25px;
    border: 1px solid #ccc;
}
.zone {
    position: absolute;
    border-radius: 50%;
    box-sizing: border-box;
}
.danger-zone { 
    width: 100%; 
    height: 100%; 
    border: none;
    background-color: transparent;
}
.warning-zone { 
    width: 65%; 
    height: 65%;
    border: 1px dotted #555;
    background-color: transparent;
}
.safe-zone { 
    width: 35%; 
    height: 35%;
    border: 1px dotted #555;
    background-color: transparent;
}

.zone-label {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 13px;
    font-weight: 700;
    opacity: 0.9;
    font-family: 'Courier New', Courier, monospace;
}
.danger-zone > .zone-label { color: var(--critical-color); }
.warning-zone > .zone-label { color: #555; }
.safe-zone > .zone-label { color: #555; }

#p-normal-point, #v-current-point {
    position: absolute;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 3px 6px rgba(0,0,0,0.25);
    z-index: 10;
}
#p-normal-point {
    background-color: #795548;
    color: white;
    transform: translate(0, 0); /* 초기 위치 (중앙) */
}
#v-current-point {
    background-color: var(--safe-color);
    color: white;
    transform: translate(0, 0); /* JS로 제어될 초기 위치 */
    transition: all 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
#ai-analysis-data {
    font-family: 'Courier New', Courier, monospace;
    background-color: #282a36;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    font-size: 14px;
}
.button.is-info {
    background-color: var(--primary-blue);
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
}
.button.is-info:hover {
    background-color: #0b3d8a;
}

/* --- Footer --- */
.main-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    opacity: 0;
} 