/* APB Tabs - Responsive Accordion/Tabs Component */

/* Base accordion styles */
.apb-tabs-acc {
	overflow: hidden;
	width: 100%;
}

/* Tabs navigation (hidden on mobile) */
.apb-tabs-acc-tabs {
	display: none;
}

.apb-tabs-acc-tabs :focus {
	outline: 3px solid #447fff;
	outline-offset: -3px;
}

/* Accordion items (mobile view) */

.apb-tabs-acc-item__label {
	background: transparent;
	border: none;
	cursor: pointer;
	font-weight: 500;
	margin: 0;
	padding: 1.25rem;
	position: relative;
	text-align: left;
	width: 100%;
}

.apb-tabs-acc-item__label:focus {
	outline: 3px solid #447fff;
	outline-offset: -3px;
}

.apb-tabs-acc-item__label:after {
	border-color: transparent #447fff #447fff transparent;
	border-radius: 2px;
	border: 3px solid transparent;
	bottom: 0;
	content: '';
	height: 0.25rem;
	margin: auto;
	position: absolute;
	right: 1.25rem;
	top: 0;
	transform: rotate(45deg);
	transition: transform 0.3s ease;
	width: 0.25rem;
}

.apb-tabs-acc-item__label:hover {
	/* Background color handled by injected CSS */
	transition: background-color 0.2s ease;
}

.apb-tabs-acc-item__container {
	border-top: none;
	height: 0;
	opacity: 0;
	overflow: hidden;
	padding: 0 1.25em;
}

/* Active accordion states */
.apb-tabs-acc-active {
	/* Background color handled by injected CSS */
	transition: background-color 0.2s ease;
}

.apb-tabs-acc-active .apb-tabs-acc-item__label {
	cursor: inherit;
}

.apb-tabs-acc-active .apb-tabs-acc-item__label:hover {
	/* Background color handled by injected CSS */
	transition: background-color 0.2s ease;
}

.apb-tabs-acc-active .apb-tabs-acc-item__label:after {
	transform: rotate(225deg);
}

.apb-tabs-acc-active .apb-tabs-acc-item__container {
	padding: 1.25em;
	height: auto;
	opacity: 1;
}

.apb-tabs-acc-active .apb-tabs-acc-item__container p:first-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h1:first-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h2:first-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h3:first-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h4:first-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h5:first-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h6:first-child {
	margin-top: 0;
}

.apb-tabs-acc-active .apb-tabs-acc-item__container p:last-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h1:last-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h2:last-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h3:last-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h4:last-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h5:last-child,
.apb-tabs-acc-active .apb-tabs-acc-item__container h6:last-child {
	margin-bottom: 0;
}

@media screen and (max-width: 599px) {
	.apb-tabs-acc-item__container {
		border: 1px solid #ddd;
	}
	.apb-tabs-acc-content > div {
		display: flex;
		flex-direction: column;
		gap: 0.25rem !important;
	}
}

/* Desktop styles (600px and up) */
@media screen and (min-width: 600px) {
	.apb-tabs-acc-tabs {
		display: flex;
		gap: 0.25rem;
	}

	.apb-tabs-acc-tabs .apb-tabs-acc-tab {
		background: rgba(68, 127, 255, 0.1);
		border: none;
		cursor: pointer;
		flex: 1;
		font-weight: 400;
		padding: 1rem 1.25rem;
		text-align: left;
		transition: background 0.1s ease;
	}

	.apb-tabs-acc-tabs .apb-tabs-acc-tab:hover {
		background: rgba(249, 249, 249, 0.01);
	}

	.apb-tabs-acc-tabs .apb-tabs-acc-tab:last-child {
		border-right: 0;
	}

	.apb-tabs-acc-tabs .apb-tabs-acc-tab.apb-tabs-acc-active {
		background: #f9f9f9;
	}

	.apb-tabs-acc-tabs .apb-tabs-acc-tab:focus {
		outline: 3px solid #447fff;
		outline-offset: -3px;
	}

	.apb-tabs-acc-item {
		display: none;
		padding: 2rem;
	}
	.apb-tabs-acc-item::after {
		clear: both;
		content: '';
		display: block;
	}

	.apb-tabs-acc__vertical {
		align-items: start;
		display: grid;
		grid-template-columns: 2fr 6fr;
		gap: 0.5rem;
	}
	.apb-tabs-acc__vertical .apb-tabs-acc-tabs {
		display: flex;
		flex-direction: column;
		gap: 0.25rem;
		justify-content: flex-start;
	}

	.apb-tabs-acc-content {
		background: #ffffff;
		border: 1px solid #dddddd;
		border-top: 0;
		height: auto;
		overflow: auto;
	}
	.apb-tabs-acc__vertical .apb-tabs-acc-content {
		border-top: 1px solid #dddddd;
	}

	#apb-wrapper .apb-tabs-acc-content .os-scrollbar-vertical {
		background: #fff;
		padding: 6px;
	}
	#apb-wrapper .apb-tabs-acc-content .os-scrollbar-handle {
		background: #666 !important;
		left: -3px;
		padding: 3px;
	}
	.apb-tabs-acc-content .os-scrollbar-unusable {
		display: none;
	}
	#apb-wrapper .apb-tabs-acc-content div[data-overlayscrollbars-viewport] {
		padding-right: 0.5rem !important;
	}

	.apb-tabs-acc-item__label {
		display: none;
		margin-bottom: 1.5rem;
		padding: 0;
	}

	.apb-tabs-acc-item__container {
		height: auto;
		opacity: 1;
		overflow: visible;
	}

	.apb-tabs-acc-item.apb-tabs-acc-active {
		display: block;
	}

	.apb-tabs-acc-item.apb-tabs-acc-active .apb-tabs-acc-item__container {
		padding: 0;
		height: auto;
		opacity: 1;
	}
}

/* APB specific overrides */
.paragraph--type--apb-pb-tabs .apb-accordion {
	/* Inherit any specific styling from the paragraph type */
	width: 100%;
}

/* Ensure proper spacing in Drupal context */
.paragraph--type--apb-pb-tabs .views-element-container {
	margin: 0;
}

/* Custom class support */
.apb-accordion.custom-tabs-style {
	/* Allow for custom styling via classes */
	position: relative;
}

/* Animation support for GSAP fallback */
/* .apb-tabs-acc-item__container {
	transition: height 0.4s ease, padding 0.4s ease, opacity 0.4s ease;
} */

/* Accessibility improvements */
/* .apb-tabs-acc-tab[aria-selected='true'] {
} */

.apb-tabs-acc-item[aria-hidden='true'] {
	display: none;
}

/* Print styles */
@media print {
	.apb-tabs-acc-tabs {
		display: none;
	}

	.apb-tabs-acc-item {
		display: block !important;
		page-break-inside: avoid;
	}

	.apb-tabs-acc-item__label {
		display: block;
		font-weight: bold;
		margin-bottom: 0.5rem;
	}

	.apb-tabs-acc-item__container {
		height: auto !important;
		opacity: 1 !important;
		overflow: visible !important;
		padding: 0 !important;
	}
}
