/* Kayıp İtiraf Sistemi v2.1 — Premium UI (theme-independent, WCAG contrast) */

.kh-form-shell,
.kh-floating-root,
.kh-stats-widget,
.kh-landing,
.kh-modal-portal {
	--kh-accent: #7c5cff;
	--kh-accent-2: #ff4d8d;
	--kh-accent-glow: rgba(124, 92, 255, 0.45);
	--kh-surface: #121826;
	--kh-surface-2: #1a2236;
	--kh-surface-glass: rgba(18, 24, 38, 0.94);
	--kh-border: rgba(255, 255, 255, 0.16);
	--kh-border-glow: rgba(124, 92, 255, 0.35);
	--kh-text: #f8fafc;
	--kh-text-secondary: #e2e8f0;
	--kh-muted: #cbd5e1;
	--kh-heading: #ffffff;
	--kh-success: #22c55e;
	--kh-success-bg: rgba(34, 197, 94, 0.14);
	--kh-error: #ef4444;
	--kh-error-bg: rgba(239, 68, 68, 0.14);
	--kh-radius: 20px;
	--kh-radius-sm: 14px;
	--kh-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
	--kh-shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.25);
	--kh-transition: 0.32s cubic-bezier(0.22, 1, 0.36, 1);
	--kh-z-fab: 99998;
	--kh-z-overlay: 99999;
	--kh-z-modal: 100000;
	font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
	color: var(--kh-text);
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: light) {
	.kh-landing {
		--kh-surface: #ffffff;
		--kh-surface-2: #f8fafc;
		--kh-surface-glass: rgba(255, 255, 255, 0.96);
		--kh-border: rgba(15, 23, 42, 0.12);
		--kh-text: #0f172a;
		--kh-text-secondary: #1e293b;
		--kh-muted: #475569;
		--kh-heading: #020617;
	}
}

.kh-form-shell *,
.kh-floating-root *,
.kh-stats-widget *,
.kh-landing *,
.kh-modal-portal * {
	box-sizing: border-box;
}

/* Animations */
.kh-animate-fade-in {
	animation: khFadeIn 0.5s ease both;
}

.kh-animate-slide-up {
	animation: khSlideUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes khFadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes khSlideUp {
	from { opacity: 0; transform: translateY(18px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes khFabPulse {
	0%, 100% { transform: scale(1); opacity: 0.55; }
	50% { transform: scale(1.35); opacity: 0; }
}

@keyframes khSpin {
	to { transform: rotate(360deg); }
}

@keyframes khPromoPulse {
	0%, 100% { box-shadow: 0 10px 30px rgba(221, 36, 118, 0.35); }
	50% { box-shadow: 0 14px 44px rgba(255, 81, 47, 0.55); }
}

/* Form layout */
.kh-form {
	display: grid;
	gap: 18px;
}

.kh-form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}

.kh-field label {
	display: block;
	margin-bottom: 8px;
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--kh-heading);
	letter-spacing: 0.01em;
}

.kh-optional {
	font-weight: 500;
	color: var(--kh-muted);
	font-size: 0.82rem;
}

.kh-field input[type="text"],
.kh-field textarea {
	width: 100%;
	padding: 14px 16px;
	border: 1px solid var(--kh-border);
	border-radius: var(--kh-radius-sm);
	background: rgba(255, 255, 255, 0.06);
	color: var(--kh-text);
	font-size: 16px;
	line-height: 1.5;
	font-family: inherit;
	transition: border-color var(--kh-transition), box-shadow var(--kh-transition), background var(--kh-transition);
}

.kh-field input::placeholder,
.kh-field textarea::placeholder {
	color: var(--kh-muted);
	opacity: 1;
}

.kh-field input:focus-visible,
.kh-field textarea:focus-visible {
	outline: none;
	border-color: var(--kh-accent);
	box-shadow: 0 0 0 4px var(--kh-accent-glow);
	background: rgba(255, 255, 255, 0.09);
}

.kh-story-textarea {
	min-height: 300px;
	height: 300px;
	resize: vertical;
	overflow: hidden;
	line-height: 1.65;
}

.kh-story-tip {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin-bottom: 12px;
	padding: 14px 16px;
	border-radius: var(--kh-radius-sm);
	border: 1px solid var(--kh-border-glow);
	background: linear-gradient(135deg, rgba(124, 92, 255, 0.12), rgba(255, 77, 141, 0.08));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.kh-story-tip__icon {
	font-size: 1.2rem;
	line-height: 1;
	flex-shrink: 0;
}

.kh-story-tip p {
	margin: 0;
	font-size: 0.92rem;
	line-height: 1.55;
	color: var(--kh-text-secondary);
}

.kh-char-counter {
	margin-top: 8px;
	text-align: right;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--kh-muted);
}

.kh-char-counter.is-warning {
	color: #f59e0b;
}

.kh-char-counter.is-danger {
	color: var(--kh-error);
}

/* Premium dropzone */
.kh-dropzone {
	position: relative;
	padding: 28px 20px;
	border: 2px dashed var(--kh-border-glow);
	border-radius: var(--kh-radius);
	background: linear-gradient(180deg, rgba(124, 92, 255, 0.08), rgba(255, 255, 255, 0.02));
	text-align: center;
	cursor: pointer;
	transition: transform var(--kh-transition), border-color var(--kh-transition), box-shadow var(--kh-transition);
}

.kh-dropzone:hover,
.kh-dropzone.is-dragover {
	transform: translateY(-2px);
	border-color: var(--kh-accent);
	box-shadow: 0 0 0 4px var(--kh-accent-glow), var(--kh-shadow-soft);
}

.kh-dropzone__visual {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	margin: 0 auto 12px;
	border-radius: 18px;
	background: rgba(124, 92, 255, 0.15);
	color: var(--kh-accent);
}

.kh-dropzone__text {
	margin: 0 0 6px;
	font-size: 1rem;
	font-weight: 700;
	color: var(--kh-heading);
}

.kh-dropzone__hint {
	margin: 0;
	font-size: 0.84rem;
	color: var(--kh-muted);
}

.kh-dropzone__input {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
}

/* File previews */
.kh-file-list {
	display: grid;
	gap: 12px;
	margin-top: 12px;
}

.kh-file-list__item {
	display: grid;
	grid-template-columns: 88px 1fr auto;
	gap: 12px;
	align-items: center;
	padding: 12px;
	border: 1px solid var(--kh-border);
	border-radius: var(--kh-radius-sm);
	background: rgba(255, 255, 255, 0.04);
	transition: border-color var(--kh-transition);
}

.kh-file-list__item:hover {
	border-color: var(--kh-border-glow);
}

.kh-file-list__preview {
	width: 88px;
	height: 66px;
	border-radius: 10px;
	overflow: hidden;
	display: grid;
	place-items: center;
	background: rgba(255, 255, 255, 0.06);
	font-size: 0.72rem;
	font-weight: 800;
	color: var(--kh-text-secondary);
}

.kh-file-list__preview img,
.kh-file-list__preview video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.kh-file-list__preview audio {
	width: 100%;
	height: 36px;
}

.kh-file-list__meta strong {
	display: block;
	font-size: 0.9rem;
	color: var(--kh-heading);
	word-break: break-word;
}

.kh-file-list__meta span {
	font-size: 0.8rem;
	color: var(--kh-muted);
}

.kh-file-list__remove {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: var(--kh-error-bg);
	color: var(--kh-error);
	cursor: pointer;
	font-size: 1.3rem;
	line-height: 1;
	transition: transform var(--kh-transition);
}

.kh-file-list__remove:hover {
	transform: scale(1.08);
}

/* Progress */
.kh-upload-progress {
	position: relative;
	margin-top: 12px;
	height: 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	overflow: hidden;
}

.kh-upload-progress__bar {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--kh-accent), var(--kh-accent-2));
	transition: width 0.2s ease;
}

.kh-upload-progress__text {
	position: absolute;
	right: 0;
	top: -24px;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--kh-muted);
}

/* Feedback & submit */
.kh-form__feedback {
	padding: 14px 16px;
	border-radius: var(--kh-radius-sm);
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.5;
}

.kh-form__feedback.is-success {
	background: var(--kh-success-bg);
	border: 1px solid rgba(34, 197, 94, 0.45);
	color: #bbf7d0;
}

.kh-form__feedback.is-error {
	background: var(--kh-error-bg);
	border: 1px solid rgba(239, 68, 68, 0.45);
	color: #fecaca;
}

.kh-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 56px;
	padding: 16px 20px;
	border: 0;
	border-radius: var(--kh-radius-sm);
	background: linear-gradient(135deg, var(--kh-accent), var(--kh-accent-2));
	color: #fff;
	font-size: 1rem;
	font-family: inherit;
	font-weight: 800;
	cursor: pointer;
	box-shadow: 0 12px 32px rgba(124, 92, 255, 0.35);
	transition: transform var(--kh-transition), filter var(--kh-transition), box-shadow var(--kh-transition);
}

.kh-submit:hover:not(:disabled) {
	transform: translateY(-2px);
	filter: brightness(1.06);
	box-shadow: 0 16px 40px rgba(124, 92, 255, 0.42);
}

.kh-submit:disabled {
	opacity: 0.78;
	cursor: wait;
}

.kh-submit__spinner {
	display: none;
	width: 22px;
	height: 22px;
	margin-left: 10px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: khSpin 0.8s linear infinite;
}

.kh-submit.is-loading .kh-submit__spinner {
	display: inline-block;
}

/* Success card */
.kh-thankyou {
	margin-top: 18px;
	padding: 24px 20px;
	border-radius: var(--kh-radius);
	background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(34, 197, 94, 0.08));
	border: 1px solid rgba(34, 197, 94, 0.45);
	text-align: center;
	box-shadow: var(--kh-shadow-soft);
}

.kh-thankyou__icon {
	width: 56px;
	height: 56px;
	margin: 0 auto 12px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: rgba(34, 197, 94, 0.25);
	color: #fff;
	font-size: 1.6rem;
	font-weight: 900;
}

.kh-thankyou h3 {
	margin: 0 0 8px;
	font-size: 1.2rem;
	color: #fff;
}

.kh-thankyou p {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.6;
	color: #dcfce7;
}

.kh-promo-btn {
	display: block;
	margin-bottom: 16px;
	padding: 15px 18px;
	border-radius: var(--kh-radius-sm);
	text-align: center;
	text-decoration: none;
	font-weight: 800;
	color: #fff !important;
	background: linear-gradient(135deg, #ff512f, #dd2476);
	box-shadow: 0 10px 30px rgba(221, 36, 118, 0.35);
	animation: khPromoPulse 2.2s ease-in-out infinite;
	transition: transform var(--kh-transition);
}

.kh-promo-btn:hover {
	transform: translateY(-2px);
	color: #fff !important;
}

.kh-form-shell__contact {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}

.kh-form-shell__contact a {
	padding: 8px 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid var(--kh-border);
	color: var(--kh-text) !important;
	text-decoration: none;
	font-size: 0.82rem;
	font-weight: 700;
}

.kh-form-shell {
	padding: 22px;
	border-radius: var(--kh-radius);
	background: var(--kh-surface-glass);
	border: 1px solid var(--kh-border);
	box-shadow: var(--kh-shadow-soft);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
}

/* Floating button — 70px touch target */
.kh-floating-root {
	position: relative;
	z-index: var(--kh-z-fab);
}

.kh-fab {
	position: fixed;
	right: max(18px, env(safe-area-inset-right));
	bottom: max(18px, env(safe-area-inset-bottom));
	z-index: var(--kh-z-fab);
	width: 70px;
	height: 70px;
	min-width: 70px;
	min-height: 70px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: transform var(--kh-transition);
}

.kh-fab__pulse {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--kh-accent), var(--kh-accent-2));
	animation: khFabPulse 2s ease-out infinite;
}

.kh-fab__inner {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.22);
	background: linear-gradient(135deg, #7c5cff, #ff4d8d);
	color: #fff;
	box-shadow: 0 14px 40px rgba(124, 92, 255, 0.45);
	transition: transform var(--kh-transition), box-shadow var(--kh-transition);
}

.kh-fab:hover .kh-fab__inner,
.kh-fab:focus-visible .kh-fab__inner {
	transform: translateY(-3px) scale(1.04);
	box-shadow: 0 18px 50px rgba(124, 92, 255, 0.55);
}

.kh-fab:focus-visible {
	outline: none;
}

.kh-fab__icon {
	width: 24px;
	height: 24px;
}

.kh-fab__label {
	margin-top: 2px;
	font-size: 0.62rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: 0.02em;
}

/* Modal portal — appended to body, always on top */
.kh-modal-portal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	height: 100dvh;
	z-index: var(--kh-z-overlay);
	pointer-events: none;
}

.kh-modal-portal.is-active {
	pointer-events: auto;
}

.kh-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: var(--kh-z-overlay);
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	opacity: 0;
	transition: opacity var(--kh-transition);
}

.kh-modal-overlay.is-visible {
	opacity: 1;
}

.kh-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: var(--kh-z-modal);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
	opacity: 0;
	transform: scale(0.96);
	transition: opacity var(--kh-transition), transform var(--kh-transition);
	pointer-events: none;
	overflow-y: auto;
}

.kh-modal.is-open {
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

.kh-modal__dialog {
	width: min(100%, 520px);
	max-height: min(92vh, 920px);
	overflow-y: auto;
	padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
	border-radius: var(--kh-radius);
	background: var(--kh-surface-glass);
	border: 1px solid var(--kh-border);
	box-shadow: var(--kh-shadow), 0 0 0 1px rgba(124, 92, 255, 0.12);
	backdrop-filter: blur(24px) saturate(150%);
	-webkit-backdrop-filter: blur(24px) saturate(150%);
}

.kh-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
}

.kh-modal__header h2 {
	margin: 0 0 6px;
	font-size: 1.25rem;
	font-weight: 900;
	color: var(--kh-heading);
}

.kh-modal__header p {
	margin: 0;
	color: var(--kh-text-secondary);
	font-size: 0.92rem;
}

.kh-modal__close {
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	border: 1px solid var(--kh-border);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: var(--kh-heading);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	transition: background var(--kh-transition), transform var(--kh-transition);
}

.kh-modal__close:hover {
	background: rgba(255, 255, 255, 0.14);
	transform: rotate(90deg);
}

body.kh-modal-open {
	overflow: hidden !important;
}

html.kh-modal-open {
	overflow: hidden !important;
}

/* Stats widget */
.kh-stats-widget__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
}

.kh-stats-widget__card {
	padding: 16px;
	border-radius: var(--kh-radius-sm);
	background: var(--kh-surface-glass);
	border: 1px solid var(--kh-border);
}

.kh-stats-widget__label {
	display: block;
	font-size: 0.82rem;
	color: var(--kh-muted);
	margin-bottom: 6px;
}

.kh-stats-widget__card strong {
	font-size: 1.5rem;
	color: var(--kh-heading);
}

/* Responsive */
@media (max-width: 768px) {
	.kh-form__grid {
		grid-template-columns: 1fr;
	}

	.kh-file-list__item {
		grid-template-columns: 72px 1fr auto;
	}

	.kh-file-list__preview {
		width: 72px;
		height: 56px;
	}
}

@media (max-width: 414px) {
	.kh-modal__dialog {
		width: 100%;
		max-height: 96vh;
		border-radius: 16px;
		padding: 18px 14px calc(20px + env(safe-area-inset-bottom));
	}

	.kh-fab {
		right: max(12px, env(safe-area-inset-right));
		bottom: max(12px, env(safe-area-inset-bottom));
	}
}

@media (min-width: 1024px) {
	.kh-modal__dialog {
		width: min(100%, 560px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.kh-animate-fade-in,
	.kh-animate-slide-up,
	.kh-fab__pulse,
	.kh-promo-btn,
	.kh-submit__spinner {
		animation: none;
	}

	.kh-modal,
	.kh-modal-overlay,
	.kh-fab__inner,
	.kh-submit,
	.kh-dropzone,
	.kh-landing__card {
		transition: none;
	}
}
