/* ═══════════════════════════════════════════
   BASE 3D DRUCK QUE — Dark Purple / Magenta Theme
   Three.js 3D Background + Glassmorphism Cards
   ═══════════════════════════════════════════ */

:root {
	--bg-primary: #0a0210;
	--bg-secondary: #0d0518;
	--bg-card: rgba(18, 7, 34, 0.65);
	--bg-card-hover: rgba(26, 12, 48, 0.8);
	--bg-nav: rgba(10, 2, 16, 0.88);
	--bg-form: rgba(18, 7, 34, 0.6);
	--bg-overlay: rgba(0, 0, 0, 0.5);

	--magenta: #d58dd8;
	--magenta-bright: #ebaee3;
	--magenta-dark: #a667ce;
	--pink: #e592d8;
	--purple: #9a5ba6;
	--purple-deep: #271332;

	--magenta-dim: rgba(213, 141, 216, 0.15);
	--magenta-glow: rgba(213, 141, 216, 0.08);
	--purple-dim: rgba(166, 103, 206, 0.15);

	--gradient-hero: linear-gradient(180deg, rgba(10, 2, 16, 0.3) 0%, rgba(10, 2, 16, 0.7) 100%);
	--gradient-accent: linear-gradient(135deg, var(--magenta), var(--purple));
	--gradient-btn: linear-gradient(135deg, var(--magenta), var(--magenta-dark));

	--text-primary: #e8dff0;
	--text-secondary: #b0a0c8;
	--text-muted: #605070;
	--text-accent: var(--magenta-bright);

	--border-subtle: rgba(213, 141, 216, 0.08);
	--border-card: rgba(213, 141, 216, 0.12);
	--border-accent: rgba(213, 141, 216, 0.3);
	--border-input: rgba(213, 141, 216, 0.2);
	--border-input-focus: rgba(213, 141, 216, 0.5);

	--nav-height: 64px;
	--max-width: 1120px;
	--radius: 12px;
	--radius-lg: 20px;
	--radius-full: 9999px;

	--font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

	--shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
	--shadow-glow: 0 0 40px rgba(213, 141, 216, 0.08);
	--glass-border: rgba(213, 141, 216, 0.08);
	--glass-bg: rgba(18, 7, 34, 0.55);
}

*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	font-size: 16px;
	scroll-behavior: smooth;
}

body {
	font-family: var(--font-body);
	background: var(--bg-primary);
	color: var(--text-primary);
	line-height: 1.7;
	min-height: 100vh;
	overflow-x: hidden;
}

/* ═══ THREE.JS CANVAS ═══ */
#heroCanvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	pointer-events: none;
}

#heroCanvas canvas {
	display: block;
	width: 100% !important;
	height: 100% !important;
}

/* Subtle grid overlay */
body::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-image:
		linear-gradient(rgba(213, 141, 216, 0.025) 1px, transparent 1px),
		linear-gradient(90deg, rgba(213, 141, 216, 0.025) 1px, transparent 1px);
	background-size: 60px 60px;
	pointer-events: none;
	z-index: 1;
}

/* Vignette overlay */
body::after {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: radial-gradient(ellipse at center, transparent 50%, rgba(10, 2, 16, 0.6) 100%);
	pointer-events: none;
	z-index: 1;
}

/* ═══ NAVIGATION ═══ */
nav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: var(--nav-height);
	background: var(--bg-nav);
	border-bottom: 1px solid var(--border-subtle);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	z-index: 100;
}

.nav-inner {
	max-width: var(--max-width);
	margin: 0 auto;
	padding: 0 1.5rem;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.logo {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	color: var(--text-primary);
	text-decoration: none;
	font-weight: 700;
	font-size: 1.15rem;
	transition: color 0.2s;
}

.logo:hover {
	color: var(--magenta-bright);
}

.logo-icon {
	color: var(--magenta);
	font-size: 1.3rem;
}

.nav-count {
	color: var(--text-muted);
	font-size: 0.85rem;
	padding: 0.25rem 0.75rem;
	border-radius: var(--radius-full);
	background: var(--magenta-dim);
}

/* ═══ HERO ═══ */
.hero {
	position: relative;
	z-index: 2;
	padding: 8rem 1.5rem 4rem;
	text-align: center;
	background: var(--gradient-hero);
	min-height: 70vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hero-content {
	max-width: 720px;
	margin: 0 auto;
	position: relative;
}

.hero-badge {
	display: inline-block;
	padding: 0.4rem 1.2rem;
	border-radius: var(--radius-full);
	background: var(--magenta-dim);
	border: 1px solid var(--border-card);
	color: var(--magenta-bright);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	margin-bottom: 1.5rem;
	backdrop-filter: blur(10px);
}

.hero h1 {
	font-size: 3.5rem;
	font-weight: 800;
	letter-spacing: -0.03em;
	margin-bottom: 1rem;
	background: var(--gradient-accent);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	line-height: 1.1;
}

.hero h1 .accent {
	-webkit-text-fill-color: var(--magenta-bright);
}

.hero-subtitle {
	color: var(--text-secondary);
	font-size: 1.25rem;
	margin-bottom: 0.75rem;
	font-weight: 500;
}

.hero-desc {
	color: var(--text-muted);
	font-size: 1rem;
	line-height: 1.7;
	max-width: 560px;
	margin: 0 auto;
}

/* ═══ FORM ═══ */
.form-section {
	position: relative;
	z-index: 2;
	padding: 1rem 1.5rem 2.5rem;
}

.form-card {
	max-width: 640px;
	margin: 0 auto;
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-lg);
	padding: 2.5rem;
	text-align: center;
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	box-shadow: var(--shadow-card), var(--shadow-glow);
}

.form-icon {
	font-size: 2.2rem;
	margin-bottom: 0.5rem;
}

.form-card h2 {
	font-size: 1.3rem;
	font-weight: 700;
	margin-bottom: 1.25rem;
	color: var(--text-primary);
}

.link-form {
	width: 100%;
}

.input-group {
	display: flex;
	gap: 0.75rem;
	width: 100%;
}

.input-group input {
	flex: 1;
	padding: 0.85rem 1.2rem;
	background: rgba(10, 2, 16, 0.6);
	border: 1px solid var(--border-input);
	border-radius: var(--radius);
	color: var(--text-primary);
	font-size: 1rem;
	font-family: var(--font-body);
	outline: none;
	transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.input-group input:focus {
	border-color: var(--border-input-focus);
	box-shadow: 0 0 0 3px var(--magenta-dim);
	background: rgba(10, 2, 16, 0.8);
}

.input-group input::placeholder {
	color: var(--text-muted);
}

.input-group button {
	padding: 0.85rem 2rem;
	background: var(--gradient-btn);
	border: none;
	border-radius: var(--radius);
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
	white-space: nowrap;
	font-family: var(--font-body);
	letter-spacing: 0.02em;
}

.input-group button:hover {
	opacity: 0.95;
	transform: translateY(-2px);
	box-shadow: 0 4px 20px rgba(213, 141, 216, 0.3);
}

.input-group button:active {
	transform: translateY(0);
	box-shadow: none;
}

.input-group button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.form-hint {
	margin-top: 0.85rem;
	color: var(--text-muted);
	font-size: 0.85rem;
	transition: color 0.3s;
}

.form-hint.error {
	color: #ff6b8a;
}

.form-hint.success {
	color: var(--magenta-bright);
}

/* ═══ LINKS SECTION ═══ */
.links-section {
	position: relative;
	z-index: 2;
	padding: 1rem 1.5rem 4rem;
	max-width: var(--max-width);
	margin: 0 auto;
}

.section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.5rem;
	gap: 1rem;
}

.section-header h2 {
	font-size: 1.3rem;
	font-weight: 700;
	color: var(--text-primary);
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.accent-line {
	display: inline-block;
	width: 3px;
	height: 1.2em;
	background: var(--gradient-accent);
	border-radius: 2px;
}

.count-badge {
	background: var(--magenta-dim);
	color: var(--magenta-bright);
	padding: 0.3rem 0.85rem;
	border-radius: var(--radius-full);
	font-size: 0.8rem;
	font-weight: 600;
	backdrop-filter: blur(4px);
}

/* ═══ LINK GRID ═══ */
.link-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
	gap: 1.25rem;
}

.link-card {
	position: relative;
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius);
	overflow: hidden;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s, box-shadow 0.3s;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.link-card:hover {
	transform: translateY(-4px) scale(1.01);
	border-color: var(--border-accent);
	box-shadow: var(--shadow-card), var(--shadow-glow);
	background: var(--bg-card-hover);
}

.link-card-inner {
	display: block;
	text-decoration: none;
	color: inherit;
}

.card-img {
	width: 100%;
	height: 200px;
	overflow: hidden;
	background: var(--bg-secondary);
	position: relative;
}

.card-img::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 40%;
	background: linear-gradient(transparent, rgba(18, 7, 34, 0.9));
	pointer-events: none;
}

.card-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.link-card:hover .card-img img {
	transform: scale(1.08);
}

.card-img.img-failed {
	display: none;
}

.card-img.img-failed::after {
	display: none;
}

.card-body {
	padding: 1.25rem;
}

.card-favicon {
	width: 16px;
	height: 16px;
	vertical-align: middle;
	margin-right: 0.5rem;
	border-radius: 3px;
}

.card-title {
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--text-primary);
	margin-bottom: 0.5rem;
	line-height: 1.4;
	display: inline;
	transition: color 0.2s;
}

a:hover .card-title {
	color: var(--magenta-bright);
}

.card-desc {
	color: var(--text-secondary);
	font-size: 0.88rem;
	line-height: 1.5;
	margin-top: 0.5rem;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.card-footer {
	margin-top: 0.85rem;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.card-url {
	color: var(--text-muted);
	font-size: 0.78rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.card-date {
	color: var(--text-muted);
	font-size: 0.75rem;
}

/* Delete button */
.card-delete {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.5);
	border: 1px solid rgba(255, 255, 255, 0.08);
	color: var(--text-muted);
	font-size: 1.1rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.25s, background 0.2s, color 0.2s, transform 0.2s;
	line-height: 1;
	backdrop-filter: blur(8px);
	z-index: 2;
}

.link-card:hover .card-delete {
	opacity: 1;
}

.card-delete:hover {
	background: rgba(255, 107, 138, 0.25);
	color: #ff6b8a;
	transform: scale(1.1);
}

/* ═══ EMPTY STATE ═══ */
.empty-state {
	text-align: center;
	padding: 4rem 2rem;
	color: var(--text-muted);
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-lg);
	backdrop-filter: blur(12px);
}

.empty-icon {
	font-size: 3rem;
	margin-bottom: 1rem;
}

.empty-state h3 {
	font-size: 1.2rem;
	color: var(--text-secondary);
	margin-bottom: 0.5rem;
}

.empty-state p {
	font-size: 0.9rem;
}

/* ═══ FOOTER ═══ */
footer {
	position: relative;
	z-index: 2;
	text-align: center;
	padding: 2.5rem;
	color: var(--text-muted);
	font-size: 0.85rem;
	border-top: 1px solid var(--border-subtle);
}

.footer-accent {
	color: var(--magenta);
	margin-right: 0.25rem;
}

/* ═══ TOAST ═══ */
.toast-container {
	position: fixed;
	bottom: 2rem;
	right: 2rem;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.toast {
	padding: 0.85rem 1.25rem;
	border-radius: var(--radius);
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
	color: var(--text-primary);
	font-size: 0.9rem;
	box-shadow: var(--shadow-card);
	animation: toastIn 0.3s ease;
	max-width: 400px;
	backdrop-filter: blur(12px);
}

.toast.error {
	border-color: rgba(255, 107, 138, 0.3);
	color: #ff6b8a;
}

.toast.success {
	border-color: var(--border-accent);
	color: var(--magenta-bright);
}

@keyframes toastIn {
	from {
		opacity: 0;
		transform: translateY(1rem) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
	.hero h1 {
		font-size: 2.2rem;
	}

	.hero {
		padding: 6rem 1rem 3rem;
		min-height: 60vh;
	}

	.hero-subtitle {
		font-size: 1.05rem;
	}

	.hero-desc {
		font-size: 0.9rem;
	}

	.input-group {
		flex-direction: column;
	}

	.input-group button {
		width: 100%;
	}

	.link-grid {
		grid-template-columns: 1fr;
	}

	.card-img {
		height: 160px;
	}

	.form-card {
		padding: 1.5rem;
	}

	.toast-container {
		left: 1rem;
		right: 1rem;
		bottom: 1rem;
	}

	.nav-inner {
		padding: 0 1rem;
	}
}

@media (max-width: 480px) {
	.hero h1 {
		font-size: 1.8rem;
	}

	.links-section {
		padding: 0.5rem 1rem 3rem;
	}

	.form-section {
		padding: 0.5rem 1rem 2rem;
	}
}

/* ═══ PREVIEW CARD ═══ */

.preview-area {
	max-width: 640px;
	margin: 0 auto;
	margin-top: 1rem;
}

.preview-card {
	background: var(--glass-bg);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius-lg);
	overflow: hidden;
	animation: fadeInUp 0.4s ease-out;
}

.preview-img {
	width: 100%;
	max-height: 240px;
	overflow: hidden;
	background: var(--bg-card);
}

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

.preview-body {
	padding: 1rem 1.25rem;
}

.preview-title {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--text-primary);
	margin-bottom: 0.4rem;
	line-height: 1.4;
}

.preview-desc {
	font-size: 0.875rem;
	color: var(--text-secondary);
	margin-bottom: 0.5rem;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.preview-url {
	font-size: 0.75rem;
	color: var(--magenta-dark);
	word-break: break-all;
}

.preview-actions {
	display: flex;
	gap: 0.5rem;
	padding: 0 1.25rem 1rem;
}

.preview-btn {
	flex: 1;
	padding: 0.625rem 1rem;
	border: none;
	border-radius: var(--radius);
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.preview-btn-primary {
	background: linear-gradient(135deg, var(--magenta), var(--magenta-dark));
	color: white;
}

.preview-btn-primary:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 15px rgba(213, 141, 216, 0.4);
}

.preview-btn-secondary {
	background: rgba(255, 255, 255, 0.08);
	color: var(--text-secondary);
	border: 1px solid var(--glass-border);
}

.preview-btn-secondary:hover {
	background: rgba(255, 255, 255, 0.12);
	color: var(--text-primary);
}

/* ═══ MANUAL INPUT (Cloudflare fallback) ═══ */

.manual-notice {
	font-size: 0.875rem;
	color: #FF6B8A;
	margin-bottom: 0.75rem;
	line-height: 1.5;
}

.manual-fields {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.manual-input {
	width: 100%;
	padding: 0.625rem 0.75rem;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--glass-border);
	border-radius: var(--radius);
	color: var(--text-primary);
	font-size: 0.875rem;
	font-family: inherit;
	transition: border-color 0.2s ease;
	box-sizing: border-box;
}

.manual-input:focus {
	outline: none;
	border-color: var(--magenta);
	box-shadow: 0 0 0 2px rgba(213, 141, 216, 0.2);
}

.manual-textarea {
	resize: vertical;
	min-height: 2.5rem;
}

.manual-input::placeholder {
	color: var(--text-muted);
}

/* ═══ ADMIN MODE ═══ */

.nav-right {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.admin-toggle {
	background: none;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius);
	padding: 0.35rem 0.5rem;
	font-size: 1rem;
	cursor: pointer;
	transition: all 0.2s ease;
	line-height: 1;
}

.admin-toggle:hover {
	border-color: var(--border-accent);
	background: var(--magenta-dim);
}

.admin-toggle[data-admin="true"] {
	border-color: var(--magenta);
	background: var(--magenta-dim);
	box-shadow: 0 0 12px var(--magenta-glow);
}

/* Delete buttons: hidden by default, shown in admin mode */
.card-delete {
	display: none;
}

body[data-admin="true"] .card-delete {
	display: flex;
}

/* ═══ ANIMATIONS ═══ */
@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.hero-content {
	animation: fadeInUp 0.8s ease-out;
}

.form-card {
	animation: fadeInUp 0.8s ease-out 0.2s both;
}
