/* ============================================================
   Survin Manager 전용 보정 CSS
   style.css 위에 덮어쓰는 레이아웃·간격 조정
   ============================================================ */

html, body { height: 100%; background: var(--background-color); }
body {
  /* style.css·bootstrap.css 가 지정한 Pretendard 우선.
     Pretendard 가 로드되지 않은 경우 Noto Sans KR → 시스템 한글 폰트 순 */
  font-family: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
               "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif !important;
  font-size: 14px;
  line-height: 1.5;
  color: #303133;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* reset.css 가 모든 요소에 monospace 대체 폰트를 박아버린 것을 취소 */
html, body, div, span, p, a, label, button, input, select, textarea,
h1, h2, h3, h4, h5, h6, ul, ol, li, table, thead, tbody, tr, th, td {
  font-family: inherit;
}

/* ── 로그인 화면 ─────────────────────────────── */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b3857 0%, #1a5a7a 100%);
}
.login-card {
    width: 420px;
    padding: 40px 36px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}
.login-logo { text-align: center; margin-bottom: 12px; }
.login-logo img { width: 180px; height: auto; }
.login-sub {
    text-align: center;
    color: #546778;
    font-size: 14px;
    margin-bottom: 28px;
    letter-spacing: 0.3px;
}
.form-error {
    background: #fdecea;
    color: #c0392b;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}
.w-100 { width: 100%; }

/* ── 사이드바 커스터마이즈 ───────────────────── */
.sidebar .navbar-header {
    padding: 20px 12px 12px !important;
    text-align: center;
    position: relative;
}
.sidebar .navbar-header img { max-width: 100px !important; height: auto; }
.sidebar .navbar-title {
    color: rgba(255, 255, 255, 0.92) !important;
    margin-top: 4px;
}
.sidebar .navbar-product {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: rgba(255, 255, 255, 0.95) !important;
    white-space: nowrap;
}
.nav-collapse-btn { top: 14px !important; right: 10px !important; width: 30px !important; height: 30px !important; }
.nav-collapse-btn i { color: rgba(255, 255, 255, 0.85); font-size: 14px !important; }

/* 1차 메뉴 (그룹 헤더 + 단일 링크) — 선명하게 + 굵게 */
.sidebar ul.nav > li > a {
    padding: 11px 18px;
    display: flex !important;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: #ffffff !important;
    opacity: 1 !important;
    text-decoration: none;
    user-select: none;
}
.sidebar ul.nav > li > a:hover,
.sidebar ul.nav > li > a:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff !important;
    text-decoration: none;
}
.sidebar ul.nav > li > a .fa:first-child {
    margin-right: 12px;
    width: 18px;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
}
.sidebar ul.nav > li > a .caret-right {
    margin-left: auto;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}
.sidebar ul.nav > li > a.active {
    background: rgba(79, 195, 247, 0.15);
    color: #fff !important;
    border-left: 3px solid #4fc3f7;
    padding-left: 15px;
}
/* 사이드바 전체를 펼친 서브메뉴와 같은 톤으로 통일 */
.sidebar {
    background: #092D46 !important;  /* 기존 #0B3857 + overlay 0.18 = 이 색 */
}
/* 열린 그룹 헤더 — 별도 어둡게 하지 않음 (바탕과 동일) */
.sidebar ul.nav > li.has-submenu.open > a {
    background: transparent;
    color: #ffffff !important;
}

/* 2차 메뉴 (서브 항목) — 바탕과 완전 동일, 들여쓰기만으로 구분 */
.sidebar .nav-second-level {
    padding: 2px 0 6px 0 !important;
    background: transparent;
}
.sidebar .nav-second-level li a {
    padding: 8px 18px 8px 48px !important;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85) !important;
    display: block !important;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.sidebar .nav-second-level li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff !important;
    text-decoration: none;
}
.sidebar .nav-second-level li a.active {
    background: #4fc3f7;
    color: #ffffff !important;
    font-weight: 600;
}
.sidebar .nav-second-level li a .fa:first-child {
    margin-right: 10px;
    width: 16px;
    text-align: center;
}

/* ── 메인 영역 ───────────────────────────────── */
#page-wrapper {
    position: relative;
    margin: 0 0 0 250px;
    padding: 0;
    min-height: 100vh;
    transition: margin 0.4s ease;
}
#page-wrapper.nav-collapsed { margin-left: 72px; }

/* 상단바·푸터는 메인 콘텐츠 배경과 동일한 밝은 톤 */
.topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--panel-border-color);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.page-title { font-size: 18px; font-weight: 600; margin: 0; color: #1a3a5c; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-right .user-info { color: #555; font-size: 13px; }

.page-content { padding: 24px 28px; }

#page-wrapper > footer {
    margin: 0 !important;
    padding: 14px 28px;
    background: var(--background-color);
    color: #909399;
    text-align: center;
    font-size: 12px;
    border-top: 1px solid var(--panel-border-color);
}

/* ── 공용 컴포넌트 ───────────────────────────── */
.panel { padding: 20px; }
.panel-heading-with-actions {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 16px; margin-bottom: 16px;
    border-bottom: 1px solid var(--panel-border-color);
}
.panel-heading-with-actions h3 { margin: 0; font-size: 16px; color: #1a3a5c; }
.panel-heading-with-actions .actions { display: flex; gap: 8px; }

.btn { font-size: 13px; padding: 6px 14px; border-radius: 4px; text-transform: none; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary { background: var(--primary-color); color: #fff; border: none; }
.btn-primary:hover { background: #0d4a70; }
.btn-outline-secondary { background: #fff; color: #555; border: 1px solid #ccc; }
.btn-outline-secondary:hover { background: #f4f5f7; }
.btn-warning { background: var(--warning-color); color: #fff; border: none; }
.btn-danger  { background: var(--danger-color);  color: #fff; border: none; }
.btn-success { background: var(--success-color); color: #fff; border: none; }

.form-group { margin-bottom: 14px; }
.form-label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 500; color: #444; }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 2px rgba(11, 56, 87, 0.1); }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* 상태 배지 */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.status-RUNNING  { background: #e8f5e9; color: #2e7d32; }
.status-STOPPED  { background: #eceff1; color: #546e7a; }
.status-CREATING { background: #fff3e0; color: #e65100; }
.status-ERROR    { background: #ffebee; color: #c62828; }
.status-REMOVED  { background: #f5f5f5; color: #999; text-decoration: line-through; }

/* 카드 그리드 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: #fff;
    border: 1px solid var(--panel-border-color);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
.stat-card .stat-label { color: #78889a; font-size: 13px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1a3a5c; }
.stat-card .stat-sub { color: #999; font-size: 12px; margin-top: 4px; }

.stat-card.accent-green  .stat-value { color: var(--success-color); }
.stat-card.accent-red    .stat-value { color: var(--danger-color); }
.stat-card.accent-yellow .stat-value { color: var(--warning-color); }
.stat-card.accent-blue   .stat-value { color: var(--info-color); }

/* Tabulator 스타일 보정 (style.css의 --table-* 변수 활용) */
.tabulator {
    border: 1px solid var(--table-border-color);
    border-radius: 6px;
    background: var(--table-bg-color);
}
.tabulator .tabulator-header {
    background: var(--table-header-bg-color);
    color: var(--table-header-text-color);
    border: none;
}
.tabulator .tabulator-header .tabulator-col {
    background: transparent;
    color: inherit;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}
.tabulator-row.tabulator-row-even { background: transparent; }
.tabulator-row { border-bottom: 1px solid var(--table-border-color); }
.tabulator-row:hover { background: var(--table-hover-bg-color); }
.tabulator-row .tabulator-cell { border-right: 1px solid var(--table-border-color); padding: 8px 12px; }

/* 다이얼로그/모달 */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: #fff; border-radius: 10px; padding: 24px;
    min-width: 420px; max-width: 90vw; max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal-box h3 {
    margin-top: 0; margin-bottom: 16px;
    font-size: 16px; color: #1a3a5c;
    border-bottom: 1px solid #eee; padding-bottom: 12px;
}
.modal-box .modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 20px; padding-top: 16px; border-top: 1px solid #eee;
}

/* Toast */
.toast-container {
    position: fixed; top: 24px; right: 24px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 18px; border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 13px; min-width: 260px;
    animation: slide-in 0.2s ease;
}
@keyframes slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: #edf7ed; color: #2e7d32; border-left: 4px solid #2e7d32; }
.toast-error   { background: #fdeded; color: #c62828; border-left: 4px solid #c62828; }
.toast-warning { background: #fff4e5; color: #e65100; border-left: 4px solid #e65100; }
.toast-info    { background: #e5f6fd; color: #0288d1; border-left: 4px solid #0288d1; }

/* 로그 출력 */
pre.log-view {
    background: #1e1e1e; color: #e0e0e0;
    padding: 14px; border-radius: 6px;
    max-height: 560px; overflow: auto;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px; line-height: 1.6;
}

/* 탭 */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--panel-border-color); margin-bottom: 20px; }
.tab-item {
    padding: 10px 18px; cursor: pointer; font-size: 13px; font-weight: 500;
    color: #78889a; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab-item:hover { color: var(--primary-color); }
.tab-item.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }

/* 반응형 */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    #page-wrapper { margin-left: 0 !important; }
}
