/**
 * Area Pref Links - Frontend Styles
 *
 * @package area-pref-links
 */

/* CSS Custom Properties (overridden via inline styles) */
.apl-form {
	--apl-background-color: #f5f5f5;
	--apl-main-color: #007bff;
	--apl-button-color: #28a745;
	--apl-button-text-color: #ffffff;
}

/* Container */
.apl-form {
	position: relative;
	background-color: var(--apl-background-color);
	border-radius: 0;
	overflow: hidden;
	font-family: inherit;
	box-sizing: border-box;
	padding: 24px;
}

.apl-form *,
.apl-form *::before,
.apl-form *::after {
	box-sizing: border-box;
}

/* Header */
.apl-form__header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 1.25rem;
}

.apl-form__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-width: 40px;
	background-color: var(--apl-main-color);
	border-radius: 50%;
	color: #ffffff;
}

.apl-form__icon svg {
	width: 24px;
	height: 24px;
	stroke: currentColor;
	fill: none;
}

.apl-form__title {
	font-size: 18px;
	font-weight: bold;
	line-height: 1.4;
}

/* Content */
.apl-form__content {
	margin-bottom: 1.25rem;
}

.apl-form__section-title {
	font-size: 16px;
	font-weight: bold;
	margin-bottom: 16px;
	padding-left: 12px;
	border-left: 4px solid var(--apl-main-color);
	line-height: 1.4;
}

.apl-form__field {
	margin-bottom: 16px;
}

.apl-form__field:last-child {
	margin-bottom: 0;
}

.apl-form__label {
	display: block;
	margin-bottom: 8px;
	font-weight: 500;
	font-size: 14px;
}

.apl-form__select-wrapper {
	position: relative;
}

.apl-form__select-wrapper::after {
	content: '';
	position: absolute;
	right: 12px;
	top: 50%;
	width: 16px;
	height: 16px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: 16px;
	transform: translateY(-50%);
	transition: transform 0.2s ease;
	pointer-events: none;
}

.apl-form__select-wrapper.is-open::after {
	transform: translateY(-50%) rotate(180deg);
}

.apl-form__select {
	width: 100%;
	padding: 12px 40px 12px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 16px;
	appearance: none;
	background-color: #fff;
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.apl-form__select:focus {
	outline: none;
	border-color: var(--apl-main-color);
	box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Footer / Button */
.apl-form__footer {
	display: flex;
	justify-content: center;
}

.apl-form__button {
	width: auto;
	min-width: 50%;
	padding: 14px 24px;
	background-color: var(--apl-button-color);
	color: var(--apl-button-text-color);
	border: none;
	border-radius: 4px;
	font-size: 16px;
	font-weight: bold;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.apl-form__button:hover {
	opacity: 0.9;
}

.apl-form__button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Loading Overlay */
.apl-form__overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.5);
	display: none;
	align-items: center;
	justify-content: center;
	border-radius: 0;
	z-index: 10;
}

.apl-form--loading .apl-form__overlay {
	display: flex;
}

.apl-form__spinner {
	width: 40px;
	height: 40px;
	border: 4px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: apl-spin 1s linear infinite;
}

@keyframes apl-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ========================================
 * Tabs Shortcode
 * ======================================== */

/* CSS Custom Properties */
.apl-tabs {
	--apl-tabs-background-color: #f5f5f5;
	--apl-tabs-active-color: #007bff;
	--apl-tabs-link-color: #333333;
}

/* Container - Full viewport width */
.apl-tabs {
	position: relative;
	width: 100vw;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
	background-color: var(--apl-tabs-background-color);
	font-family: inherit;
	box-sizing: border-box;
}

.apl-tabs *,
.apl-tabs *::before,
.apl-tabs *::after {
	box-sizing: border-box;
}

/* Tab Navigation */
.apl-tabs__nav {
	border-bottom: 1px solid #ddd;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.apl-tabs__nav::-webkit-scrollbar {
	height: 4px;
}

.apl-tabs__nav::-webkit-scrollbar-track {
	background: transparent;
}

.apl-tabs__nav::-webkit-scrollbar-thumb {
	background-color: rgba(0, 0, 0, 0.2);
	border-radius: 2px;
}

.apl-tabs__nav::-webkit-scrollbar-thumb:hover {
	background-color: rgba(0, 0, 0, 0.3);
}

.apl-tabs__nav-inner {
	display: flex;
	flex-wrap: nowrap;
	gap: 0;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 16px;
}

.apl-tabs__tab {
	padding: 12px 24px;
	background: transparent;
	border: none;
	font-size: 14px;
	font-weight: 500;
	color: var(--apl-tabs-link-color, #666);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
	white-space: nowrap;
	flex-shrink: 0;
}

.apl-tabs__tab:hover {
	background-color: var(--apl-tabs-active-color);
	color: #fff;
}

.apl-tabs__tab.is-active {
	background-color: var(--apl-tabs-active-color);
	color: #fff;
	font-weight: bold;
}

/* Tab Panels */
.apl-tabs__panels {
	max-width: 1200px;
	margin: 0 auto;
	padding: 24px 16px;
}

.apl-tabs__panel {
	display: none;
}

.apl-tabs__panel.is-active {
	display: block;
}

/* Region rows */
.apl-tabs__region {
	display: flex;
	align-items: baseline;
	margin-bottom: 16px;
	line-height: 1.8;
}

.apl-tabs__region:last-child {
	margin-bottom: 0;
}

.apl-tabs__region-name {
	flex-shrink: 0;
	width: 120px;
	font-weight: bold;
	font-size: 14px;
	color: var(--apl-tabs-active-color, #333);
}

.apl-tabs__prefectures {
	flex: 1;
	font-size: 14px;
}

/* Prefecture links */
.apl-tabs__link {
	color: var(--apl-tabs-link-color);
	text-decoration: none;
	transition: color 0.2s ease;
}

.apl-tabs__link:hover {
	color: var(--apl-tabs-active-color);
	text-decoration: underline;
}

.apl-tabs__link--disabled {
	color: #999;
	cursor: default;
}

.apl-tabs__link--disabled:hover {
	color: #999;
	text-decoration: none;
}

.apl-tabs__separator {
	margin: 0 8px;
	color: #ccc;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.apl-tabs__region {
		flex-direction: column;
		margin-bottom: 20px;
	}

	.apl-tabs__region-name {
		width: 100%;
		margin-bottom: 8px;
	}

	.apl-tabs__prefectures {
		display: flex;
		flex-wrap: wrap;
		gap: 4px 0;
	}

	.apl-tabs__separator {
		margin: 0 6px;
	}

	.apl-tabs__tab {
		padding: 10px 16px;
		font-size: 13px;
	}
}
