/* Layout specific styles extracted from style.css */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar {
    width: var(--spacing-sidebar-width);
    z-index: 1000;
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    background-color: var(--color-secondary);
    transition: width 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.sidebar.mini {
    width: var(--spacing-sidebar-mini);
}

.sidebar-header {
    height: var(--spacing-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 1.25rem;
    color: var(--color-white);
}

.logo-text {
    position: relative;
    top: -2px;
    display: inline-block;
    vertical-align: middle;
}

.toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 0.625rem;
}

.nav-list {
    padding: 0;
}

.sidebar .nav-item {
    display: block !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 auto 4px auto;
    width: 90%;
}

.nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.875rem 1.25rem;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 0.5rem;
    font-size: 16px;
    box-sizing: border-box;
}

.nav-link:hover {
    background-color: var(--color-primary);
    /* color: var(--color-white); */
}

.nav-item.active>.nav-link {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.icon-box {
    margin-right: 0.75rem;
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar.mini .nav-text,
.sidebar.mini .logo-text,
.sidebar.mini .sidebar-footer {
    display: none;
}

.sidebar.mini .nav-link {
    justify-content: center;
    padding: 1rem 0;
}

.sidebar.mini .icon-box {
    margin-right: 0;
}

.sidebar.mini .nav-item.has-sub>.nav-link::after {
    display: none;
}

.sidebar-footer {
    padding: 1.25rem;
    font-size: 0.625rem;
    color: #666;
    line-height: 1.4;
}

/* --- 1. 1차 메뉴 화살표 --- */
.nav-item.has-sub>.nav-link::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: auto;
    background-color: #ffffff;
    /* 마스크 이미지에 색을 입히는 역할 */
    -webkit-mask-image: url('/assets/img/icon/menu_arrow.svg');
    /* 절대경로로 변경 */
    mask-image: url('/assets/img/icon/menu_arrow.svg');
    /* 절대경로로 변경 */
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: transform 0.3s ease, background-color 0.2s;
}

/* 1차 메뉴가 열렸을 때 (PHP의 'open' 클래스 기준) 화살표 회전 */
.nav-item.has-sub.open>.nav-link::after {
    transform: rotate(180deg);
    background-color: #ffffff;
    /* 열렸을 때 초록색 유지 */
}

/* --- 2. 2차 메뉴 컨테이너 --- */
.sub-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-top: 5px;
}

.nav-item.open .sub-nav {
    max-height: 20rem;
}

/* --- 3. 2차 메뉴 (sub-item) 기본 레이아웃 --- */
.sub-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    /* 아이콘과 텍스트 사이 간격 */
    padding: 10px 15px 10px 2rem;
    /* 좌측 여백 추가로 들여쓰기 보정 */
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

/* 2차 메뉴 앞 아이콘 (.sub-icon) */
.sub-icon {
    display: inline-block;
    position: relative;
    top: -1px;
    width: 16px;
    height: 16px;
    background-color: #ffffff;
    /* 기본 색상 통일 */
    -webkit-mask-image: url('../img/icon/sub-icon.svg');
    mask-image: url('../img/icon/sub-icon.svg');
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: background-color 0.2s ease;
}

/* --- 4. 2차 메뉴 상태별 스타일 (Hover / Active) --- */
/* Hover */
.sub-item a:hover {
    color: var(--dept-over);
}

.sub-item a:hover .sub-icon {
    background-color: var(--dept-over) !important;
    /* 아이콘도 초록색 */
}

/* Active (현재 페이지) */
.sub-item.active a {
    background-color: var(--dept-over);
    /* 시안의 민트색 배경 */
    color: #222222 !important;
    font-weight: 600;
}

.sub-item.active a .sub-icon {
    background-color: #222222 !important;
    /* 아이콘 초록색 고정 */
}

/* --- 5. 메인 레이아웃 및 헤더 --- */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.mobile-header-toggle {
    display: none;
}

header,
.top-bar {
    flex-shrink: 0;
    z-index: 50;
    height: var(--spacing-header-height);
    display: flex;
    width: 100%;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-white);
}

.header-inner {
    display: flex;
    height: 100%;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 0 0rem 0 1.75rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.utility-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
}

.util-item {
    display: flex;
    cursor: pointer;
    align-items: center;
    gap: 0.15rem;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}
/*
.icon-mask {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}*/
.icon-mask {
    display: inline-block;
    width: 1rem;
    height: 1rem;  
    background-color: currentColor; 
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;

    image-rendering: -webkit-optimize-contrast; 
    image-rendering: crisp-edges;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;


    transform: translateZ(0);
    will-change: transform, mask-image; 
}

header .layout-max {
    width: 100%;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
/*
.content-max-container {
    flex: 1;
    width: 100%;
    padding: 1.875rem 1rem 0 1.875rem;
}
*/

.content-max-container {
    display: flex;
    flex-direction: column; /* 자식들을 위아래로 배치 */
    height: 100%;
    width: 100%;
    /* max-width: 90rem; */
    
    /* 기존 여백 유지: 위(1.875) 오른쪽(1) 아래(0) 왼쪽(1.875) */
    padding: 1.875rem 1rem 0 1.875rem; 
    
    /* 자식 요소(표와 설정창) 사이의 간격 */
    gap: calc(var(--spacing) * 5); 
    
    /* 패딩이 높이에 포함되도록 설정 (화면 넘침 방지) */
    box-sizing: border-box; 
}



.footer-area {
    flex-shrink: 0;
    padding: 1rem 1.875rem;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-white);
}

/* --- 6. 반응형 (Media Queries) --- */

/* Tablet Layout (1024px ~ 769px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: var(--spacing-sidebar-mini);
    }

    .sidebar-header {
        justify-content: center;
        padding: 0;
    }

    .logo-text,
    .nav-text,
    .sidebar-footer {
        display: none;
    }

    .nav-link {
        display: flex;
        align-items: center;
    }

    .icon-box {
        margin-right: 0;
    }

    .sub-nav {
        display: none !important;
    }

    .content-area {
        padding: 1rem;
    }
}

/* Mobile Layout (768px 이하) */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
        width: var(--spacing-sidebar-width);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    header .layout-max {
        padding-left: 0;
    }

    .page-title {
        font-size: 1rem;
    }

    .header-inner {
        padding-left: 0;
        padding-right: 1.25rem;
    }

    .mobile-header-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 3.5rem;
        height: var(--spacing-header-height);
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
    }

    .mobile-header-toggle .icon-mask {
        width: 1rem;
        height: 1rem;
        background-color: var(--color-text-base);
    }
}