/* ============================================================
   Premium Sidebar v3.0
   ============================================================ */

:root {
	--sb-w: 244px;
	--mobile-bar-h: 58px;
}

/* ── 외부 전역 리셋(* { box-sizing }) 차단 ── */
.sb, .sb *, .sb *::before, .sb *::after {
	box-sizing: content-box;
}

/* ── Sidebar Container ── */
.sb {
	position: fixed;
	top: 0; left: 0;
	width: var(--sb-w);
	height: 100vh;
	background: linear-gradient(195deg, #1a1f3c 0%, #0d1025 60%, #120e2b 100%);
	z-index: 1000;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* 오른쪽 그라데이션 보더 */
.sb::after {
	content: '';
	position: absolute;
	top: 0; right: 0;
	width: 1px;
	height: 100%;
	background: linear-gradient(180deg,
		rgba(129,140,248,0.35) 0%,
		rgba(139,92,246,0.15) 40%,
		rgba(99,102,241,0.05) 100%);
	pointer-events: none;
}

/* ── Header / Logo ── */
.sb-header {
	height: 72px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	position: relative;
	box-sizing: border-box;
}
.sb-header::after {
	content: '';
	position: absolute;
	bottom: 0; left: 24px; right: 24px;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent);
}

.sb-logo {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	transition: opacity 0.2s;
	transform: translateX(-8px);
}
.sb-logo:hover { opacity: 0.85; }

.sb-logo-icon {
	width: 44px; height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	color: #fff;
	font-size: 16px;
	flex-shrink: 0;
}
.sb-logo-icon img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}
.sb-logo-icon--sm {
	width: 36px; height: 36px;
	font-size: 13px;
}

.sb-logo-text {
	font-size: 20px;
	font-weight: 800;
	color: #2dd4bf;
	letter-spacing: 2px;
}
.sb-logo-text em {
	font-style: normal;
	color: #2dd4bf;
	background: none;
	-webkit-text-fill-color: currentColor;
}
.sb-logo-text--sm {
	font-size: 17px;
}

/* ── Navigation Scroll Area ── */
.sb-nav {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 8px 0;
}
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-track { background: transparent; }
.sb-nav::-webkit-scrollbar-thumb {
	background: rgba(129,140,248,0.25);
	border-radius: 4px;
}

/* ── Group ── */
.sb-group { margin-bottom: 6px; }

.sb-label {
	padding: 10px 24px 8px;
	font-size: 12px;
	font-weight: 700;
	color: rgba(255,255,255,0.35);
	text-transform: uppercase;
	letter-spacing: 1.8px;
}

/* ── Link ── */
.sb-link {
	display: flex;
	align-items: center;
	gap: 13px;
	padding: 9px 18px;
	margin: 1px 14px 1px 0;
	color: rgba(255,255,255,0.6);
	text-decoration: none;
	font-size: 14.5px;
	font-weight: 500;
	border-radius: 0 12px 12px 0;
	transition: all 0.2s ease;
	position: relative;
}

/* 왼쪽 인디케이터 */
.sb-link::before {
	content: '';
	position: absolute;
	left: 0; top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 0;
	border-radius: 0 4px 4px 0;
	background: linear-gradient(180deg, #818cf8, #a78bfa);
	transition: height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
	box-shadow: 0 0 10px rgba(129,140,248,0.5);
}

/* Hover */
.sb-link:hover {
	color: rgba(255,255,255,0.85);
	background: rgba(255,255,255,0.04);
}
.sb-link:hover::before { height: 18px; }
.sb-link:hover .sb-ico {
	color: #c7d2fe;
	background: rgba(129,140,248,0.12);
	border-color: rgba(129,140,248,0.15);
}

/* Active */
.sb-link.active {
	color: #fff;
	background: linear-gradient(90deg,
		rgba(99,102,241,0.18) 0%,
		rgba(129,140,248,0.04) 100%);
	font-weight: 600;
}
.sb-link.active::before { height: 28px; }
.sb-link.active .sb-ico {
	color: #a5b4fc;
	background: rgba(99,102,241,0.2);
	border-color: rgba(129,140,248,0.2);
	box-shadow: 0 0 12px rgba(99,102,241,0.15);
}


/* ── Icon Box ── */
.sb-ico {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
	border-radius: 10px;
	background: rgba(255,255,255,0.03);
	border: 1px solid rgba(255,255,255,0.04);
	color: rgba(255,255,255,0.5);
	transition: all 0.2s ease;
}

/* ── Text ── */
.sb-txt {
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── 외부 링크 표시 (새 탭) ── */
.sb-ext {
	font-size: 10px;
	color: rgba(165, 180, 252, 0.55);
	margin-left: 6px;
	transition: color 0.15s ease, transform 0.15s ease;
}
.sb-link:hover .sb-ext {
	color: #c7d2fe;
	transform: translate(1px, -1px);
}

/* ── Badge ── */
.sb-badge {
	font-size: 10px;
	font-weight: 700;
	padding: 3px 9px;
	border-radius: 20px;
	background: rgba(129,140,248,0.15);
	color: #a5b4fc;
	letter-spacing: 0.3px;
	border: 1px solid rgba(129,140,248,0.1);
}
/* 미읽음 카운트 배지 (1:1 문의 등) — 우측 정렬 + 빨강 */
.sb-badge--count {
	margin-left: auto;
	min-width: 18px;
	text-align: center;
	padding: 2px 6px;
	background: #ef4444;
	color: #fff;
	border-color: rgba(239,68,68,0.45);
	font-family: 'Pretendard', system-ui, sans-serif;
}

/* ── Footer ── */
.sb-footer {
	padding: 16px 16px 20px;
	flex-shrink: 0;
	position: relative;
}
.sb-footer::before {
	content: '';
	position: absolute;
	top: 0; left: 24px; right: 24px;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent);
}

/* ── User Card ── */
.sb-user {
	display: flex;
	flex-direction: column;
	padding: 0;
	background: linear-gradient(135deg,
		rgba(99,102,241,0.08) 0%,
		rgba(139,92,246,0.06) 100%);
	border: 1px solid rgba(129,140,248,0.12);
	border-radius: 14px;
	transition: all 0.2s ease;
	overflow: hidden;
}
.sb-user:hover {
	background: linear-gradient(135deg,
		rgba(99,102,241,0.13) 0%,
		rgba(139,92,246,0.1) 100%);
	border-color: rgba(129,140,248,0.2);
}

.sb-user-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 13px 14px 12px;
}
.sb-user-name {
	font-size: 17px;
	font-weight: 700;
	color: #f1f5f9;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	letter-spacing: -0.1px;
	flex: 1;
	min-width: 0;
}
.sb-role-badge {
	flex-shrink: 0;
	display: inline-block;
	padding: 3px 9px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.2px;
	color: #c7d2fe;
	background: linear-gradient(135deg, rgba(99,102,241,0.22) 0%, rgba(139,92,246,0.22) 100%);
	border: 1px solid rgba(129,140,248,0.35);
	border-radius: 999px;
}

.sb-user-actions {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	border-top: 1px solid rgba(129,140,248,0.15);
}
.sb-uact {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 11px 0;
	color: rgba(226,232,240,0.55);
	text-decoration: none;
	font-size: 15px;
	transition: all .18s ease;
}
.sb-uact + .sb-uact {
	border-left: 1px solid rgba(129,140,248,0.12);
}
.sb-uact:hover {
	background: rgba(129,140,248,0.1);
	color: #e2e8f0;
}
.sb-uact--danger:hover {
	background: rgba(239,68,68,0.12);
	color: #f87171;
}
.sb-uact-dot {
	position: absolute;
	top: 8px;
	right: 50%;
	margin-right: -14px;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #ef4444;
	box-shadow: 0 0 0 2px rgba(15,23,42,1);
}

/* ── Auth Buttons ── */
.sb-auth-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 11px;
	border-radius: 12px;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.2s ease;
	margin-bottom: 8px;
	box-sizing: border-box;
}
.sb-auth-login {
	background: rgba(255,255,255,0.04);
	color: #a5b4fc;
	border: 1px solid rgba(129,140,248,0.15);
}
.sb-auth-login:hover {
	background: rgba(129,140,248,0.12);
	border-color: rgba(129,140,248,0.3);
	color: #c7d2fe;
}
.sb-auth-register {
	background: linear-gradient(135deg, #6366f1, #7c3aed);
	color: #fff;
	border: 1px solid transparent;
	box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}
.sb-auth-register:hover {
	box-shadow: 0 6px 24px rgba(99,102,241,0.45);
	transform: translateY(-1px);
}


/* ============================================================
   Mobile
   ============================================================ */
.sb-mobile-bar {
	display: none;
	position: fixed;
	top: 0; left: 0; right: 0;
	height: var(--mobile-bar-h);
	background: linear-gradient(180deg, #1a1f3c, #131729);
	z-index: 1001;
	padding: 0 16px;
	align-items: center;
}
.sb-mobile-bar::after {
	content: '';
	position: absolute;
	bottom: 0; left: 0; right: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(129,140,248,0.3), transparent);
}

.sb-mobile-logo {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
}

.sb-hamburger {
	width: 38px; height: 38px;
	background: none;
	border: none;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	padding: 6px;
}
.sb-hamburger span {
	display: block;
	width: 22px; height: 2px;
	background: rgba(255,255,255,0.5);
	border-radius: 2px;
	transition: all 0.3s ease;
}
.sb-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.sb-hamburger.active span:nth-child(2) { opacity: 0; }
.sb-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.sb-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.65);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	z-index: 999;
}
.sb-overlay.show { display: block; }


/* ── Layout ── */
.app-layout {
	margin-left: var(--sb-w);
	padding: 0;
	min-height: 100vh;
}
.main-content {
	padding: 0;
	min-height: 100vh;
	background: #f1f5f9;
}

@media (max-width: 768px) {
	.sb-mobile-bar { display: flex; }

	.sb {
		transform: translateX(-100%);
		transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	}
	.sb.open {
		transform: translateX(0);
		box-shadow: 12px 0 50px rgba(0,0,0,0.6);
	}

	.sb-header { display: none; }
	.sb-nav { padding-top: 56px; }

	.app-layout {
		margin-left: 0 !important;
		padding-top: var(--mobile-bar-h);
	}
	.main-content { margin-left: 0; }
}

@media print {
	.sb, .sb-mobile-bar, .sb-overlay { display: none !important; }
	.app-layout { margin-left: 0 !important; }
}
