:root {
    --bg-color: #0d0d0d;
    --card-bg: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #999;
    --danger: #ff4d4d;
    --warning: #ffcc00;
    --success: #00e676;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

header {
    padding: 15px 20px;
    text-align: center;
    border-bottom: 1px solid #222;
    position: sticky;
    top: 0;
    background: rgba(13, 13, 13, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
}

h1 { margin: 0; font-size: 1rem; letter-spacing: 3px; color: var(--text-secondary); font-weight: 900; }

#summary-bar { margin-top: 8px; }
.badge { background: #222; padding: 4px 12px; border-radius: 4px; font-weight: bold; font-size: 0.8rem; color: var(--text-secondary); }
.badge.critical { background: var(--danger); color: white; animation: blink 1.5s infinite; }

@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }

#server-list { 
    padding: 12px; 
    display: grid; 
    grid-template-columns: 1fr 1fr; /* 2열 그리드 강제 */
    gap: 10px; 
}

/* 서버 카드 스타일 - 컴팩트하게 변경 */
.server-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 12px;
    border-left: 3px solid #333;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    cursor: pointer;
}

.server-name { 
    font-size: 0.85rem; 
    font-weight: bold; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between; /* 양 끝 정렬 */
    align-items: center;
    width: 100%;
}
.ip-small { font-size: 0.65rem; opacity: 0.6; font-weight: normal; margin-left: 4px; }
.memo-small { font-size: 0.65rem; color: var(--success); opacity: 0.8; font-weight: normal; margin-left: 6px; }
.time-ago { font-size: 0.6rem; color: var(--warning); font-weight: normal; }

.metrics { 
    display: flex; 
    flex-direction: row; /* 한 줄로 표시 */
    gap: 4px; 
    margin-top: 8px; 
}
.metric-item { 
    flex: 1;
    background: rgba(0,0,0,0.3); 
    padding: 4px 2px; 
    border-radius: 4px; 
    display: flex; 
    flex-direction: column; /* 라벨과 수치를 위아래로 */
    align-items: center; 
}
.label { font-size: 0.5rem; opacity: 0.7; margin-bottom: 1px; }
.value { font-size: 0.75rem; font-weight: 800; }

.footer-info { display: none; } /* 메인에선 숨김 */

/* 모달(상세보기) 스타일 */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #1e1e1e;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    border: 1px solid #333;
}

.close-btn { position: absolute; top: 10px; right: 15px; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); }
.spec-list { margin-top: 15px; font-size: 0.85rem; line-height: 1.6; color: var(--text-secondary); }
.spec-item { margin-bottom: 8px; border-bottom: 1px solid #222; padding-bottom: 4px; }
.spec-label { color: var(--text-primary); font-weight: bold; margin-right: 5px; }

/* 메모 섹션 스타일 */
.memo-section { margin-top: 20px; border-top: 1px solid #333; padding-top: 15px; }
.memo-input {
    width: 100%;
    background: #121212;
    border: 1px solid #444;
    color: white;
    padding: 8px;
    border-radius: 4px;
    margin-top: 5px;
    box-sizing: border-box;
}
.save-btn {
    background: var(--success);
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: bold;
    margin-top: 10px;
    cursor: pointer;
    width: 100%;
}
.save-btn:active { opacity: 0.8; }

/* Metrics History Styles */
.metrics-history-section { margin-top: 15px; border-top: 1px solid #333; padding-top: 15px; }
.view-metrics-btn {
    background: #222;
    color: var(--success);
    border: 1px solid var(--success);
    padding: 10px;
    width: 100%;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
}
.view-metrics-btn:hover { background: var(--success); color: black; }
#metrics-history-list {
    margin-top: 10px;
    max-height: 250px;
    overflow-y: auto;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
}
.metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.metrics-table th {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 2px solid #333;
    position: sticky;
    top: 0;
    background: #222;
    color: var(--text-primary);
}
.metrics-table td {
    padding: 6px;
    border-bottom: 1px solid #1a1a1a;
}
.metrics-table tr:nth-child(even) { background: #0a0a0a; }

.loading { text-align: center; padding: 50px; color: var(--text-secondary); font-style: italic; }
