/* =========================================================
   Katzrin Events — Card Grid
   RTL-aware, scoped to .katzrin-events-grid
   ========================================================= */

/* 1. Custom Properties
   --------------------------------------------------------- */
.katzrin-events-grid {
	--ke-primary:       #1a5276;
	--ke-bg:            #ffffff;
	--ke-border:        #e8e8e8;
	--ke-text:          #2c3e50;
	--ke-text-muted:    #7f8c8d;
	--ke-btn-bg:        #1a5276;
	--ke-btn-color:     #ffffff;
	--ke-unavail-bg:    #95a5a6;
	--ke-radius-card:   12px;
	--ke-radius-btn:    6px;
	--ke-shadow:        0 2px 8px rgba(0, 0, 0, 0.08);
	--ke-shadow-hover:  0 8px 24px rgba(0, 0, 0, 0.15);
	--ke-transition:    0.22s ease;
}

/* 2. Category Filter Bar
   --------------------------------------------------------- */
.ke-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 24px;
	direction: rtl;
}

.ke-filter__btn {
	background: #f0f4f8;
	border: 1.5px solid #d5dde8;
	border-radius: 20px;
	color: #4a6077;
	cursor: pointer;
	font-family: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1;
	padding: 7px 16px;
	transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.ke-filter__btn:hover {
	background: #dbe6f0;
	border-color: #b0c4d8;
	color: #1a5276;
}

.ke-filter__btn--active {
	background: #1a5276;
	border-color: #1a5276;
	color: #fff;
}

/* 3. Grid Layout
   --------------------------------------------------------- */
.katzrin-events-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* 4. Responsive Breakpoints
   --------------------------------------------------------- */
@media (max-width: 900px) {
	.katzrin-events-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 560px) {
	.katzrin-events-grid {
		grid-template-columns: 1fr;
		gap: 16px;
	}
}

/* 5. Card Base
   --------------------------------------------------------- */
.ke-card {
	background: var(--ke-bg);
	border: 1px solid var(--ke-border);
	border-radius: var(--ke-radius-card);
	box-shadow: var(--ke-shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: transform var(--ke-transition), box-shadow var(--ke-transition);
}

.ke-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--ke-shadow-hover);
}

/* 6. Full-Card Anchor
   --------------------------------------------------------- */
.ke-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	text-decoration: none;
	color: inherit;
}

/* 7. Image Wrap — padding-top 16:9 trick (works in all Elementor contexts)
   --------------------------------------------------------- */
.ke-card__image-wrap {
	position: relative;
	overflow: hidden;
	width: 100%;
	padding-top: 56.25%; /* 9/16 = 56.25% — locks 16:9 ratio */
	background: #f0f2f5;
	flex-shrink: 0;
}

.ke-card__image,
.ke-card__image--placeholder {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ke-card__image {
	transition: transform var(--ke-transition);
}

.ke-card:hover .ke-card__image {
	transform: scale(1.04);
}

/* 8. Placeholder
   --------------------------------------------------------- */
.ke-card__image--placeholder {
	background: linear-gradient(135deg, #dce5ef 0%, #b9cad9 100%);
}

/* 9. Category Badge (top-left of image)
   --------------------------------------------------------- */
.ke-card__category {
	position: absolute;
	top: 10px;
	left: 10px;
	background: rgba(255, 255, 255, 0.92);
	color: var(--ke-primary, #1a5276);
	font-size: 0.72rem;
	font-weight: 700;
	padding: 3px 9px;
	border-radius: 20px;
	line-height: 1.5;
	white-space: nowrap;
	letter-spacing: 0.02em;
}

/* 10. Date Badge (bottom-right of image)
   --------------------------------------------------------- */
.ke-card__date-badge {
	position: absolute;
	bottom: 10px;
	right: 10px;
	background: rgba(26, 82, 118, 0.88);
	color: #fff;
	font-size: 0.78rem;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 4px;
	line-height: 1.5;
	white-space: nowrap;
}

.ke-card__time {
	opacity: 0.85;
}

/* 11. Card Body
   --------------------------------------------------------- */
.ke-card__body {
	padding: 16px 16px 8px;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ke-card__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--ke-text);
}

.ke-card__meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 12px;
}

.ke-card__venue {
	margin: 0;
	font-size: 0.8rem;
	color: var(--ke-text-muted);
	font-weight: 500;
}

.ke-card__duration {
	font-size: 0.78rem;
	color: var(--ke-text-muted);
}

/* 12. Brief — 2-line clamp
   --------------------------------------------------------- */
.ke-card__brief {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 0.875rem;
	color: var(--ke-text);
	line-height: 1.55;
	margin-top: 2px;
}

.ke-card__brief p {
	margin: 0;
}

.ke-card__brief * {
	font-size: inherit !important;
	color: inherit !important;
}

/* 13. Card Footer + CTA Button
   --------------------------------------------------------- */
.ke-card__footer {
	padding: 10px 16px 16px;
}

.ke-card__footer-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 10px;
	min-height: 20px;
}

.ke-card__price {
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--ke-primary, #1a5276);
}

.ke-card__tickets-left {
	font-size: 0.75rem;
	font-weight: 600;
	color: #c0392b;
	background: #fdecea;
	padding: 2px 8px;
	border-radius: 10px;
}

.ke-card__btn {
	display: block;
	text-align: center;
	padding: 10px 16px;
	border-radius: var(--ke-radius-btn);
	font-size: 0.9rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	transition: opacity var(--ke-transition);
}

/* 14. Button State Variants
   --------------------------------------------------------- */
.ke-card__btn--available {
	background: var(--ke-btn-bg);
	color: var(--ke-btn-color) !important;
}

.ke-card__btn--available:hover {
	opacity: 0.86;
	color: var(--ke-btn-color) !important;
}

.ke-card__btn--unavailable {
	background: var(--ke-unavail-bg);
	color: #fff;
	pointer-events: none;
	cursor: default;
}

/* 15. Card — cursor pointer (now triggers modal, not navigation)
   --------------------------------------------------------- */
.ke-card {
	cursor: pointer;
}

/* 16. Modal Overlay
   --------------------------------------------------------- */
.ke-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.72);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	animation: ke-fade-in 0.2s ease;
	direction: rtl;
}

.ke-modal-overlay[hidden] {
	display: none;
}

@keyframes ke-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

body.ke-modal-open {
	overflow: hidden;
}

.ke-modal__container {
	background: #fff;
	border-radius: 14px;
	width: 100%;
	max-width: 860px;
	height: 78vh;
	max-height: 620px;
	overflow: hidden;
	position: relative;
	display: flex;
	flex-direction: row;
	animation: ke-slide-up 0.22s ease;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
}

@keyframes ke-slide-up {
	from { transform: translateY(24px); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

/* 17. Modal Close Button
   --------------------------------------------------------- */
.ke-modal__close {
	position: absolute;
	top: 14px;
	left: 14px;
	background: rgba(0, 0, 0, 0.45);
	border: none;
	color: #fff;
	font-size: 1.1rem;
	line-height: 1;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	cursor: pointer;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

.ke-modal__close:hover {
	background: rgba(0, 0, 0, 0.65);
}

/* 18. Modal Image — left column, full height
   --------------------------------------------------------- */
.ke-modal__image-wrap {
	width: 42%;
	flex-shrink: 0;
	background: #e8edf2;
	overflow: hidden;
	border-radius: 14px 0 0 14px;
}

.ke-modal__image {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	background: #f0f4f8;
}

.ke-modal__image--placeholder {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #dce5ef 0%, #b9cad9 100%);
}

/* 19. Modal Body — right column, scrollable
   --------------------------------------------------------- */
.ke-modal__body {
	flex: 1;
	min-width: 0;
	min-height: 0;
	overflow-y: auto;
	padding: 28px 24px 24px;
	display: flex;
	flex-direction: column;
}

.ke-modal__header {
	margin-bottom: 12px;
}

.ke-modal__category {
	display: inline-block;
	background: #eaf2fb;
	color: #1a5276;
	font-size: 0.75rem;
	font-weight: 700;
	padding: 3px 10px;
	border-radius: 20px;
	margin-bottom: 8px;
	letter-spacing: 0.02em;
}

.ke-modal__title {
	margin: 0 !important;
	font-size: 3rem !important;
	font-weight: 700 !important;
	line-height: 1.35 !important;
	color: #1c2b3a !important;
}

.ke-modal__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	margin-bottom: 18px;
	font-size: 0.85rem;
	color: #5d7083;
}

.ke-modal__date::before    { content: "📅 "; }
.ke-modal__venue::before   { content: "📍 "; }
.ke-modal__duration::before { content: "⏱ "; }

/* 20. Modal Content (rich text) — fills remaining space
   --------------------------------------------------------- */
.ke-modal__content {
	flex: 1;
	min-height: 0;
	font-size: 0.95rem;
	line-height: 1.7;
	color: #2c3e50;
	margin-bottom: 20px;
	overflow-wrap: break-word;
	word-break: break-word;
}

.ke-modal__content p            { margin: 0 0 12px; }
.ke-modal__content p:last-child { margin-bottom: 0; }
.ke-modal__content img          { max-width: 100%; height: auto; border-radius: 6px; }
.ke-modal__content a            { color: #1a5276; text-decoration: underline; word-break: break-all; }

/* 21. Modal Footer
   --------------------------------------------------------- */
.ke-modal__footer {
	border-top: 1px solid #e8edf2;
	padding-top: 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
}

.ke-modal__footer-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ke-modal__price {
	font-size: 1rem;
	font-weight: 700;
	color: #1a5276;
}

.ke-modal__tickets-left {
	font-size: 0.8rem;
	font-weight: 600;
	color: #c0392b;
	background: #fdecea;
	padding: 2px 10px;
	border-radius: 10px;
	width: fit-content;
}

.ke-modal__btn {
	display: inline-block;
	background: #1a5276;
	color: #fff !important;
	text-decoration: none;
	padding: 12px 28px;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 700;
	transition: opacity 0.18s ease;
}

.ke-modal__btn:hover {
	opacity: 0.86;
	color: #fff !important;
}

/* 22. Modal Responsive — stack vertically on mobile
   --------------------------------------------------------- */
@media (max-width: 620px) {
	.ke-modal__container {
		flex-direction: column;
		height: 92vh;
		max-height: 92vh;
		border-radius: 12px;
	}
	.ke-modal__image-wrap {
		width: 100%;
		height: 200px;
		flex-shrink: 0;
		border-radius: 12px 12px 0 0;
	}
	.ke-modal__body    { padding: 18px 16px 20px; }
	.ke-modal__title   { font-size: 1.15rem; }
	.ke-modal__footer  { flex-direction: column; align-items: stretch; }
	.ke-modal__btn     { text-align: center; }
}

/* 23. Empty / Error States
   --------------------------------------------------------- */
.katzrin-events-empty,
.katzrin-events-error {
	padding: 28px 20px;
	border-radius: 8px;
	text-align: center;
	color: var(--ke-text, #2c3e50);
	font-size: 1rem;
	line-height: 1.6;
}

.katzrin-events-empty {
	background: #fef9e7;
	border: 1px solid #f7dc6f;
}

.katzrin-events-error {
	background: #fdecea;
	border: 1px solid #f5c6cb;
}
