/* ==========================================================================
   ERP System Base Stylesheet
   ========================================================================== */

:root {
    /* Colors */
    --erp-primary: #1a233a;
    --erp-secondary: #0056b3;
    --erp-accent: #e68a00;
    --erp-bg-light: #f8fafc;
    --erp-bg-dark: #f1f5f9;
    --erp-border: #cbd5e1;
    --erp-text-main: #334155;
    --erp-text-muted: #94a3b8;
    --erp-danger: #dc2626;

    /* Dimensions */
    --erp-sidebar-width: 260px;
    --erp-header-height: 50px;
    --erp-tab-height: 35px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Malgun Gothic', '맑은 고딕', dotum, sans-serif;
    font-size: 13px;
    color: var(--erp-text-main);
    background-color: #ffffff;
}

/* ==========================================================================
   Layout (Grid System)
   app.js에서 appContainer.style.display = 'grid' 로 전환 시 적용됨
   ========================================================================== */
#erp-app[style*="display: grid"] {
    display: grid !important;
    grid-template-columns: var(--erp-sidebar-width) 1fr;
    grid-template-rows: var(--erp-header-height) 3px 1fr;
    height: 100vh;
    overflow: hidden;
}

#erp-header {
    grid-column: 1 / 3;
    grid-row: 1;
    background-color: var(--erp-primary);
    padding: 0 20px;
}

.erp-header-bottom-line {
    grid-column: 1 / 3;
    grid-row: 2;
    background: linear-gradient(90deg, #e68a00 0%, #ff9c1a 100%);
}

#erp-sidebar {
    grid-column: 1;
    grid-row: 3;
    background-color: var(--erp-bg-dark);
    border-right: 1px solid var(--erp-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#erp-main {
    grid-column: 2;
    grid-row: 3;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #ffffff;
}

/* ==========================================================================
   Sidebar Menu (Sidebar.js)
   ========================================================================== */
.erp-sidebar-header {
    padding: 12px 15px;
    font-weight: bold;
    color: #475569;
    border-bottom: 1px solid var(--erp-border);
    background-color: #e2e8f0;
    font-size: 14px;
}

.erp-menu-tree-container {
    padding: 10px 0;
}

.erp-menu-toggle, .erp-menu-leaf {
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.erp-menu-toggle:hover, .erp-menu-leaf:hover {
    background-color: #e2e8f0;
}

/* 들여쓰기 처리 */
[data-depth="1"] { padding-left: 15px; }
[data-depth="2"] { padding-left: 30px; font-size: 12px; }
[data-depth="3"] { padding-left: 45px; font-size: 12px; }

.menu-arrow { font-size: 10px; color: var(--erp-text-muted); width: 12px; text-align: center; }
.menu-leaf-icon { font-size: 8px; color: var(--erp-secondary); width: 12px; text-align: center; }

/* ==========================================================================
   Tabs & Main Content (MainContent.js) - 🚀 3D 서류철 업그레이드
   ========================================================================== */
.erp-tabs-bar-container {
    display: flex;
    background: linear-gradient(to bottom, #cbd5e1, #94a3b8); /* 입체감 있는 짙은 배경 */
    border-bottom: 3px solid #0369a1; /* 바닥 지지대 선 */
    height: 38px;
    padding: 0 10px;
    align-items: flex-end;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.erp-tab-item {
    padding: 0 10px;
    height: 30px;
    line-height: 30px;
    background: linear-gradient(to bottom, #f1f5f9 0%, #cbd5e1 100%);
    border: 1px solid #64748b;
    border-bottom: none;
    border-radius: 8px 8px 0 0; /* 서류철 둥근 윗부분 */
    margin-right: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    color: #475569;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.8), 2px 0 4px rgba(0,0,0,0.05); /* 3D 하이라이트 */
    transition: all 0.2s ease;
    position: relative;
}

.erp-tab-item:hover {
    background: linear-gradient(to bottom, #ffffff 0%, #e2e8f0 100%);
    color: #1e293b;
    transform: translateY(-1px);
}

/* 🚀 활성화(선택)된 탭은 위로 튀어나오고 바닥 선을 덮음 */
.erp-tab-item.active {
    background: #ffffff;
    font-weight: bold;
    color: #0369a1;
    border: 1px solid #0369a1;
    border-bottom: 3px solid #ffffff; 
    margin-bottom: -3px; 
    height: 35px;
    line-height: 35px;
    box-shadow: inset 0 3px 0 #0ea5e9, 0 -2px 6px rgba(0,0,0,0.1); /* 위쪽 파란색 형광 효과 */
    z-index: 2;
}

.erp-tab-close {
    font-size: 14px;
    color: #94a3b8;
    border-radius: 50%;
    width: 16px; height: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    margin-left: 4px;
}

.erp-tab-close:hover {
    color: #ffffff;
    background-color: #ef4444;
    font-weight: bold;
    transform: scale(1.1);
}

#erp-dynamic-body-view {
    flex: 1; overflow: auto; padding: 5px 10px; background-color: #ffffff;
}
.erp-empty-session-box {
    display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #94a3b8;
}