/**
 * KT Digital Book - Professional Block Styling
 * دیزاینی پروفێشنەل: 2/3 کاور + 1/3 متادیتا
 */

:root {
	--ktdb-primary: #2563eb;
	--ktdb-secondary: #10b981;
	--ktdb-accent: #f59e0b;
	--ktdb-dark: #1f2937;
	--ktdb-light: #f9fafb;
	--ktdb-text-secondary: #6b7280;
	--ktdb-border: #e5e7eb;
	--ktdb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--ktdb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
	--ktdb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
	--ktdb-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
	--ktdb-radius: 12px;
	--ktdb-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================
   DARK MODE
   ===================== */

@media (prefers-color-scheme: dark) {
	:root {
		--ktdb-dark: #f9fafb;
		--ktdb-light: #1f2937;
		--ktdb-text-secondary: #d1d5db;
		--ktdb-border: #374151;
	}
}

/* =====================
   MAIN BOOK DISPLAY
   ===================== */

.ktdb-book-display {
	background: var(--ktdb-light);
	border-radius: var(--ktdb-radius);
	overflow: hidden;
	box-shadow: var(--ktdb-shadow-lg);
	transition: var(--ktdb-transition);
	margin: 20px 0;
}

.ktdb-book-display:hover {
	box-shadow: var(--ktdb-shadow-xl);
}

/* =====================
   MAIN LAYOUT: 2/3 + 1/3
   ===================== */

.ktdb-book-main {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 0;
	padding: 0;
	min-height: 350px;
}

/* کاور (2/3) */
.ktdb-book-cover-section {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	position: relative;
}

.ktdb-cover-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: var(--ktdb-transition);
}

.ktdb-book-display:hover .ktdb-cover-image {
	transform: scale(1.05);
}

.ktdb-cover-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
	text-align: center;
	font-size: 48px;
	gap: 10px;
}

.ktdb-cover-placeholder p {
	margin: 0;
	font-size: 14px;
	opacity: 0.8;
}

/* محتوا (1/3) */
.ktdb-book-content-section {
	padding: 30px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	background: var(--ktdb-light);
	overflow-y: auto;
}

/* =====================
   عنوان
   ===================== */

.ktdb-book-header {
	border-bottom: 2px solid var(--ktdb-border);
	padding-bottom: 15px;
}

.ktdb-book-title {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	color: var(--ktdb-dark);
	line-height: 1.3;
	word-break: break-word;
}

/* =====================
   متادیتا - بدون خط
   ===================== */

.ktdb-book-metadata {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ktdb-meta-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	background: var(--ktdb-light);
	border-radius: 8px;
	transition: var(--ktdb-transition);
	box-shadow: var(--ktdb-shadow-sm);
	border-left: 3px solid var(--ktdb-primary);
}

[dir="rtl"] .ktdb-meta-row {
	border-left: none;
	border-right: 3px solid var(--ktdb-primary);
}

/* سایە بین فیلدها */
.ktdb-meta-row:not(:last-child) {
	margin-bottom: 2px;
	box-shadow: 
		var(--ktdb-shadow-sm),
		inset 0 -2px 4px rgba(0, 0, 0, 0.02);
}

.ktdb-meta-row:hover {
	background: #f3f4f6;
	box-shadow: var(--ktdb-shadow-md);
	transform: translateX(2px);
	border-left-color: var(--ktdb-secondary);
}

[dir="rtl"] .ktdb-meta-row:hover {
	transform: translateX(-2px);
	border-right-color: var(--ktdb-secondary);
}

/* آیکون */
.ktdb-meta-icon {
	font-size: 18px;
	flex-shrink: 0;
	opacity: 0.9;
}

/* لیبل */
.ktdb-meta-label {
	font-weight: 600;
	color: var(--ktdb-primary);
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	min-width: fit-content;
	flex-shrink: 0;
}

/* مقدار */
.ktdb-meta-value {
	color: var(--ktdb-dark);
	font-size: 13px;
	font-weight: 500;
	flex: 1;
	word-break: break-word;
}

/* =====================
   دکمە‌های داونلۆد
   ===================== */

.ktdb-book-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	padding-top: 15px;
	border-top: 2px solid var(--ktdb-border);
}

.ktdb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 16px;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	transition: var(--ktdb-transition);
	text-decoration: none;
	white-space: nowrap;
	text-align: center;
}

/* PDF Button */
.ktdb-btn-pdf {
	background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
	color: white;
	box-shadow: var(--ktdb-shadow-md);
}

.ktdb-btn-pdf:hover {
	background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
	box-shadow: var(--ktdb-shadow-lg);
	transform: translateY(-2px);
}

.ktdb-btn-pdf:active {
	transform: translateY(0);
}

/* Audio Button */
.ktdb-btn-audio {
	background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
	color: white;
	box-shadow: var(--ktdb-shadow-md);
}

.ktdb-btn-audio:hover {
	background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
	box-shadow: var(--ktdb-shadow-lg);
	transform: translateY(-2px);
}

.ktdb-btn-audio:active {
	transform: translateY(0);
}

.ktdb-btn-icon {
	font-size: 16px;
}

.ktdb-btn-text {
	display: inline;
}

/* =====================
   سپاس / تێب००نی
   ===================== */

.ktdb-book-thanks {
	background: linear-gradient(135deg, #fef3c7 0%, #fce8b2 100%);
	border-left: 4px solid #fbbf24;
	border-radius: 6px;
	padding: 14px 16px;
	font-size: 12px;
	color: #78350f;
	line-height: 1.5;
	margin-top: 15px;
	box-shadow: var(--ktdb-shadow-sm);
}

[dir="rtl"] .ktdb-book-thanks {
	border-left: none;
	border-right: 4px solid #fbbf24;
	text-align: right;
}

.ktdb-book-thanks p {
	margin: 0;
}

/* =====================
   RESPONSIVE MOBILE
   ===================== */

@media (max-width: 768px) {
	.ktdb-book-main {
		grid-template-columns: 1fr;
		min-height: auto;
	}

	.ktdb-book-cover-section {
		min-height: 250px;
		order: -1;
	}

	.ktdb-book-content-section {
		padding: 20px;
	}

	.ktdb-book-title {
		font-size: 18px;
	}

	.ktdb-meta-row {
		padding: 10px 12px;
	}

	.ktdb-meta-label {
		font-size: 10px;
	}

	.ktdb-meta-value {
		font-size: 12px;
	}

	.ktdb-book-actions {
		grid-template-columns: 1fr;
	}

	.ktdb-btn {
		padding: 11px 14px;
		font-size: 12px;
	}
}

/* =====================
   DARK MODE
   ===================== */

@media (prefers-color-scheme: dark) {
	.ktdb-book-display {
		background: #1f2937;
	}

	.ktdb-book-content-section {
		background: #1f2937;
	}

	.ktdb-book-title {
		color: #f9fafb;
	}

	.ktdb-meta-row {
		background: #374151;
		box-shadow: 
			var(--ktdb-shadow-sm),
			inset 0 -2px 4px rgba(0, 0, 0, 0.3);
	}

	.ktdb-meta-row:hover {
		background: #4b5563;
	}

	.ktdb-meta-value {
		color: #f3f4f6;
	}

	.ktdb-book-header,
	.ktdb-book-actions {
		border-top-color: #4b5563;
		border-bottom-color: #4b5563;
	}

	.ktdb-book-thanks {
		background: linear-gradient(135deg, #78350f 0%, #6b2d0c 100%);
		color: #fef3c7;
		border-left-color: #fbbf24;
	}

	[dir="rtl"] .ktdb-book-thanks {
		border-right-color: #fbbf24;
	}
}

/* =====================
   RTL SUPPORT (کوردی)
   ===================== */

[dir="rtl"] .ktdb-book-main {
	grid-template-columns: 1fr 2fr;
	direction: rtl;
}

[dir="rtl"] .ktdb-book-content-section {
	text-align: right;
}

[dir="rtl"] .ktdb-meta-row {
	flex-direction: row-reverse;
}

[dir="rtl"] .ktdb-btn {
	flex-direction: row-reverse;
}

/* =====================
   ACCESSIBILITY
   ===================== */

.ktdb-btn:focus-visible {
	outline: 2px solid var(--ktdb-primary);
	outline-offset: 2px;
}

.ktdb-meta-row:focus-visible {
	outline: 2px solid var(--ktdb-primary);
	outline-offset: 1px;
}

/* =====================
   PRINT STYLE
   ===================== */

@media print {
	.ktdb-book-display {
		box-shadow: none;
		border: 1px solid #ccc;
	}

	.ktdb-book-main {
		grid-template-columns: 1fr;
	}

	.ktdb-btn,
	.ktdb-book-actions {
		display: none;
	}
}
