/* ==========================================================================
   Kondolenzbuch – Frontend Styles
   ========================================================================== */

/* Variables */
:root {
	--kdb-primary:       #6b5b4e;
	--kdb-primary-light: #8b7560;
	--kdb-accent:        #c4a882;
	--kdb-bg:            #faf8f5;
	--kdb-bg-card:       #ffffff;
	--kdb-border:        #e8e0d5;
	--kdb-text:          #2c2c2c;
	--kdb-text-muted:    #6b6b6b;
	--kdb-error:         #dc2626;
	--kdb-success:       #16a34a;
	--kdb-radius:        8px;
	--kdb-shadow:        0 2px 8px rgba(0,0,0,0.08);
}

/* Wrapper */
.kdbuch-wrapper {
	max-width: 780px;
	margin: 0 auto;
	padding: 0 16px;
	font-family: inherit;
	color: var(--kdb-text);
	background-color: var(--kdb-bg);
}

/* ==========================================================================
   Slider
   ========================================================================== */
.kdbuch-slider {
	position: relative;
	overflow: hidden;
	border-radius: var(--kdb-radius);
	margin-bottom: 2rem;
	background: #111;
	max-height: 420px;
}

.kdbuch-slider-track {
	display: flex;
	transition: transform 0.5s ease;
	will-change: transform;
}

.kdbuch-slide {
	min-width: 100%;
	position: relative;
}

.kdbuch-slide img,
.kdbuch-slider-img {
	width: 100%;
	height: 420px;
	object-fit: cover;
	display: block;
}

.kdbuch-slide-video video,
.kdbuch-slide-video iframe {
	width: 100%;
	height: 420px;
	display: block;
}

/* Slider Buttons */
.kdbuch-slider-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255,255,255,0.85);
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}
.kdbuch-slider-btn:hover { background: #ffffff; }
.kdbuch-slider-prev { left: 12px; }
.kdbuch-slider-next { right: 12px; }

/* Slider Dots */
.kdbuch-slider-dots {
	position: absolute;
	bottom: 10px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 6px;
}
.kdbuch-slider-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: none;
	background: rgba(255,255,255,0.5);
	cursor: pointer;
	padding: 0;
	transition: background 0.2s;
}
.kdbuch-slider-dot.active { background: #ffffff; }

/* ==========================================================================
   Intro Text
   ========================================================================== */
.kdbuch-intro {
	padding: 1.5rem;
	background: var(--kdb-bg-card);
	border-left: 4px solid var(--kdb-accent);
	border-radius: var(--kdb-radius);
	margin-bottom: 2rem;
	font-size: 1rem;
	line-height: 1.7;
	color: var(--kdb-text);
	box-shadow: var(--kdb-shadow);
}

/* ==========================================================================
   Entries
   ========================================================================== */
.kdbuch-entries {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.kdbuch-no-entries {
	text-align: center;
	color: var(--kdb-text-muted);
	font-style: italic;
	padding: 2rem 0;
}

.kdbuch-entry {
	display: flex;
	gap: 1rem;
	background: var(--kdb-bg-card);
	border-radius: var(--kdb-radius);
	border-left: 4px solid var(--kdb-accent);
	padding: 1.25rem 1.5rem;
	box-shadow: var(--kdb-shadow);
	transition: box-shadow 0.2s;
}
.kdbuch-entry:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }

.kdbuch-entry-icon {
	font-size: 1.8rem;
	line-height: 1;
	flex-shrink: 0;
	margin-top: 2px;
}

.kdbuch-entry-body { flex: 1; min-width: 0; }

.kdbuch-entry-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.kdbuch-entry-name {
	font-weight: 600;
	color: var(--kdb-primary);
	font-size: 1rem;
}

.kdbuch-entry-date {
	color: var(--kdb-text-muted);
	font-size: 0.85rem;
}

.kdbuch-entry-message {
	font-size: 0.97rem;
	line-height: 1.6;
	color: var(--kdb-text);
}
.kdbuch-entry-message p { margin: 0 0 0.5rem; }
.kdbuch-entry-message p:last-child { margin-bottom: 0; }

/* ==========================================================================
   Pagination
   ========================================================================== */
.kdbuch-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
	margin: 1rem 0 2rem;
}

.kdbuch-page-btn {
	min-width: 36px;
	height: 36px;
	border: 1px solid var(--kdb-border);
	background: var(--kdb-bg-card);
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.9rem;
	color: var(--kdb-primary);
	transition: background 0.2s, border-color 0.2s;
	padding: 0 10px;
}
.kdbuch-page-btn:hover  { background: var(--kdb-accent); color: #fff; border-color: var(--kdb-accent); }
.kdbuch-page-btn.active { background: var(--kdb-primary); color: #fff; border-color: var(--kdb-primary); font-weight: 600; cursor: default; }

/* ==========================================================================
   Form
   ========================================================================== */
.kdbuch-form-wrap {
	background: var(--kdb-bg-card);
	border-radius: var(--kdb-radius);
	padding: 1.75rem;
	box-shadow: var(--kdb-shadow);
	margin-top: 2rem;
}

.kdbuch-form-title {
	margin: 0 0 1.25rem;
	font-size: 1.2rem;
	color: var(--kdb-primary);
	border-bottom: 1px solid var(--kdb-border);
	padding-bottom: 0.75rem;
}

.kdbuch-field {
	margin-bottom: 1.1rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.kdbuch-field label {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--kdb-text);
}

.kdbuch-field-hint {
	font-weight: 400;
	color: var(--kdb-text-muted);
	font-size: 0.82rem;
}

.kdbuch-field input[type="text"],
.kdbuch-field input[type="email"],
.kdbuch-field textarea {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid var(--kdb-border);
	border-radius: 4px;
	padding: 0.6rem 0.8rem;
	font-size: 1rem;
	font-family: inherit;
	color: var(--kdb-text);
	background: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
}
.kdbuch-field input:focus,
.kdbuch-field textarea:focus {
	outline: none;
	border-color: var(--kdb-primary);
	box-shadow: 0 0 0 3px rgba(107, 91, 78, 0.12);
}

.kdbuch-field textarea { resize: vertical; min-height: 120px; }

.kdbuch-char-count {
	font-size: 0.78rem;
	color: var(--kdb-text-muted);
	text-align: right;
}

/* Icons */
.kdbuch-icons-label {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--kdb-text);
	display: block;
	margin-bottom: 0.35rem;
}

.kdbuch-icons {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.kdbuch-icon-option {
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.kdbuch-icon-option input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.kdbuch-icon-emoji {
	font-size: 1.8rem;
	padding: 6px 10px;
	border-radius: 8px;
	border: 2px solid transparent;
	transition: border-color 0.15s, background 0.15s;
	display: block;
}

.kdbuch-icon-option input[type="radio"]:checked + .kdbuch-icon-emoji,
.kdbuch-icon-option:hover .kdbuch-icon-emoji {
	border-color: var(--kdb-primary);
	background: rgba(107, 91, 78, 0.08);
}

/* Submit */
.kdbuch-submit-wrap {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-top: 1.25rem;
}

.kdbuch-btn {
	background: var(--kdb-primary);
	color: #fff;
	border: none;
	border-radius: 4px;
	padding: 0.65rem 1.5rem;
	font-size: 1rem;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.2s;
}
.kdbuch-btn:hover:not(:disabled) { background: var(--kdb-primary-light); }
.kdbuch-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Spinner
   WICHTIG: display: inline-block NICHT direkt hier setzen!
   Das würde das HTML [hidden]-Attribut überschreiben und den Spinner
   immer sichtbar machen. Stattdessen: :not([hidden]) Selektor nutzen. */
.kdbuch-spinner {
	width: 20px;
	height: 20px;
	border: 2px solid var(--kdb-accent);
	border-top-color: var(--kdb-primary);
	border-radius: 50%;
	animation: kdb-spin 0.7s linear infinite;
}
.kdbuch-spinner:not([hidden]) {
	display: inline-block;
}
@keyframes kdb-spin { to { transform: rotate(360deg); } }

/* Response message */
.kdbuch-form-response {
	margin-top: 0.75rem;
	padding: 0.6rem 1rem;
	border-radius: 4px;
	font-size: 0.95rem;
	display: none;
}
.kdbuch-form-response.kdbuch-success {
	display: block;
	background: #f0fdf4;
	color: var(--kdb-success);
	border: 1px solid #bbf7d0;
}
.kdbuch-form-response.kdbuch-error {
	display: block;
	background: #fef2f2;
	color: var(--kdb-error);
	border: 1px solid #fecaca;
}

/* ==========================================================================
   Password Gate
   ========================================================================== */
.kdbuch-password-gate {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 300px;
	padding: 2rem 16px;
}

.kdbuch-password-box {
	background: var(--kdb-bg-card);
	border-radius: var(--kdb-radius);
	padding: 2.5rem 2rem;
	text-align: center;
	max-width: 420px;
	width: 100%;
	box-shadow: var(--kdb-shadow);
}

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

.kdbuch-password-title {
	margin: 0 0 0.5rem;
	font-size: 1.3rem;
	color: var(--kdb-primary);
}

.kdbuch-password-desc {
	color: var(--kdb-text-muted);
	margin-bottom: 1.5rem;
	font-size: 0.95rem;
}

.kdbuch-password-error {
	background: #fef2f2;
	color: var(--kdb-error);
	border: 1px solid #fecaca;
	border-radius: 4px;
	padding: 0.5rem 0.75rem;
	margin-bottom: 1rem;
	font-size: 0.9rem;
}

.kdbuch-password-form .kdbuch-field { text-align: left; }
.kdbuch-password-form .kdbuch-btn   { width: 100%; margin-top: 0.5rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
	.kdbuch-slide img,
	.kdbuch-slider-img,
	.kdbuch-slide-video video,
	.kdbuch-slide-video iframe { height: 260px; }
	.kdbuch-slider { max-height: 260px; }

	.kdbuch-entry { padding: 1rem; }

	.kdbuch-form-wrap { padding: 1.25rem 1rem; }
}

@media (max-width: 480px) {
	.kdbuch-slide img,
	.kdbuch-slider-img,
	.kdbuch-slide-video video,
	.kdbuch-slide-video iframe { height: 200px; }
	.kdbuch-slider { max-height: 200px; }

	.kdbuch-slider-btn { width: 32px; height: 32px; font-size: 1.1rem; }

	.kdbuch-entry { flex-direction: column; gap: 0.5rem; }
	.kdbuch-entry-icon { font-size: 1.4rem; }
}
