/* ── 레이아웃 ── */
.wrapper { display: flex; min-height: 100vh; }

/* ── 사이드바 ── */
aside {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1001;
    transition: transform 0.3s ease-in-out;
}

.sidebar-header {
    height: var(--header-height);
    display: flex; align-items: center; padding: 0 1.5rem;
    font-size: 1.15rem; font-weight: 700;
    border-bottom: 0.0625rem solid var(--sidebar-surface); color: var(--info);
}
.sidebar-header i { margin-right: 0.85rem; font-size: 1.25rem; }

.sidebar-nav { list-style: none; padding: 0.5rem 0; }
.nav-link {
    display: flex; align-items: center; padding: 0.875rem 1.5rem;
    color: var(--sidebar-link-color); text-decoration: none; font-size: 0.9375rem;
    transition: 0.2s; cursor: pointer;
}
.nav-link:hover { color: #fff; background: var(--sidebar-hover-bg); }
.nav-link i:first-child { width: 1.25rem; margin-right: 1rem; font-size: 1rem; text-align: center; }

/* ── 서브메뉴 ── */
.nav-link .arrow { margin-left: auto; font-size: 0.7rem; transition: transform 0.3s; opacity: 0.5; }
.nav-item.open > .nav-link .arrow { transform: rotate(90deg); opacity: 1; }
.submenu {
    list-style: none; background: var(--sidebar-sub-bg);
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out;
}
.nav-item.open .submenu { max-height: 20rem; }
.submenu li { padding: 0.625rem 1.5rem 0.625rem 3.75rem; font-size: 0.875rem; color: var(--sidebar-link-color); cursor: pointer; }
.submenu li:hover { color: #fff; }

/* ── 메인 컨테이너 ── */
.main-container {
    flex: 1; display: flex; flex-direction: column;
    margin-left: var(--sidebar-width); min-width: 0;
    padding-bottom: var(--footer-height);
}
.full-container { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── 헤더 ── */
header {
    height: var(--header-height); background: var(--white);
    border-bottom: 0.0625rem solid var(--border-color);
    display: flex; align-items: center; padding: 0 var(--main-padding);
    position: sticky; top: 0; z-index: 1000;
}
.header-search { flex: 1; max-width: 25rem; position: relative; }
.header-search input {
    width: 100%; padding: 0.5rem 1rem 0.5rem 2.5rem; border-radius: 2rem;
    border: 1px solid var(--border-color); background: var(--input-bg);
    outline: none; font-size: 0.875rem; color: var(--text-main);
}
.header-search i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.header-user { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; cursor: pointer; }
.user-name { font-size: 0.875rem; font-weight: 700; color: var(--text-main); padding-left: 0.4rem; }
.user-avatar { width: 2.25rem; height: 2.25rem; background: var(--input-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }

main { padding: var(--main-padding); flex: 1; }

/* ── 푸터 ── */
footer {
    height: var(--footer-height); background: var(--white);
    border-top: 0.0625rem solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 var(--main-padding); font-size: 0.8125rem; color: var(--text-muted);
    position: fixed; bottom: 0; left: var(--sidebar-width); right: 0; z-index: 1000;
}

/* ── 그리드 ── */
.grid-container { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--main-padding); }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }

/* ── 반응형 ── */
.overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 1000; }

@media (max-width: 991px) {
    aside { transform: translateX(-100%); z-index: 1050; }
    aside.active { transform: translateX(0); }
    .main-container { margin-left: 0 !important; }
    footer { left: 0; }
    .menu-btn {
        display: flex !important; align-items: center; justify-content: center;
        width: 2.5rem; height: 2.5rem; font-size: 1.25rem;
        background: var(--white); border: 1px solid var(--border-color);
        border-radius: 0.35rem; cursor: pointer; color: var(--text-main);
        z-index: 1100; margin-right: 0.75rem;
    }
    .overlay.active { display: block; z-index: 1000; }
    .col-3, .col-4, .col-6, .col-12 { grid-column: span 12; }
}
@media (min-width: 992px) {
    .menu-btn { display: none !important; }
    aside { transform: translateX(0) !important; }
}
