/**
 * Pretpot Calendar Button Widget - Frontend Styles
 */

/* ========== BUTTON STYLES ========== */
.pretpot-calendar-button-wrapper {
	position: relative;
	display: inline-block;
}

.pretpot-calendar-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: none;
	cursor: pointer;
	transition: all 0.3s ease;
	font-family: inherit;
	outline: none;
}

.pretpot-calendar-btn:focus {
	outline: 2px solid rgba(0, 0, 0, 0.2);
	outline-offset: 2px;
}

.pretpot-calendar-btn svg {
	transition: fill 0.3s ease;
}

/* ========== POPUP STYLES ========== */
.pretpot-calendar-popup {
	position: absolute;
	top: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%);
	z-index: 9999;
	box-sizing: border-box;
}

/* Position adjustments for edge cases */
@media (max-width: 768px) {
	.pretpot-calendar-popup {
		left: 0;
		transform: none;
		max-width: calc(100vw - 40px);
	}
}

/* ========== SLIDES CONTAINER ========== */
.pretpot-calendar-slides {
	position: relative;
	overflow: hidden;
}

.pretpot-calendar-slide {
	width: 100%;
	display: none;
}

.pretpot-calendar-slide.active {
	display: block;
}

/* Slide animations */
.pretpot-calendar-slide.slide-in-left {
	animation: slideInLeft 0.4s ease forwards;
}

.pretpot-calendar-slide.slide-out-left {
	animation: slideOutLeft 0.4s ease forwards;
}

.pretpot-calendar-slide.slide-in-right {
	animation: slideInRight 0.4s ease forwards;
}

.pretpot-calendar-slide.slide-out-right {
	animation: slideOutRight 0.4s ease forwards;
}

@keyframes slideInLeft {
	from {
		transform: translateX(-100%);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOutLeft {
	from {
		transform: translateX(0);
		opacity: 1;
	}
	to {
		transform: translateX(-100%);
		opacity: 0;
	}
}

@keyframes slideInRight {
	from {
		transform: translateX(100%);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOutRight {
	from {
		transform: translateX(0);
		opacity: 1;
	}
	to {
		transform: translateX(100%);
		opacity: 0;
	}
}

/* ========== CALENDAR HEADER ========== */
.pretpot-calendar-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: 600;
}

.pretpot-calendar-month {
	flex: 1;
}

.pretpot-calendar-year {
	text-align: right;
}

/* ========== DIVIDER ========== */
.pretpot-calendar-divider {
	width: 100%;
	margin: 10px 0;
}

/* ========== LEGEND ========== */
.pretpot-calendar-legend {
	display: flex;
	gap: 15px;
	margin-bottom: 15px;
	font-size: 12px;
}

.pretpot-calendar-legend-item {
	display: flex;
	align-items: center;
	gap: 6px;
}

.pretpot-calendar-legend-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}

/* ========== WEEKDAYS ========== */
.pretpot-calendar-weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 5px;
	margin-bottom: 10px;
	text-align: center;
	font-weight: 600;
	font-size: 12px;
}

.pretpot-calendar-weekday {
	padding: 5px;
}

/* ========== DAYS GRID ========== */
.pretpot-calendar-days {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 5px;
}

.pretpot-calendar-day {
	aspect-ratio: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	border-radius: 8px;
	transition: all 0.3s ease;
	position: relative;
	cursor: default;
}

.pretpot-calendar-day.has-data {
	cursor: pointer;
}

.pretpot-calendar-day.has-data:hover {
	transform: scale(1.05);
}

.pretpot-calendar-day-empty {
	cursor: default;
	opacity: 0;
	pointer-events: none;
}

.pretpot-calendar-day-number {
	font-size: 14px;
	font-weight: 500;
}

.pretpot-calendar-day-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	position: absolute;
	bottom: 4px;
}

/* ========== DETAIL SLIDE ========== */
.pretpot-calendar-detail {
	min-height: 200px;
	position: relative;
}

.pretpot-calendar-back {
	position: absolute;
	top: 0;
	left: 0;
	background: none;
	border: none;
	cursor: pointer;
	padding: 5px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	color: inherit;
}

.pretpot-calendar-back:hover {
	transform: translateX(-3px);
	opacity: 0.7;
}

.pretpot-calendar-detail-content {
	padding-top: 40px;
}

.pretpot-calendar-detail-note {
	line-height: 1.6;
	margin-bottom: 20px;
}

.pretpot-calendar-detail-btn {
	display: inline-block;
	text-decoration: none;
	text-align: center;
	transition: all 0.3s ease;
	font-family: inherit;
}

.pretpot-calendar-detail-btn:hover {
	opacity: 0.85;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
	.pretpot-calendar-weekdays,
	.pretpot-calendar-days {
		gap: 3px;
	}

	.pretpot-calendar-day-number {
		font-size: 12px;
	}

	.pretpot-calendar-legend {
		font-size: 11px;
	}
}

/* ========== ACCESSIBILITY ========== */
.pretpot-calendar-btn:focus-visible,
.pretpot-calendar-day:focus-visible,
.pretpot-calendar-back:focus-visible,
.pretpot-calendar-detail-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ========== RTL SUPPORT ========== */
[dir="rtl"] .pretpot-calendar-month {
	text-align: right;
}

[dir="rtl"] .pretpot-calendar-year {
	text-align: left;
}

[dir="rtl"] .pretpot-calendar-back {
	left: auto;
	right: 0;
}

[dir="rtl"] .pretpot-calendar-back svg {
	transform: scaleX(-1);
}

/* ========== PRINT STYLES ========== */
@media print {
	.pretpot-calendar-popup {
		display: none !important;
	}
}