/*
 * 셸 · 사이드바 · 헤더.
 * 내용은 F09 에서 채운다. 지금은 자리만 잡는다.
 */

.gbm-center {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 24px;
}

.gbm-shell {
	display: grid;
	grid-template-columns: 220px 1fr;
	grid-template-rows: 52px 1fr;
	grid-template-areas:
		"header header"
		"side   main";
	/*
	 * 뷰포트에 못을 박는다. min-height 로 두면 트리가 깊어질 때
	 * 문서 전체가 늘어나 트리가 화면 밖으로 흘러나간다 —
	 * 스크롤은 셸이 아니라 <b>안쪽 패널</b>이 갖는다.
	 */
	height: 100vh;
	overflow: hidden;
}

.gbm-shell__header {
	grid-area: header;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 16px;
	background: var(--gbm-surface);
	border-bottom: 1px solid var(--gbm-border);
}

.gbm-shell__brand {
	font-weight: 800;
	letter-spacing: -0.01em;
}

/*
 * 헤더 바탕은 흰색(--gbm-surface)이므로 기본 바이올렛 마크를 쓴다.
 * 흰 마크(mark-white.svg)는 바이올렛·이미지 배경 전용이다 (imgs/README.txt).
 */
.gbm-shell__mark {
	display: inline-block;
	vertical-align: -3px;
	margin-right: 6px;
}

.gbm-shell__title {
	color: var(--gbm-text-muted);
}

.gbm-shell__side {
	grid-area: side;
	background: var(--gbm-surface);
	border-right: 1px solid var(--gbm-border);
	overflow-y: auto;
}

.gbm-shell__main {
	grid-area: main;
	display: flex;
	flex-direction: column;
	padding: 16px;
	/* 자식이 남은 높이를 받으려면 반드시 필요하다. flex 항목의 기본 min-height 는 auto 다 */
	min-height: 0;
	overflow: auto;
}

/*
 * 화면은 #app 안에 붙는다. 여기서 flex 사슬이 끊기면 아래의 min-height:0 이
 * 아무 일도 하지 않는다 — 패널이 컨테이너 밖으로 자라 잘려 나간다.
 */
.gbm-shell__main > #app {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
}

/* ── 사이드바 메뉴 ──────────────────────────────────────────────── */

/*
 * 구역명은 <b>이름표지 누를 것이 아니다.</b> 항목과 같은 굵기·크기로 두면
 * 눌리지 않는 메뉴처럼 보인다. 작고 흐리게, 자간을 넓혀 가른다.
 */
.gbm-menu__section {
	padding: 18px 16px 4px;
	color: var(--gbm-text-muted);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.12em;
	opacity: 0.65;
}

/* 첫 구역은 위 여백을 줄인다 — 헤더 바로 밑에 뜨는 자리다 */
.gbm-menu__section:first-child {
	padding-top: 12px;
}

.gbm-menu__item {
	display: block;
	padding: 8px 16px 8px 22px;
	color: var(--gbm-text);
	font-size: 14px;
	text-decoration: none;
	border-left: 3px solid transparent;
}

.gbm-menu__item:hover {
	background: #f6f5fb;
	text-decoration: none;
}

/* 지금 보고 있는 화면. 사이드바가 길어지면 이것이 유일한 단서다 */
.gbm-menu__item.is-active {
	background: #f0edfa;
	border-left-color: var(--gbm-primary);
	color: var(--gbm-primary-dark);
	font-weight: 700;
}

/* ── 헤더 오른쪽 ────────────────────────────────────────────────── */

.gbm-shell__user {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-left: auto;
}

.gbm-shell__who {
	color: var(--gbm-text-muted);
	font-size: 13px;
}

/* ── 화면 공통 ──────────────────────────────────────────────────── */

.gbm-page__head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 14px;
}

.gbm-page__title {
	margin: 0;
	font-size: 17px;
	font-weight: 800;
	letter-spacing: -0.01em;
}

.gbm-page__actions {
	margin-left: auto;
	display: flex;
	gap: 8px;
}

.gbm-panel {
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	background: var(--gbm-surface);
	border: 1px solid var(--gbm-border);
	border-radius: var(--gbm-radius);
	padding: 14px;
}

/* 패널 안에서 스크롤되는 부분. 머리·발은 제자리에 남는다 */
.gbm-panel__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
}

.gbm-split {
	display: grid;
	grid-template-columns: minmax(320px, 1fr) minmax(320px, 420px);
	/*
	 * 행을 minmax(0, 1fr) 로 못 박는다. auto 로 두면 행이 내용만큼 자라
	 * 컨테이너를 줄여도 <b>패널이 컨테이너 밖으로 삐져나간다</b>.
	 */
	grid-template-rows: minmax(0, 1fr);
	gap: 14px;
	/* 남은 높이를 채우고 늘어난 만큼 안쪽이 스크롤한다 */
	flex: 1 1 auto;
	min-height: 0;
	align-items: stretch;
}

@media (max-width: 1100px) {
	.gbm-split {
		grid-template-columns: 1fr;
		grid-template-rows: auto;
		/* 세로로 쌓이면 높이를 나눌 수 없다. 이때는 화면이 스크롤한다 */
		flex: 0 0 auto;
		min-height: auto;
	}
}

/* 즐겨찾기 관리 — 트리 · 상세 · 대상 (04 문서 4.2) */
.gbm-three {
	display: grid;
	grid-template-columns: minmax(240px, 1fr) minmax(300px, 1.2fr) minmax(280px, 1fr);
	grid-template-rows: minmax(0, 1fr);
	gap: 14px;
	flex: 1 1 auto;
	min-height: 0;
	align-items: stretch;
}

@media (max-width: 1200px) {
	.gbm-three {
		grid-template-columns: 1fr;
		grid-template-rows: auto;
		flex: 0 0 auto;
		min-height: auto;
	}
}
