/* ==========================================================================
   Signocore Language Switcher - Frontend Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

.sml-switcher {
	position: relative;
	display: inline-block;
	font-size: inherit;
	line-height: 1.4;
}

.sml-switcher *,
.sml-switcher *::before,
.sml-switcher *::after {
	box-sizing: border-box;
}

.sml-switcher-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	text-decoration: none;
	color: inherit;
	transition: opacity 0.15s ease;
}

.sml-switcher-link:hover,
.sml-switcher-link:focus-visible {
	opacity: 0.75;
}

.sml-switcher-link.sml-active {
	font-weight: 600;
	cursor: default;
}

.sml-switcher-link.sml-active:hover,
.sml-switcher-link.sml-active:focus-visible {
	opacity: 1;
}

/* --------------------------------------------------------------------------
   Flag images
   -------------------------------------------------------------------------- */

.sml-flag {
	display: inline-block;
	vertical-align: middle;
	border-radius: 2px;
	flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Dropdown style
   -------------------------------------------------------------------------- */

.sml-switcher-dropdown {
	position: relative;
}

.sml-switcher-current {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border: 1px solid currentColor;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	transition: border-color 0.15s ease;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.sml-switcher-current:hover,
.sml-switcher-current:focus-visible {
	border-color: currentColor;
	opacity: 0.75;
}

.sml-arrow {
	display: inline-block;
	width: 0;
	height: 0;
	margin-left: 4px;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	transition: transform 0.2s ease;
}

.sml-switcher-current[aria-expanded="true"] .sml-arrow {
	transform: rotate(180deg);
}

.sml-switcher-dropdown .sml-switcher-list {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 9999;
	min-width: 100%;
	margin: 4px 0 0;
	padding: 4px 0;
	list-style: none;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sml-switcher-dropdown .sml-switcher-list[data-open="true"] {
	display: block;
}

.sml-switcher-dropdown .sml-switcher-list li {
	margin: 0;
	padding: 0;
}

.sml-switcher-dropdown .sml-switcher-list .sml-switcher-link {
	display: flex;
	width: 100%;
	padding: 6px 12px;
	white-space: nowrap;
	color: #333;
}

.sml-switcher-dropdown .sml-switcher-list .sml-switcher-link:hover,
.sml-switcher-dropdown .sml-switcher-list .sml-switcher-link:focus-visible {
	background: #f5f5f5;
	opacity: 1;
}

.sml-switcher-dropdown .sml-switcher-list .sml-switcher-link.sml-active {
	background: #f0f0f0;
}

/* --------------------------------------------------------------------------
   List style
   -------------------------------------------------------------------------- */

.sml-switcher-list .sml-switcher-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sml-switcher-list .sml-switcher-list li {
	margin: 0;
	padding: 0;
}

.sml-switcher-list .sml-switcher-list .sml-switcher-link {
	display: flex;
	padding: 4px 0;
}

/* --------------------------------------------------------------------------
   Flags style
   -------------------------------------------------------------------------- */

.sml-switcher-flags {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.sml-switcher-flags .sml-switcher-link {
	display: inline-flex;
	padding: 2px;
	border-radius: 2px;
}

.sml-switcher-flags .sml-switcher-link.sml-active {
	outline: 2px solid currentColor;
	outline-offset: 1px;
}

.sml-switcher-flags .sml-flag {
	width: 24px;
	height: 18px;
}

/* --------------------------------------------------------------------------
   Inline style
   -------------------------------------------------------------------------- */

.sml-switcher-inline {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.sml-separator {
	color: inherit;
	opacity: 0.4;
	user-select: none;
}

/* --------------------------------------------------------------------------
   Language name
   -------------------------------------------------------------------------- */

.sml-lang-name {
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Menu integration
   -------------------------------------------------------------------------- */

.sml-menu-switcher-item a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.sml-menu-switcher-item .sml-flag {
	display: inline-block;
	vertical-align: middle;
	border-radius: 2px;
	flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
	.sml-switcher-dropdown .sml-switcher-list {
		min-width: 160px;
	}

	.sml-switcher-inline {
		gap: 6px;
	}

	.sml-switcher-flags {
		gap: 6px;
	}
}
