/* 인덱스 빌더 그리드 */
.widget-index .ib-index-row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	margin-left: 0;
	margin-right: 0;
	row-gap: var(--ib-row-gap, 0);
}
.widget-index .ib-index-row:not(:last-child) {
	margin-bottom: var(--ib-row-gap, 0);
}
.widget-index .ib-index-col--gap {
	min-height: 1px;
}
.widget-index .ib-index-col {
	box-sizing: border-box;
	min-width: 0;
	--ib-col-effective: var(--ib-col, 6);
	flex: 0 0 calc(var(--ib-col-effective) / 12 * 100%);
	max-width: calc(var(--ib-col-effective) / 12 * 100%);
	width: calc(var(--ib-col-effective) / 12 * 100%);
	padding-left: calc(var(--ib-col-gap, 0px) / 2);
	padding-right: calc(var(--ib-col-gap, 0px) / 2);
}

/* 작은 데스크톱: 한 줄 최대 3개 (col 최소 4) */
@media (max-width: 1199px) {
	.widget-index .ib-index-col {
		--ib-col-effective: max(var(--ib-col, 6), 4);
	}
}

/* 태블릿: 한 줄 최대 2개 + 메인/사이드 스택 */
@media (max-width: 991px) {
	.widget-index .ib-index-col {
		--ib-col-effective: max(var(--ib-col, 6), 6);
	}
	.widget-index .ib-layout-row {
		display: block;
	}
	.widget-index .ib-layout-row > .at-main,
	.widget-index .ib-layout-row > .at-side,
	.widget-index .at-row > [class*="col-md-"],
	.widget-index .at-row > [class*="col-sm-"] {
		width: 100% !important;
		max-width: 100% !important;
		float: none !important;
		left: auto !important;
		right: auto !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}
	.widget-index .ib-layout-row.ib-side-right > .at-main,
	.widget-index .ib-layout-row.ib-side-right > .at-side,
	.widget-index .ib-layout-row.ib-side-left > .at-main,
	.widget-index .ib-layout-row.ib-side-left > .at-side {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}
	.widget-index .ib-layout-row > .at-side {
		margin-top: var(--ib-row-gap, 15px);
	}
}

/* 작은 태블릿: 한 줄 최대 2개 유지 */
@media (max-width: 767px) {
	.widget-index .ib-index-col {
		--ib-col-effective: max(var(--ib-col, 6), 6);
	}
}

/* 모바일: 한 줄 1개 */
@media (max-width: 575px) {
	.widget-index .ib-index-col {
		--ib-col-effective: 12;
	}
}

/* 사이드 영역: 섹션 폭은 항상 사이드바 전체 (메인 col+사이드 col=12 레이아웃과 별개) */
.widget-index .at-side .ib-index-col,
.widget-index .ib-index-col[data-ib-area="side"] {
	--ib-col-effective: 12;
	flex: 0 0 100%;
	max-width: 100%;
	width: 100%;
}
.widget-index .at-side .ib-index-row {
	row-gap: var(--ib-row-gap, 0);
}

/* 메인·사이드 간격 — 테마 기본 col 패딩 대신 설정값 사용 */
.widget-index .ib-layout-row {
	margin-left: 0;
	margin-right: 0;
}
.widget-index .ib-layout-row > .at-col {
	padding-left: 0;
	padding-right: 0;
}
.widget-index .ib-layout-row.ib-side-right > .at-main {
	padding-right: calc(var(--ib-main-side-gap, 0px) / 2);
}
.widget-index .ib-layout-row.ib-side-right > .at-side {
	padding-left: calc(var(--ib-main-side-gap, 0px) / 2);
}
.widget-index .ib-layout-row.ib-side-left > .at-main {
	padding-left: calc(var(--ib-main-side-gap, 0px) / 2);
}
.widget-index .ib-layout-row.ib-side-left > .at-side {
	padding-right: calc(var(--ib-main-side-gap, 0px) / 2);
}

/* 인덱스 빌더 박스 공통 */
.widget-index {
	--ib-box-color: #8cadbd;
	--ib-box-color-soft: rgba(140, 173, 189, 0.12);
	--ib-box-color-mid: rgba(140, 173, 189, 0.75);
	--ib-box-color-active: #f8fafb;
	--ib-line-color: #8cadbd;
	--ib-text-color: inherit;
	--ib-text-color-inactive: #ffffff;
	--ib-text-muted: #888;
	--ib-box-height: 180px;
	--ib-header-height: 28px;
}
.widget-index .ib-box {
	margin-bottom: 0;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
	color: var(--ib-text-color, inherit);
}
.widget-index .ib-box .widget-box {
	margin-bottom: 0;
	min-width: 0;
	max-width: 100%;
}

/* 솔리드 헤더 — 모든 박스 동일 색·높이 (모서리 각짐) */
.widget-index .ib-scroll-head,
.widget-index .ib-notice-head,
.widget-index .ib-board-head,
.widget-index .ib-dark-head,
.widget-index .ib-box-title-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--ib-header-height, 28px);
	height: var(--ib-header-height, 28px);
	box-sizing: border-box;
	margin: 0;
	padding: 0 8px;
	background: var(--ib-box-color) !important;
	color: var(--ib-text-color-inactive, #fff);
	border-radius: 0;
}
.widget-index .ib-scroll-head-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	height: 100%;
	color: var(--ib-text-color-inactive, #fff);
	text-decoration: none;
}
.widget-index .ib-scroll-title {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--ib-text-color-inactive, #fff);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.widget-index .ib-scroll-more {
	flex: 0 0 auto;
	margin-left: 8px;
	font-size: 14px;
	font-weight: 600;
	color: var(--ib-text-color-inactive, #fff);
	line-height: 1;
}
.widget-index .ib-box-title-bar {
	margin-bottom: 0;
}
.widget-index .ib-box-title-bar .ib-scroll-head-link,
.widget-index .ib-box-title-bar .ib-scroll-title,
.widget-index .ib-box-title-bar .ib-scroll-more {
	color: var(--ib-text-color-inactive, #fff) !important;
}
.widget-index .ib-box-title-bar .ib-title-line {
	border-bottom: none !important;
	color: var(--ib-text-color-inactive, #fff) !important;
}
.widget-index .ib-box-title-bar .lightgray,
.widget-index .ib-box-title-bar a {
	color: var(--ib-text-color-inactive, #fff) !important;
}
.widget-index .ib-box-title-bar b {
	color: var(--ib-text-color-inactive, #fff);
	font-weight: 600;
}
.widget-index .ib-title-line {
	border-bottom-color: var(--ib-line-color, var(--ib-box-color)) !important;
}
.widget-index .ib-box-body {
	margin-bottom: 0;
}
.widget-index .at-side .ib-side-builtin .ib-builtin-body {
	padding: 6px 8px 8px;
	border: 1px solid var(--ib-line-color, var(--ib-box-color, rgba(148, 163, 184, 0.25)));
	border-top: none;
	border-radius: 0;
	background: var(--tm-card, #fff);
	box-sizing: border-box;
	overflow-y: auto;
}
.widget-index .at-side .ib-side-builtin {
	margin: 0;
	width: 100%;
}
.widget-index .at-side .ib-side-builtin .ib-box-title-bar {
	margin-bottom: 0;
	border-radius: 0;
}
.widget-index .ib-box-category .ib-builtin-body,
.widget-index .ib-box-side_posts .ib-builtin-body,
.widget-index .ib-box-side_comments .ib-builtin-body,
.widget-index .ib-box-side_stats .ib-builtin-body {
	display: block;
}
.widget-index .ib-box-category .basic-category {
	padding: 0;
	margin: 0;
	height: auto;
}
.widget-index .ib-box-category .basic-category .ca-sub1 {
	padding: 0;
	margin: 0;
	border-bottom: 1px solid #eee;
}
.widget-index .ib-box-category .basic-category .ca-sub1 > a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 10px;
	line-height: 1.35;
	min-height: 0;
	height: auto;
	box-sizing: border-box;
}
.widget-index .ib-box-body-fixed {
	overflow-y: auto;
}

/* 탭 박스 — 솔리드 헤더 (공통 탭 크롬) */
.widget-index .ib-tab-wrap { margin-bottom: 0; width: 100%; }
.widget-index .ib-tab-wrap ul.ib-tabs {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	gap: 0;
	flex-wrap: wrap;
}
.widget-index .ib-tab-wrap ul.ib-tabs:not(.ib-tabs-pill) li {
	flex: 1 1 auto;
	background: var(--ib-box-color) !important;
	color: var(--ib-text-color-inactive, #fff) !important;
	cursor: pointer;
	text-align: center;
	font-weight: 600;
	letter-spacing: -1px;
	border-radius: 4px 4px 0 0;
	border: 1px solid rgba(255,255,255,0.25);
	border-bottom: none;
	padding: 0 4px;
	font-size: 12px;
	line-height: 1.2;
	min-width: 0;
	min-height: var(--ib-header-height, 28px);
	height: var(--ib-header-height, 28px);
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
}
.widget-index[data-tab-dblclick="1"] .ib-tab-wrap ul.ib-tabs li[data-href] {
	-webkit-user-select: none;
	user-select: none;
}
.widget-index .ib-tab-wrap ul.ib-tabs:not(.ib-tabs-pill) li.current {
	background: var(--ib-box-color-active, #f8fafb) !important;
	color: var(--ib-text-color, #222) !important;
	border-color: var(--ib-box-color);
}
.widget-index .ib-tab-wrap .ib-tab-content {
	display: none;
	flex-direction: column;
	background: #fff;
	padding: 2px 6px;
	overflow: hidden;
	box-sizing: border-box;
	border: 1px solid var(--ib-line-color, var(--ib-box-color));
	border-top: none;
	border-radius: 0 0 4px 4px;
	color: var(--ib-text-color, inherit);
}
.widget-index .ib-tab-wrap .ib-tab-content.current {
	display: flex;
}
.widget-index .ib-tab-wrap .ib-tab-content .widget-box,
.widget-index .ib-tab-wrap .ib-tab-content .ib-box-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	margin-bottom: 0;
}
.widget-index .ib-tab-wrap .ib-tab-more-bar {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	flex: 0 0 auto;
	width: 100%;
	padding: 0 2px 2px;
	box-sizing: border-box;
}
.widget-index .ib-tab-wrap .ib-tab-more {
	font-size: 11px;
	line-height: 1.2;
	white-space: nowrap;
}

@media (max-width: 768px) {
	.widget-index .ib-tab-wrap ul.ib-tabs li { font-size: 11px; }
}
