/* ===========================================================================
   LayerForge Tickets — Ticket Portal
   Fancy, animated submission UI: glassmorphism + float labels + drag-drop
   =========================================================================== */

.lft-portal {
	--lft-accent: #6366f1;
	--lft-accent-2: #ec4899;
	--lft-bg: rgba(255, 255, 255, 0.7);
	--lft-bg-strong: rgba(255, 255, 255, 0.9);
	--lft-border: rgba(0, 0, 0, 0.08);
	--lft-text: #0f172a;
	--lft-muted: #64748b;
	--lft-input-bg: rgba(255, 255, 255, 0.6);
	--lft-radius: 16px;
	--lft-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.15);

	position: relative;
	max-width: 720px;
	margin: 32px auto;
	padding: 40px 32px;
	border-radius: var(--lft-radius);
	background: var(--lft-bg);
	border: 1px solid var(--lft-border);
	box-shadow: var(--lft-shadow);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	overflow: hidden;
	color: var(--lft-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
	animation: lft-portal-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.lft-portal.lft-theme-dark {
	--lft-bg: rgba(15, 23, 42, 0.7);
	--lft-bg-strong: rgba(15, 23, 42, 0.9);
	--lft-border: rgba(255, 255, 255, 0.1);
	--lft-text: #f1f5f9;
	--lft-muted: #94a3b8;
	--lft-input-bg: rgba(255, 255, 255, 0.05);
	color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
	.lft-portal.lft-theme-auto {
		--lft-bg: rgba(15, 23, 42, 0.7);
		--lft-bg-strong: rgba(15, 23, 42, 0.9);
		--lft-border: rgba(255, 255, 255, 0.1);
		--lft-text: #f1f5f9;
		--lft-muted: #94a3b8;
		--lft-input-bg: rgba(255, 255, 255, 0.05);
		color-scheme: dark;
	}
}

@keyframes lft-portal-enter {
	from {
		opacity: 0;
		transform: translateY(20px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ---------- Decorative background orbs ---------- */
.lft-portal-bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	overflow: hidden;
}

.lft-orb {
	position: absolute;
	border-radius: 50%;
	filter: blur(60px);
	opacity: 0.4;
	animation: lft-orb-float 18s ease-in-out infinite;
}

.lft-orb-1 {
	width: 320px;
	height: 320px;
	top: -100px;
	right: -80px;
	background: var(--lft-accent);
}

.lft-orb-2 {
	width: 280px;
	height: 280px;
	bottom: -80px;
	left: -60px;
	background: var(--lft-accent-2);
	animation-delay: -6s;
	animation-duration: 22s;
}

.lft-orb-3 {
	width: 200px;
	height: 200px;
	top: 50%;
	left: 50%;
	background: #38bdf8;
	opacity: 0.3;
	animation-delay: -12s;
	animation-duration: 26s;
}

@keyframes lft-orb-float {
	0%, 100% {
		transform: translate(0, 0) scale(1);
	}
	33% {
		transform: translate(40px, -30px) scale(1.15);
	}
	66% {
		transform: translate(-30px, 40px) scale(0.9);
	}
}

/* ---------- Views ---------- */
.lft-portal-view {
	position: relative;
	z-index: 1;
}

.lft-portal-view[hidden] {
	display: none !important;
}

.lft-portal-form-view {
	animation: lft-fade-in 0.5s ease-out;
}

.lft-portal-success-view {
	animation: lft-fade-in 0.5s ease-out;
	text-align: center;
	padding: 32px 0;
}

@keyframes lft-fade-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---------- Header ---------- */
.lft-portal-header {
	margin-bottom: 28px;
	text-align: center;
}

.lft-portal-title {
	margin: 0 0 8px;
	font-size: 28px;
	font-weight: 700;
	background: linear-gradient(135deg, var(--lft-accent), var(--lft-accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	letter-spacing: -0.02em;
}

.lft-portal-subtitle {
	margin: 0;
	font-size: 15px;
	color: var(--lft-muted);
}

/* ---------- Fields ---------- */
.lft-portal-field {
	position: relative;
	margin-bottom: 20px;
}

.lft-portal-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

@media (max-width: 540px) {
	.lft-portal-row {
		grid-template-columns: 1fr;
	}
	.lft-portal {
		padding: 28px 20px;
	}
	.lft-portal-title {
		font-size: 24px;
	}
}

.lft-portal-label {
	display: block;
	margin-bottom: 10px;
	font-size: 13px;
	font-weight: 600;
	color: var(--lft-text);
	letter-spacing: 0.01em;
}

/* ---------- Float-label inputs ---------- */
.lft-portal-float {
	position: relative;
}

.lft-portal-float input,
.lft-portal-float textarea,
.lft-portal-float select {
	width: 100%;
	padding: 18px 16px 8px;
	font-size: 15px;
	font-family: inherit;
	color: var(--lft-text);
	background: var(--lft-input-bg);
	border: 1px solid var(--lft-border);
	border-radius: 12px;
	outline: none;
	transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
	box-sizing: border-box;
}

.lft-portal-float textarea {
	resize: vertical;
	min-height: 120px;
	padding-top: 24px;
}

.lft-portal-float input:focus,
.lft-portal-float textarea:focus,
.lft-portal-float select:focus {
	border-color: var(--lft-accent);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--lft-accent) 18%, transparent);
	background: var(--lft-bg-strong);
}

.lft-portal-float label {
	position: absolute;
	top: 16px;
	left: 16px;
	font-size: 15px;
	color: var(--lft-muted);
	pointer-events: none;
	transition: transform 0.2s, color 0.2s, font-size 0.2s, top 0.2s;
	background: transparent;
	padding: 0 4px;
}

.lft-portal-float input:focus + label,
.lft-portal-float input:not(:placeholder-shown) + label,
.lft-portal-float textarea:focus + label,
.lft-portal-float textarea:not(:placeholder-shown) + label,
.lft-portal-float select + label {
	top: 4px;
	font-size: 11px;
	font-weight: 600;
	color: var(--lft-accent);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* Selects never have placeholder-shown semantics; keep label always raised. */
.lft-portal-float select {
	padding-top: 22px;
	padding-bottom: 6px;
	appearance: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 7' fill='%2364748b'><path d='M6 7 0 1l1.4-1L6 4.2 10.6 0 12 1z'/></svg>");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 10px;
	padding-right: 36px;
}

/* Counter under textarea */
.lft-portal-counter {
	position: absolute;
	right: 14px;
	bottom: 10px;
	font-size: 11px;
	color: var(--lft-muted);
	pointer-events: none;
	font-variant-numeric: tabular-nums;
}

.lft-portal-counter.is-warning .lft-counter-current {
	color: #f59e0b;
}

.lft-portal-counter.is-danger .lft-counter-current {
	color: #ef4444;
}

/* ---------- Type cards ---------- */
.lft-portal-type-grid {
	border: 0;
	padding: 0;
	margin-bottom: 28px;
}

.lft-portal-type-grid legend {
	float: none;
	width: auto;
	padding: 0;
}

.lft-type-options {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 10px;
}

.lft-type-card {
	cursor: pointer;
	position: relative;
}

.lft-type-card input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.lft-type-card-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 16px 8px;
	background: var(--lft-input-bg);
	border: 1px solid var(--lft-border);
	border-radius: 12px;
	transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
	text-align: center;
}

.lft-type-card:hover .lft-type-card-inner {
	transform: translateY(-2px);
	border-color: color-mix(in srgb, var(--lft-accent) 40%, var(--lft-border));
}

.lft-type-card input:checked + .lft-type-card-inner {
	border-color: var(--lft-accent);
	background: color-mix(in srgb, var(--lft-accent) 8%, var(--lft-bg-strong));
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--lft-accent) 15%, transparent);
}

.lft-type-card input:focus-visible + .lft-type-card-inner {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--lft-accent) 30%, transparent);
}

.lft-type-icon {
	font-size: 24px;
	line-height: 1;
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lft-type-card:hover .lft-type-icon,
.lft-type-card input:checked + .lft-type-card-inner .lft-type-icon {
	transform: scale(1.15) rotate(-4deg);
}

.lft-type-name {
	font-size: 12px;
	font-weight: 600;
	color: var(--lft-text);
}

/* ---------- Logged-in identity card ---------- */
.lft-portal-identity {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	background: var(--lft-input-bg);
	border: 1px solid var(--lft-border);
	border-radius: 12px;
	margin-bottom: 20px;
}

.lft-portal-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--lft-accent), var(--lft-accent-2));
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 18px;
	text-transform: uppercase;
	flex-shrink: 0;
}

.lft-portal-identity-name {
	font-weight: 600;
	font-size: 14px;
}

.lft-portal-identity-email {
	font-size: 12px;
	color: var(--lft-muted);
}

/* ---------- Dropzone ---------- */
.lft-dropzone {
	position: relative;
	padding: 28px 20px;
	border: 2px dashed var(--lft-border);
	border-radius: 14px;
	background: var(--lft-input-bg);
	cursor: pointer;
	transition: all 0.2s;
}

.lft-dropzone:hover,
.lft-dropzone:focus-visible {
	border-color: var(--lft-accent);
	background: color-mix(in srgb, var(--lft-accent) 5%, var(--lft-input-bg));
}

.lft-dropzone.is-dragover {
	border-color: var(--lft-accent);
	background: color-mix(in srgb, var(--lft-accent) 12%, var(--lft-input-bg));
	transform: scale(1.01);
}

.lft-dropzone-prompt {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	text-align: center;
	color: var(--lft-muted);
	pointer-events: none;
}

.lft-dropzone-icon {
	width: 36px;
	height: 36px;
	color: var(--lft-accent);
	margin-bottom: 4px;
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lft-dropzone.is-dragover .lft-dropzone-icon {
	transform: translateY(-4px) scale(1.1);
}

.lft-dropzone-text strong {
	color: var(--lft-text);
	font-size: 15px;
	display: block;
}

.lft-dropzone-text span {
	font-size: 13px;
}

.lft-dropzone small {
	margin-top: 4px;
	font-size: 11px;
	opacity: 0.7;
}

.lft-file-list {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.lft-file-list:empty {
	display: none;
}

.lft-file-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	background: var(--lft-bg-strong);
	border: 1px solid var(--lft-border);
	border-radius: 8px;
	font-size: 13px;
	animation: lft-file-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lft-file-in {
	from {
		opacity: 0;
		transform: translateX(-12px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

.lft-file-item.is-removing {
	animation: lft-file-out 0.25s ease-in forwards;
}

@keyframes lft-file-out {
	to {
		opacity: 0;
		transform: translateX(12px);
		max-height: 0;
		padding-top: 0;
		padding-bottom: 0;
		margin: 0;
	}
}

.lft-file-name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lft-file-size {
	font-size: 11px;
	color: var(--lft-muted);
	font-variant-numeric: tabular-nums;
}

.lft-file-remove {
	background: transparent;
	border: 0;
	cursor: pointer;
	color: var(--lft-muted);
	font-size: 18px;
	line-height: 1;
	padding: 4px;
	border-radius: 4px;
	transition: color 0.15s, background 0.15s;
}

.lft-file-remove:hover {
	color: #ef4444;
	background: color-mix(in srgb, #ef4444 10%, transparent);
}

/* ---------- Submit button ---------- */
.lft-portal-submit {
	position: relative;
	width: 100%;
	padding: 14px 24px;
	background: linear-gradient(135deg, var(--lft-accent), var(--lft-accent-2));
	color: #fff;
	border: 0;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	overflow: hidden;
	transition: transform 0.15s, box-shadow 0.2s;
	box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--lft-accent) 50%, transparent);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.lft-portal-submit:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 12px 32px -8px color-mix(in srgb, var(--lft-accent) 60%, transparent);
}

.lft-portal-submit:active:not(:disabled) {
	transform: translateY(0);
}

.lft-portal-submit:disabled {
	opacity: 0.7;
	cursor: wait;
}

.lft-portal-submit::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
	transform: translateX(-100%);
	transition: transform 0.6s;
}

.lft-portal-submit:hover::before {
	transform: translateX(100%);
}

.lft-submit-arrow {
	width: 18px;
	height: 18px;
	transition: transform 0.2s;
}

.lft-portal-submit:hover .lft-submit-arrow {
	transform: translateX(4px);
}

.lft-submit-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: lft-spin 0.7s linear infinite;
}

.lft-portal-submit.is-loading .lft-submit-label,
.lft-portal-submit.is-loading .lft-submit-arrow {
	display: none;
}

.lft-portal-submit.is-loading .lft-submit-spinner {
	display: inline-block;
}

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

/* ---------- Error message ---------- */
.lft-portal-error {
	margin-top: 14px;
	padding: 12px 14px;
	background: color-mix(in srgb, #ef4444 10%, transparent);
	border: 1px solid color-mix(in srgb, #ef4444 30%, transparent);
	color: #b91c1c;
	border-radius: 10px;
	font-size: 13px;
	animation: lft-shake 0.4s;
}

@keyframes lft-shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-6px); }
	75% { transform: translateX(6px); }
}

/* ---------- Success state ---------- */
.lft-success-checkmark {
	margin: 0 auto 24px;
	width: 80px;
	height: 80px;
}

.lft-success-checkmark svg {
	width: 100%;
	height: 100%;
}

.lft-check-circle {
	stroke: var(--lft-accent);
	stroke-width: 3;
	stroke-dasharray: 151;
	stroke-dashoffset: 151;
	animation: lft-draw-circle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.lft-check-path {
	stroke: var(--lft-accent);
	stroke-width: 4;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 50;
	stroke-dashoffset: 50;
	animation: lft-draw-check 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.5s forwards;
}

@keyframes lft-draw-circle {
	to {
		stroke-dashoffset: 0;
	}
}

@keyframes lft-draw-check {
	to {
		stroke-dashoffset: 0;
	}
}

.lft-success-title {
	margin: 0 0 12px;
	font-size: 26px;
	font-weight: 700;
	background: linear-gradient(135deg, var(--lft-accent), var(--lft-accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.lft-success-subtitle {
	font-size: 15px;
	color: var(--lft-muted);
	margin: 0 0 8px;
}

.lft-success-number {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--lft-text);
	font-size: 18px;
	padding: 2px 10px;
	background: var(--lft-input-bg);
	border-radius: 6px;
	margin-left: 6px;
}

.lft-success-help {
	max-width: 440px;
	margin: 0 auto 24px;
	font-size: 13px;
	color: var(--lft-muted);
	line-height: 1.6;
}

.lft-portal-reset {
	padding: 10px 20px;
	background: var(--lft-input-bg);
	color: var(--lft-text);
	border: 1px solid var(--lft-border);
	border-radius: 10px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s;
}

.lft-portal-reset:hover {
	border-color: var(--lft-accent);
	background: color-mix(in srgb, var(--lft-accent) 6%, var(--lft-input-bg));
}

/* ---------- Locked state ---------- */
.lft-portal-locked {
	max-width: 480px;
	margin: 32px auto;
	padding: 32px;
	text-align: center;
	background: rgba(255, 255, 255, 0.7);
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 16px;
	backdrop-filter: blur(20px);
	font-size: 15px;
}

.lft-lock-icon {
	display: block;
	font-size: 32px;
	margin-bottom: 12px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.lft-portal,
	.lft-portal-form-view,
	.lft-portal-success-view,
	.lft-orb,
	.lft-portal-submit::before,
	.lft-file-item {
		animation: none !important;
	}
	.lft-check-circle,
	.lft-check-path {
		animation: none !important;
		stroke-dashoffset: 0 !important;
	}
}
