/**
 * AhojNet ID — widget profilu, formulár fotky a oznámenie po odhlásení.
 * Farby a rozmery sú CSS premenné — Elementor ich prepisuje v záložke Štýl.
 */

/* ----------------------------------------------------------------------
 * Premenné (predvolené hodnoty)
 * -------------------------------------------------------------------- */
.ahn-id,
.ahn-idp {
	--ahn-id-size: 40px;
	--ahn-id-ring-w: 0px;
	--ahn-id-ring: #ffffff;
	--ahn-id-pop-w: 300px;
	--ahn-id-pop-bg: #ffffff;
	--ahn-id-text: #111827;
	--ahn-id-muted: #6b7280;
	--ahn-id-border: #e5e7eb;
	--ahn-id-hover: #f3f4f6;
	--ahn-id-danger: #b91c1c;
	--ahn-id-radius: 14px;
	--ahn-id-focus: #2563eb;
	--ahn-idp-size: 120px;
	--ahn-idp-accent: #111827;
	--ahn-idp-accent-text: #ffffff;
	--ahn-idp-btn-radius: 10px;
}

/* ----------------------------------------------------------------------
 * Avatar (fotka alebo iniciály)
 * -------------------------------------------------------------------- */
.ahn-id__avatar {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: var(--ahn-id-size);
	height: var(--ahn-id-size);
	border-radius: 50%;
	overflow: hidden;
	background: #d1d5db;
	color: #ffffff;
	font-weight: 600;
	font-size: calc(var(--ahn-id-size) * 0.4);
	line-height: 1;
	letter-spacing: 0.02em;
	box-shadow: 0 0 0 var(--ahn-id-ring-w) var(--ahn-id-ring);
	user-select: none;
}

.ahn-id__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ahn-id__avatar svg {
	width: 60%;
	height: 60%;
}

.ahn-id__avatar--lg {
	--ahn-id-size: 56px;
	box-shadow: none;
}

/* Kostra počas načítania */
.ahn-id__skeleton {
	background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
	background-size: 200% 100%;
	animation: ahn-id-shimmer 1.2s ease-in-out infinite;
}

.ahn-id:not(.is-loading) > .ahn-id__skeleton {
	display: none;
}

@keyframes ahn-id-shimmer {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* ----------------------------------------------------------------------
 * Widget profilu
 * -------------------------------------------------------------------- */
.ahn-id {
	position: relative;
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	color: var(--ahn-id-text);
}

.ahn-id [hidden] {
	display: none !important;
}

.ahn-id__trigger {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.ahn-id__trigger:hover,
.ahn-id__trigger:focus {
	background: transparent;
	color: inherit;
}

.ahn-id__trigger:focus-visible,
.ahn-id__login:focus-visible,
.ahn-id__item:focus-visible,
.ahn-idp__btn:focus-visible,
.ahn-idp__viewport:focus-visible {
	outline: 2px solid var(--ahn-id-focus);
	outline-offset: 2px;
}

.ahn-id__trigger-name {
	font-weight: 500;
	white-space: nowrap;
	max-width: 16ch;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ahn-id__login {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: inherit;
	text-decoration: none;
	font-weight: 500;
	white-space: nowrap;
}

.ahn-id__icon {
	flex: 0 0 auto;
}

/* Popup */
.ahn-id__pop {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 9999;
	width: var(--ahn-id-pop-w);
	max-width: calc(100vw - 32px);
	padding: 8px;
	border: 1px solid var(--ahn-id-border);
	border-radius: var(--ahn-id-radius);
	background: var(--ahn-id-pop-bg);
	color: var(--ahn-id-text);
	box-shadow: 0 12px 32px rgba(17, 24, 39, 0.14), 0 2px 6px rgba(17, 24, 39, 0.06);
	text-align: left;
	animation: ahn-id-pop-in 0.14s ease-out;
}

.ahn-id--align-left .ahn-id__pop {
	right: auto;
	left: 0;
}

@keyframes ahn-id-pop-in {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: none; }
}

.ahn-id__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 10px 14px;
	border-bottom: 1px solid var(--ahn-id-border);
	margin-bottom: 6px;
}

.ahn-id__who {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ahn-id__name {
	font-weight: 600;
	font-size: 15px;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ahn-id__contact {
	color: var(--ahn-id-muted);
	font-size: 13px;
	line-height: 1.4;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ahn-id__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px;
	border-radius: calc(var(--ahn-id-radius) - 6px);
	color: var(--ahn-id-text);
	text-decoration: none;
	font-size: 14px;
	line-height: 1.3;
}

.ahn-id__item:hover,
.ahn-id__item:focus-visible {
	background: var(--ahn-id-hover);
	color: var(--ahn-id-text);
}

.ahn-id__logout,
.ahn-id__logout:hover,
.ahn-id__logout:focus-visible {
	color: var(--ahn-id-danger);
}

/* Jazyk */
.ahn-id__lang {
	margin: 6px 0;
	padding: 8px 10px 10px;
	border-top: 1px solid var(--ahn-id-border);
	border-bottom: 1px solid var(--ahn-id-border);
}

.ahn-id__lang-label {
	display: block;
	margin-bottom: 6px;
	color: var(--ahn-id-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ahn-id__lang-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ahn-id__lang-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border: 1px solid var(--ahn-id-border);
	border-radius: 999px;
	color: var(--ahn-id-text);
	font-size: 13px;
	text-decoration: none;
}

.ahn-id__lang-link:hover,
.ahn-id__lang-link:focus-visible {
	background: var(--ahn-id-hover);
}

.ahn-id__lang-link.is-current {
	border-color: var(--ahn-id-text);
	font-weight: 600;
}

.ahn-id__flag {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	object-fit: cover;
}

/* ----------------------------------------------------------------------
 * Oznámenie po odhlásení (toast)
 * -------------------------------------------------------------------- */
.ahn-id-toast {
	position: fixed;
	left: 50%;
	top: 16px;
	z-index: 100000;
	max-width: calc(100vw - 32px);
	padding: 12px 18px;
	border-radius: 12px;
	background: #111827;
	color: #ffffff;
	font-size: 14px;
	line-height: 1.4;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	transform: translate(-50%, -8px);
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.ahn-id-toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* ----------------------------------------------------------------------
 * Formulár fotky
 * -------------------------------------------------------------------- */
.ahn-idp {
	color: var(--ahn-id-text);
}

.ahn-idp [hidden] {
	display: none !important;
}

.ahn-idp__title {
	margin: 0 0 16px;
}

.ahn-idp__row {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

.ahn-idp__preview {
	--ahn-id-size: var(--ahn-idp-size);
}

.ahn-idp__actions {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	min-width: 0;
}

.ahn-idp__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 40px;
	padding: 8px 16px;
	border: 1px solid transparent;
	border-radius: var(--ahn-idp-btn-radius);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease;
}

.ahn-idp__btn--primary,
.ahn-idp__btn--primary:hover,
.ahn-idp__btn--primary:focus {
	background: var(--ahn-idp-accent);
	color: var(--ahn-idp-accent-text);
}

.ahn-idp__btn--primary:hover {
	opacity: 0.9;
}

.ahn-idp__btn--ghost,
.ahn-idp__btn--ghost:hover,
.ahn-idp__btn--ghost:focus {
	background: transparent;
	border-color: var(--ahn-id-border);
	color: var(--ahn-id-text);
}

.ahn-idp__btn--ghost:hover {
	background: rgba(0, 0, 0, 0.04);
}

.ahn-idp__btn[disabled],
.ahn-idp.is-busy .ahn-idp__btn {
	opacity: 0.55;
	pointer-events: none;
}

/* Skrytý input v tlačidle — prístupný klávesnicou cez label. */
.ahn-idp__file {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	overflow: hidden;
}

.ahn-idp__pick:focus-within {
	outline: 2px solid var(--ahn-id-focus);
	outline-offset: 2px;
}

.ahn-idp__help {
	margin: 0;
	color: var(--ahn-id-muted);
	font-size: 13px;
}

/* Orezanie */
.ahn-idp__cropper {
	margin-top: 20px;
	max-width: 320px;
}

.ahn-idp__viewport {
	position: relative;
	width: 280px;
	max-width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 12px;
	overflow: hidden;
	background: #111827;
	touch-action: none;
	cursor: grab;
}

.ahn-idp__viewport:active {
	cursor: grabbing;
}

/* Kruhový výrez ako náhľad toho, čo uvidia ostatní. */
.ahn-idp__viewport::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 999px rgba(17, 24, 39, 0.55);
	pointer-events: none;
}

.ahn-idp__canvas {
	display: block;
	width: 100%;
	height: 100%;
}

.ahn-idp__zoom-label {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 12px 0;
	color: var(--ahn-id-muted);
	font-size: 13px;
}

.ahn-idp__zoom {
	flex: 1;
}

.ahn-idp__crop-actions {
	display: flex;
	gap: 8px;
}

.ahn-idp__msg {
	margin: 12px 0 0;
	font-size: 14px;
	min-height: 1.4em;
}

.ahn-idp__msg.is-error {
	color: var(--ahn-id-danger);
}

@media (prefers-reduced-motion: reduce) {
	.ahn-id__skeleton,
	.ahn-id__pop {
		animation: none;
	}

	.ahn-id-toast {
		transition: none;
	}
}
