* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #8400e9;
    --primary-hover: #2563eb;
    --success-color: #00c853;
    --danger-color: #ff3d00;
    
    --bg-body: #000000;
    --bg-card: #111111;
    --bg-hover: #222222;
    --border-color: #333333;
    
    --text-main: #ffffff;
    --text-muted: #888888;
    
    --sidebar-width: 260px;
    --header-height: 60px;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

/* --- Layout Structure --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (PC: Fixed Side, Mobile: Hidden Slide) */
#userDisplay {
    margin-bottom:10px;
    font-size:0.9rem;
    color:var(--text-muted) !important;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.sidebar-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.menu-item:hover, .menu-item.active {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

.menu-item.active {
    color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.1);
}

.menu-item i {
    padding-right: 30px;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width); /* PC Default */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Mobile Header (Hamburger) */
.mobile-header {
    display: none; /* PC Hidden */
    height: var(--header-height);
    background-color: #070707;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.monitor-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s;
    
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.monitor-status-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 5px; /* 막대기 너비 */
    height: 100%;
    border-radius: 8px 0 0 8px; /* 왼쪽 모서리만 둥글게 */
    background-color: var(--bord-color); /* 기본/Unknown 상태 색상 */
}

.monitor-status-bar.status-up {
    background-color: var(--success-color);
}

.monitor-status-bar.status-down {
    background-color: var(--danger-color);
}

.hamburger {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar (PC: Fixed) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    position: fixed; /* 고정 위치 */
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto; /* 메뉴가 길어지면 스크롤 */
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    /* 사이드바 너비만큼 밀고, 남은 공간을 정확히 계산 */
    margin-left: var(--sidebar-width); 
    width: calc(100% - var(--sidebar-width)); 
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Content Body */
.content {
    padding: 2rem;
    max-width: 100%;
    width: 100%;
    margin: 0;
}

/* Overlay for Mobile */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    backdrop-filter: blur(2px);
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Public Status Page Styles --- */

.status-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1rem;
    min-height: 100vh;
}

.status-header {
    margin-bottom: 3rem;
    text-align: center;
}

.status-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

/* 전체 시스템 상태 카드 */
.overall-status {
    padding: 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    border: 1px solid transparent;
}

.overall-status.all-good {
    background-color: rgba(0, 200, 83, 0.15);
    border-color: var(--success-color);
    color: var(--success-color);
}

.overall-status.has-issues {
    background-color: rgba(255, 61, 0, 0.15);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* 상태 페이지용 푸터 */
.status-footer {
    margin-top: 4rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

/* --- Responsive (Mobile) --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%); /* Hide by default */
    }
    
    .sidebar.open {
        transform: translateX(0); /* Slide In */
    }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-header {
        display: flex;
    }

    .content {
        padding: 1rem;
    }
}

/* --- Dashboard & Index Specific Components --- */

/* Hero Section (for Index) */
.hero {
    text-align: center;
    padding: 5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-body) 100%);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Monitor Cards */
.monitor-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s;
}

.monitor-card:hover {
    border-color: var(--text-muted);
}

.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.monitor-title h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
}

.monitor-url {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: monospace;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
}
.status-up { background: rgba(0, 200, 83, 0.15); color: var(--success-color); }
.status-down { background: rgba(255, 61, 0, 0.15); color: var(--danger-color); }

/* Uptime Bars */
.uptime-bars {
    display: flex;
    gap: 2px;
    height: 40px;
    margin: 1.5rem 0;
    align-items: flex-end;
}

.bar {
    flex: 1;
    background: #222;
    border-radius: 2px;
    height: 100%;
    position: relative;
    cursor: pointer;
    transition: 0.2s;
}

.bar:hover {
    transform: scaleY(1.15);
    z-index: 10;
}

.bar.up { background: var(--success-color); }
.bar.down { background: var(--danger-color); }
.bar.empty { background: #222; }

/* Tooltip */
.bar-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.bar:hover .bar-tooltip { opacity: 1; }

/* Buttons & Forms */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
    transition: 0.2s;
}
.btn-primary { background: linear-gradient(136deg, var(--primary-color), #070707 70%); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { border-color: var(--text-main); }
.btn-block { width: 100%; display: block; text-align: center; }

input, select {
    width: 100%;
    background: #000;
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
input:focus, select:focus { outline: none; border-color: var(--primary-color); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    backdrop-filter: blur(4px);
}
.modal-content {
    background: var(--bg-card);
    margin: 10% auto;
    width: 90%; max-width: 500px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}