:root {
	--primary-color: #4A90E2;
	--secondary-color: #7B68EE;
	--background-color: #F8F9FA;
	--text-color: #2C3E50;
	--border-color: #E1E5E9;
	--feast-color: #E74C3C;
}

/* Blockquote Formatting */
blockquote {
	background-color: #f5f5f5;
	border-left: 4px solid #ccc;
	padding: 10px 20px;
	margin: 15px 0;
	font-style: italic;
	color: #555;
}

/* Bible Verse Formatting - Using div instead of blockquote for better RTE compatibility */
div.bible-verse, .bible-verse, pre.bible-verse {
	background-color: rgba(74, 144, 226, 0.08) !important;
	border-left: 4px solid #4A90E2 !important;
	padding: 15px 20px !important;
	margin: 15px 0 !important;
	font-family: 'Georgia', serif !important;
	font-style: italic !important;
	line-height: 1.8;
	color: #333 !important;
	white-space: pre-wrap;
	word-wrap: break-word;
}

/* Also handle blockquote.bible-verse for backwards compatibility */
blockquote.bible-verse {
	background-color: rgba(74, 144, 226, 0.08) !important;
	border-left: 4px solid #4A90E2 !important;
}

body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	background-color: var(--background-color);
	color: var(--text-color);
	margin: 0;
	padding: 0;
	touch-action: manipulation;
	/* Prevent pull-to-refresh globally */
	overscroll-behavior-y: contain;
}

.calendar-container {
	max-width: 100%;
	margin: 0 auto;
	padding: 1rem;
}

/* Embed Mode Styling - Clean, minimal appearance for iframes */
.calendar-container.embed-mode {
	padding: 0.5rem;
	max-width: 100%;
}

.calendar-container.embed-mode .calendar-header {
	padding: 0.5rem 0;
	margin-bottom: 0.5rem;
}

.calendar-container.embed-mode .calendar-title {
	font-size: 1.2rem;
}

.calendar-container.embed-mode .calendar-subtitle {
	font-size: 0.85rem;
	margin-top: 0.25rem;
}

.calendar-container.embed-mode .calendar-grid {
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Embed Error Styling */
.embed-error-container {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 400px;
	padding: 2rem;
	background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.embed-error-content {
	text-align: center;
	background: white;
	padding: 3rem 2rem;
	border-radius: 12px;
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	max-width: 500px;
}

.embed-error-icon {
	font-size: 4rem;
	margin-bottom: 1rem;
	opacity: 0.5;
}

.embed-error-title {
	color: #e74c3c;
	font-size: 1.5rem;
	font-weight: bold;
	margin-bottom: 1rem;
}

.embed-error-message {
	color: #2c3e50;
	font-size: 1rem;
	line-height: 1.6;
	margin-bottom: 1rem;
}

.embed-error-help {
	color: #7f8c8d;
	font-size: 0.9rem;
	font-style: italic;
}

.calendar-header {
	text-align: center;
	margin-bottom: 1rem;
	padding: 1rem 0;
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
	color: white;
	border-radius: 10px;
	box-shadow: 0 4px 8px rgba(0,0,0,0.1);
	position: relative;
}

.calendar-view-switch {
	position: absolute;
	top: 1rem;
	right: 1rem;
	display: flex;
	background-color: rgba(255, 255, 255, 0.2);
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-radius: 25px;
	overflow: hidden;
	padding: 2px;
}

.switch-option {
	background-color: transparent;
	color: rgba(255, 255, 255, 0.7);
	border: none;
	padding: 0.4rem 1rem;
	font-size: 0.85rem;
	font-weight: bold;
	cursor: pointer;
	transition: all 0.3s;
	border-radius: 20px;
	min-width: 80px;
}

.switch-option:hover {
	color: white;
	background-color: rgba(255, 255, 255, 0.1);
}

.switch-option.active {
	background-color: white;
	color: var(--primary-color);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-option:focus {
	outline: none;
}

.switch-option:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.5);
	outline-offset: 2px;
}

/* Prevent autofocus outline on page load */
.calendar-title:focus,
.calendar-subtitle:focus {
	outline: none;
}

button:focus:not(:focus-visible) {
	outline: none;
}

.calendar-title {
	font-size: 1.5rem;
	font-weight: bold;
	margin: 0;
}

.calendar-subtitle {
	font-size: 0.9rem;
	opacity: 0.9;
	margin: 0.5rem 0 0 0;
}

.calendar-subtitle-full {
	display: block;
}

.calendar-subtitle-short {
	display: none;
}

/* Calendar Legend */
.calendar-legend-container {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 10;
}

.legend-toggle {
	background: rgba(255, 255, 255, 0.9);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 50%;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 16px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-toggle:hover {
	background: rgba(255, 255, 255, 1);
	transform: scale(1.05);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.legend-icon {
	line-height: 1;
}

.calendar-legend {
	display: none; /* Hidden by default */
	position: absolute;
	top: 45px;
	left: 0;
	background: rgba(255, 255, 255, 0.95);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	padding: 0.75rem;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	min-width: 200px;
	z-index: 20;
}

.calendar-legend.visible {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.legend-item {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.8rem;
	color: rgba(0, 0, 0, 0.8);
	font-weight: 500;
}

.legend-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	display: inline-block;
	flex-shrink: 0;
}

.legend-dot.sabbath-dot {
	background-color: #E74C3C; /* Red - Sabbath */
}

.legend-dot.feast-dot {
	background-color: #3498DB; /* Blue - Feast Day */
}

.legend-dot.note-dot {
	background-color: #888; /* Grey - Interesting Note */
}

.legend-text {
	white-space: nowrap;
}

/* Mobile responsive legend */
@media (max-width: 767px) {
	.calendar-legend-container {
		display: none; /* Hide toggle on mobile */
	}
	
	.calendar-legend {
		display: none; /* Hide legend on mobile */
	}
}

.calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 2px;
	background-color: var(--border-color);
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	width: 100%;
	box-sizing: border-box;
}

.day-header {
	background-color: var(--primary-color);
	color: white;
	padding: 0.5rem;
	text-align: center;
	font-weight: bold;
	font-size: 0.8rem;
}

.calendar-day {
	background-color: white;
	min-height: 80px;
	position: relative;
	padding: 4px;
	cursor: pointer;
	transition: background-color 0.2s;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	box-sizing: border-box;
	overflow: hidden;
	word-wrap: break-word;
}

	.calendar-day:hover {
		background-color: #F0F8FF;
	}

	.calendar-day.today {
		background-color: #E8F5E8;
		border: 2px solid var(--primary-color);
	}

	.calendar-day.other-month {
		background-color: #F5F5F5;
		opacity: 0.6;
	}

.day-number {
	font-size: 1.2rem;
	font-weight: bold;
	color: var(--text-color);
}

/* Sabbath day background - Regular weekly Sabbath (Day 7 / Saturday) */
.calendar-day.sabbath {
	background-color: rgba(230, 80, 60, 0.15) !important;
}

.feast-icon {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
}

.feast-icon.high-sabbath {
	background-color: var(--feast-color);
}

.feast-icon.feast-day {
	background-color: #3498DB;
}

.feast-icon.regular-feast {
	background-color: #888;
}

.feast-name {
	font-size: 0.7rem;
	font-weight: bold;
	text-align: center;
	margin: 2px 0;
}

.feast-name.high-sabbath-text {
	color: var(--feast-color);
}

.feast-name.feast-day-text {
	color: #3498DB;
}

.feast-name.regular-feast-text {
	color: #666;
}

.gregorian-date {
	font-size: 0.6rem;
	color: #7F8C8D;
	margin-top: auto;
}

.zadok-date {
	font-size: 0.6rem;
	color: #7F8C8D;
	margin-top: auto;
}

/* Show full date by default, hide short date */
.gregorian-date-full, .zadok-date-full {
	display: block;
}

.gregorian-date-short, .zadok-date-short {
	display: none;
}

/* On mobile portrait only, show short date and hide full date, hide feast names */
@media (max-width: 767px) and (orientation: portrait) {
	.gregorian-date-full, .zadok-date-full {
		display: none !important;
	}
	
	.gregorian-date-short, .zadok-date-short {
		display: block !important;
	}
	
	.feast-name {
		display: none !important;
	}
}

.navigation {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 1rem;
	padding: 1rem;
	background-color: white;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-button {
	background-color: var(--primary-color);
	color: white;
	border: none;
	padding: 0.5rem 1rem;
	border-radius: 5px;
	cursor: pointer;
	font-size: 0.9rem;
	transition: background-color 0.2s;
	white-space: nowrap;
}

	.nav-button:hover {
		background-color: var(--secondary-color);
	}

	.nav-button:disabled {
		background-color: #BDC3C7;
		cursor: not-allowed;
	}

/* Show full text by default, hide compact */
.nav-button-compact {
	display: none;
}

.nav-button-full {
	display: inline;
}

.date-picker {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.date-input {
	border: 1px solid var(--border-color);
	border-radius: 4px;
	padding: 0.3rem 0.5rem;
	font-size: 0.8rem;
}

.picker-toggle {
	background-color: var(--secondary-color);
	color: white;
	border: none;
	padding: 0.3rem 0.6rem;
	border-radius: 4px;
	font-size: 0.7rem;
	cursor: pointer;
}

@media (max-width: 768px) {
	.calendar-container {
		padding: 0.25rem;
	}

	.calendar-grid {
		gap: 1px;
	}

	.day-header {
		padding: 0.3rem 0.1rem;
		font-size: 0.65rem;
		word-break: break-word;
	}

	.calendar-day {
		min-height: 50px;
		padding: 2px;
		font-size: 0.7rem;
	}

	.day-number {
		font-size: 0.9rem;
	}

	.feast-name {
		font-size: 0.55rem;
	}

	.gregorian-date {
		font-size: 0.5rem;
	}

	.feast-icon {
		width: 6px;
		height: 6px;
	}

	.calendar-header {
		padding: 0.75rem;
		padding-right: 4rem;
	}

	.calendar-view-switch {
		top: 0.5rem;
		right: 0.5rem;
		flex-direction: column;
		gap: 2px;
	}

	.switch-option {
		padding: 0.3rem 0.6rem;
		font-size: 0.7rem;
		min-width: 60px;
	}

	.calendar-title {
		font-size: 1.2rem;
	}

	.calendar-subtitle {
		font-size: 0.75rem;
	}

	.calendar-subtitle-full {
		display: none;
	}

	.calendar-subtitle-short {
		display: block;
	}

	.navigation {
		/* Keep inline layout */
		gap: 0.5rem;
	}

	.date-picker {
		flex: 1;
		justify-content: center;
	}

	.nav-button {
		font-size: 1.2rem;
		padding: 0.4rem 0.6rem;
		min-width: 40px;
	}

	/* Hide full text, show compact arrows only on small screens in portrait */
	.nav-button-full {
		display: none;
	}

	.nav-button-compact {
		display: inline;
	}
}

/* Show full text in landscape mode even on mobile */
@media (max-width: 768px) and (orientation: landscape) {
	.nav-button-full {
		display: inline;
	}

	.nav-button-compact {
		display: none;
	}
}

.loading {
	text-align: center;
	padding: 2rem;
	color: var(--primary-color);
	font-size: 1.1rem;
}

.error {
	background-color: #FFE6E6;
	color: #D32F2F;
	padding: 1rem;
	border-radius: 8px;
	margin: 1rem 0;
	text-align: center;
}

.version-display {
	position: fixed;
	bottom: 10px;
	right: 10px !important;
	left: auto !important;
	font-size: 0.7rem;
	color: #999;
	opacity: 0.6;
	cursor: default;
	user-select: none;
	z-index: 1000;
}

/* Book Editor Custom Styles */
.bible-verse {
	font-style: italic;
	padding-left: 2rem;
	padding-right: 2rem;
	margin: 1rem 0;
	border-left: 4px solid #7B68EE;
	background-color: #F5F3FF;
	padding-top: 0.75rem;
	padding-bottom: 0.75rem;
	line-height: 1.8;
	color: #4A5568;
}

.book-paragraph {
	text-align: justify;
	line-height: 1.8;
	margin-bottom: 1rem;
}

/* Mobile reading optimizations */
@media (max-width: 768px) {
	.content.px-4 {
		padding-left: 0.25rem !important;
		padding-right: 0.25rem !important;
	}
	
	.book-paragraph {
		line-height: 1.0;
		margin-bottom: 0.5rem;
	}
	
	.bible-verse {
		padding-left: 0.5rem;
		padding-right: 0.5rem;
		line-height: 1.2;
		padding-top: 0.5rem;
		padding-bottom: 0.5rem;
	}
}

.book-header {
	font-weight: bold;
	color: var(--primary-color);
	margin-top: 1.5rem;
	margin-bottom: 1rem;
}

/* Custom format dropdown styles for RTE */
.e-rte-format .e-item[title="Bible Verse"] {
	font-style: italic;
	color: #7B68EE;
}

/* Feast Day Modal */
.modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 1000;
	animation: fadeIn 0.2s ease-in;
	/* Prevent overscroll but allow clicks */
	overscroll-behavior: contain;
}

.modal-dialog {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 1001;
	width: 90%;
	max-width: 500px;
	animation: slideIn 0.3s ease-out;
}

/* Wider modal on desktop screens */
@media (min-width: 850px) {
	.modal-dialog {
		width: auto;
		min-width: 800px;
		max-width: 1024px;
	}
}

.modal-content {
	background: white;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	overflow: hidden;
	/* Prevent overscroll and pull-to-refresh */
	overscroll-behavior: contain;
}

.modal-header {
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
	color: white;
	padding: 1.5rem;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.modal-header.high-sabbath-header {
	background: linear-gradient(135deg, #E74C3C, #C0392B);
}

.modal-header.feast-day-header {
	background: linear-gradient(135deg, #3498DB, #2980B9);
}

.modal-header.regular-feast-header {
	background: linear-gradient(135deg, #7F8C8D, #5D6D7E);
}

.modal-header h3 {
	margin: 0;
	font-size: 1.5rem;
}

.feast-title-input {
	background: rgba(255, 255, 255, 0.2);
	border: 2px solid rgba(255, 255, 255, 0.5);
	color: white;
	padding: 0.5rem;
	font-size: 1.5rem;
	font-weight: bold;
	border-radius: 6px;
	width: 100%;
	max-width: 500px;
}

.feast-title-input::placeholder {
	color: rgba(255, 255, 255, 0.7);
}

.feast-title-input:focus {
	outline: none;
	border-color: white;
	background: rgba(255, 255, 255, 0.3);
}

.sabbath-indicator {
	position: absolute;
	top: 8px;
	right: 40px;
	font-size: 0.7rem;
	font-weight: bold;
	color: white;
	opacity: 0.9;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.modal-close {
	background: none;
	border: none;
	color: white;
	font-size: 2rem;
	cursor: pointer;
	padding: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.modal-close:hover {
	opacity: 0.8;
}

.modal-body {
	padding: 1.5rem;
	max-height: 60vh;
	overflow-y: auto;
	/* Prevent overscroll from affecting parent */
	overscroll-behavior: contain;
	/* Ensure smooth scrolling on mobile */
	-webkit-overflow-scrolling: touch;
}

.feast-details p {
	margin: 0.5rem 0;
	color: var(--text-color);
}

.feast-description {
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border-color);
}

.feast-description.scrollable {
	max-height: 400px;
	overflow-y: auto;
}

.feast-description h4 {
	color: var(--primary-color);
	margin-bottom: 0.5rem;
}

.feast-description em {
	color: #999;
}

.details-content {
	line-height: 1.6;
}

.editor-container {
	margin-top: 0.5rem;
}

.form-group {
	margin-bottom: 1.5rem;
}

.form-group label {
	display: block;
	font-weight: bold;
	margin-bottom: 0.5rem;
	color: var(--text-color);
}

.form-hint {
	font-size: 0.85rem;
	color: #666;
	margin-top: 0.25rem;
	font-weight: normal;
}

.modal-actions {
	display: flex;
	gap: 0.75rem;
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border-color);
}

.btn {
	padding: 0.6rem 1.25rem;
	border: none;
	border-radius: 6px;
	font-size: 1rem;
	cursor: pointer;
	transition: all 0.2s;
	font-weight: 500;
}

.btn-primary {
	background-color: var(--primary-color);
	color: white;
}

.btn-primary:hover:not(:disabled) {
	background-color: var(--secondary-color);
}

.btn-secondary {
	background-color: #6c757d;
	color: white;
}

.btn-secondary:hover:not(:disabled) {
	background-color: #5a6268;
}

.btn-danger {
	background-color: #dc3545;
	color: white;
}

.btn-danger:hover:not(:disabled) {
	background-color: #c82333;
}

.btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.modal-dialog.editing-mode {
	max-width: 900px;
}

.alert {
	padding: 0.75rem;
	margin: 1rem 0;
	border-radius: 6px;
}

.alert-danger {
	background-color: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
}

.modal-footer {
	padding: 1rem 1.5rem;
	background-color: #f8f9fa;
	display: flex;
	justify-content: flex-end;
}

.btn-close {
	background-color: var(--primary-color);
	color: white;
	border: none;
	padding: 0.5rem 1.5rem;
	border-radius: 6px;
	cursor: pointer;
	font-size: 1rem;
	transition: background-color 0.2s;
}

.btn-close:hover {
	background-color: var(--secondary-color);
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes slideIn {
	from {
		opacity: 0;
		transform: translate(-50%, -60%);
	}
	to {
		opacity: 1;
		transform: translate(-50%, -50%);
	}
}
