/**
 * Agenda Page Styles
 *
 * Styles for the agenda page template (page-agenda.php).
 * Extracted and adapted from the static agenda.html design reference.
 *
 * Depends on main.css for: --primary, --dark, --text-light, --light-bg,
 * --shadow-sm, --shadow-md, --radius, --transition.
 *
 * @package ecole-du-bonheur
 */

/* ================================================================
   PAGE TITLE QUOTES — agenda green override
   ================================================================ */

.page-title-quotes::before,
.page-title-quotes::after {
	color: #8BC48A;
}

/* ================================================================
   LAYOUT
   ================================================================ */

.agenda-content {
	max-width: 1400px;
	margin: 0 auto;
}

.calendar-legend-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5rem;
	margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
	.calendar-legend-grid {
		grid-template-columns: 1fr 300px;
		align-items: start;
	}
}

.legend-filters-column {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* ================================================================
   DESKTOP-ONLY VISIBILITY
   ================================================================ */

.desktop-only {
	display: none;
}

@media (min-width: 1024px) {
	.desktop-only {
		display: block;
	}

	h3.desktop-only {
		display: flex;
	}
}

/* ================================================================
   LEGEND (desktop only card)
   ================================================================ */

.agenda-legend {
	background: white;
	border-radius: var(--radius);
	padding: 1.5rem;
	box-shadow: var(--shadow-sm);
}

.agenda-legend h3 {
	font-size: 1rem;
	font-weight: 700;
	color: var(--dark);
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.agenda-legend h3 i {
	color: var(--primary);
}

.legend-items {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
}

@media (min-width: 1024px) {
	.legend-items {
		flex-direction: column;
		gap: 0.75rem;
	}
}

@media (max-width: 640px) {
	.legend-items {
		flex-direction: column;
		gap: 0.75rem;
	}
}

.legend-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.legend-color {
	width: 20px;
	height: 20px;
	border-radius: 5px;
	flex-shrink: 0;
}

.legend-color.maternelle {
	background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.legend-color.primaire {
	background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

.legend-color.commun {
	background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%);
}

.legend-text {
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--dark);
}

/* ================================================================
   FILTER BUTTONS
   ================================================================ */

.agenda-filters-box {
	background: white;
	border-radius: var(--radius);
	padding: 1.5rem;
	box-shadow: var(--shadow-sm);
}

.agenda-filters-box h3 {
	font-size: 1rem;
	font-weight: 700;
	color: var(--dark);
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.agenda-filters-box h3 i {
	color: var(--primary);
}

.agenda-filters {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

@media (max-width: 1023px) {
	.agenda-filters {
		flex-direction: row;
		flex-wrap: wrap;
	}

	.agenda-filters-box {
		background: transparent;
		padding: 0;
		box-shadow: none;
	}

	.agenda-filters {
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: 0.5rem;
	}
}

@media (max-width: 480px) {
	.agenda-filters {
		grid-template-columns: repeat(2, 1fr);
	}
}

.filter-btn {
	padding: 0.6rem 1rem;
	border-radius: 50px;
	border: 2px solid #E5E7EB;
	background: white;
	font-family: 'Plus Jakarta Sans', sans-serif;
	font-weight: 600;
	font-size: 0.85rem;
	cursor: pointer;
	transition: var(--transition);
	color: var(--text-light);
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

@media (min-width: 1024px) {
	.filter-btn {
		width: 100%;
	}
}

@media (max-width: 1023px) {
	.filter-btn {
		padding: 0.5rem 0.5rem;
		font-size: 0.75rem;
		flex-direction: column;
		gap: 0.35rem;
		border-radius: 12px;
	}

	.filter-info {
		display: none;
	}
}

.filter-btn:hover {
	border-color: var(--primary);
	color: var(--primary);
}

.filter-btn.active {
	background: var(--primary);
	border-color: var(--primary);
	color: white;
}

.filter-btn.active .filter-color {
	border: 2px solid white;
}

.filter-color {
	width: 14px;
	height: 14px;
	border-radius: 4px;
	flex-shrink: 0;
}

@media (max-width: 1023px) {
	.filter-color {
		width: 18px;
		height: 18px;
		border-radius: 5px;
	}
}

.filter-color.all {
	background: linear-gradient(135deg, var(--primary) 0%, #6B8DE8 100%);
}

.filter-color.maternelle {
	background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.filter-color.primaire {
	background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

.filter-color.commun {
	background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%);
}

.filter-info {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.6rem 0.75rem;
	background: var(--light-bg);
	border-radius: 8px;
	font-weight: 500;
	font-size: 0.8rem;
	color: var(--text-light);
}

.filter-info i {
	color: var(--primary);
}

.filter-info.maternelle-view {
	background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
	color: #059669;
}

.filter-info.primaire-view {
	background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
	color: #7C3AED;
}

/* ================================================================
   CALENDAR WIDGET
   ================================================================ */

.calendar-wrapper {
	background: white;
	border-radius: var(--radius);
	padding: 1.5rem;
	box-shadow: var(--shadow-md);
}

.calendar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.5rem;
}

.calendar-header h3 {
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--dark);
}

.calendar-nav {
	width: 40px;
	height: 40px;
	border: none;
	background: var(--light-bg);
	border-radius: 10px;
	cursor: pointer;
	color: var(--primary);
	font-size: 1rem;
	transition: var(--transition);
}

.calendar-nav:hover {
	background: var(--primary);
	color: white;
}

.calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 0.25rem;
	margin-bottom: 0.5rem;
}

.calendar-day-header {
	text-align: center;
	font-weight: 700;
	font-size: 0.8rem;
	color: var(--text-light);
	padding: 0.5rem;
}

.calendar-days {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 0.5rem;
}

.calendar-day {
	min-height: 80px;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	border-radius: 8px;
	font-size: 0.9rem;
	font-weight: 500;
	cursor: default;
	position: relative;
	background: var(--light-bg);
	padding: 0.25rem;
}

.calendar-day .day-number {
	font-weight: 700;
	font-size: 0.85rem;
	color: var(--text-light);
	padding: 0.25rem;
}

.calendar-day.empty {
	background: transparent;
	min-height: auto;
}

.calendar-day.today .day-number {
	background: var(--primary);
	color: white;
	border-radius: 50%;
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.calendar-day.has-events {
	cursor: pointer;
}

.calendar-day.has-events:hover {
	background: #E0E7FF;
}

.calendar-events {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	overflow: hidden;
}

.calendar-event {
	font-size: 0.7rem;
	padding: 0.2rem 0.4rem;
	border-radius: 4px;
	color: white;
	cursor: pointer;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: transform 0.2s, box-shadow 0.2s;
}

.calendar-event:hover {
	transform: scale(1.02);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.calendar-event.maternelle {
	background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.calendar-event.primaire {
	background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

.calendar-event.commun {
	background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%);
}

.calendar-event-more {
	font-size: 0.7rem;
	font-weight: 700;
	color: white;
	text-align: center;
	padding: 0.2rem 0.4rem;
	background: var(--primary);
	border-radius: 6px;
	margin-top: 2px;
}

/* ================================================================
   EVENT LIST
   ================================================================ */

.agenda-list {
	background: white;
	border-radius: var(--radius);
	padding: 2rem;
	box-shadow: var(--shadow-md);
}

.agenda-list + .agenda-list {
	margin-top: 2rem;
}

.agenda-month {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.agenda-month h3 {
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--dark);
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.agenda-month h3 i {
	color: var(--primary);
}

.event-count {
	background: var(--primary);
	color: white;
	padding: 0.35rem 0.75rem;
	border-radius: 50px;
	font-size: 0.85rem;
	font-weight: 600;
}

/* ── Subscribe to calendar bar ── */
.agenda-subscribe {
	background: var(--light-bg);
	border-radius: 12px;
	padding: 1.25rem 1.5rem;
	margin-bottom: 2rem;
	text-align: center;
}
.agenda-subscribe-label {
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--dark);
	margin: 0 0 0.75rem;
}
.agenda-subscribe-label i {
	color: var(--primary);
	margin-right: 0.4rem;
}
.agenda-subscribe-buttons {
	display: flex;
	justify-content: center;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-bottom: 0.5rem;
}
.agenda-subscribe-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.55rem 1.2rem;
	border-radius: 8px;
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.2s ease;
	background: var(--primary);
	color: white;
}
.agenda-subscribe-btn:hover {
	background: var(--primary-dark);
	color: white;
	transform: translateY(-1px);
}
.agenda-subscribe-btn--google {
	background: #4285F4;
}
.agenda-subscribe-btn--google:hover {
	background: #3367D6;
}
.agenda-subscribe-btn--apple {
	background: #333;
}
.agenda-subscribe-btn--apple:hover {
	background: #111;
}
.agenda-subscribe-download {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin-top: 0.75rem;
	font-size: 0.8rem;
	color: var(--text-light);
	text-decoration: none;
	transition: color 0.2s ease;
}
.agenda-subscribe-download:hover {
	color: var(--primary);
}
.agenda-subscribe-download i {
	font-size: 0.75rem;
}
.agenda-subscribe-hint {
	font-size: 0.78rem;
	color: var(--text-light);
	margin: 0;
}

.agenda-item {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	padding: 1.25rem;
	border-radius: 12px;
	margin-bottom: 1rem;
	background: var(--light-bg);
	transition: var(--transition);
	border-left: 4px solid transparent;
	flex-wrap: wrap;
}

.agenda-item add-to-calendar-button {
	margin-left: auto;
}

.agenda-item:last-child {
	margin-bottom: 0;
}

.agenda-item:hover {
	transform: translateX(5px);
	box-shadow: var(--shadow-sm);
}

.agenda-item.maternelle {
	border-left-color: #10B981;
}

.agenda-item.primaire {
	border-left-color: #8B5CF6;
}

.agenda-item.commun {
	border-left-color: #EC4899;
}

.agenda-item.hidden {
	display: none;
}

.agenda-item.highlight {
	animation: highlightPulse 2s ease-out;
	box-shadow: 0 0 0 3px var(--primary);
}

@keyframes highlightPulse {
	0% {
		box-shadow: 0 0 0 3px var(--primary);
		background: rgba(65, 105, 225, 0.2);
	}

	100% {
		box-shadow: none;
		background: var(--light-bg);
	}
}

.agenda-date {
	min-width: 60px;
	text-align: center;
	background: white;
	padding: 0.75rem;
	border-radius: 10px;
	box-shadow: var(--shadow-sm);
	flex-shrink: 0;
}

.agenda-date .day {
	display: block;
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--primary);
}

.agenda-date .month {
	display: block;
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--text-light);
	text-transform: uppercase;
}

/* Multi-day date range */
.agenda-date-range {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	flex-shrink: 0;
}

.agenda-date-range .agenda-date {
	min-width: 48px;
	padding: 0.5rem;
}

.agenda-date-range .agenda-date .day {
	font-size: 1.2rem;
}

.agenda-date-range .agenda-date .month {
	font-size: 0.65rem;
}

.date-separator {
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--text-light);
}

.agenda-details {
	flex: 1;
}

.agenda-details h4 {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--dark);
	margin-bottom: 0.5rem;
}

.agenda-details p {
	font-size: 0.9rem;
	color: var(--text-light);
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.25rem;
}

.agenda-details p:last-child {
	margin-bottom: 0;
}

.agenda-details p i {
	width: 16px;
	color: var(--primary);
	flex-shrink: 0;
}

.agenda-event-desc {
	font-size: 0.85rem;
	color: #6B7280;
	margin-top: 0.25rem;
	line-height: 1.4;
}

.agenda-badge {
	padding: 0.35rem 0.75rem;
	border-radius: 50px;
	font-size: 0.75rem;
	font-weight: 700;
	color: white;
	white-space: nowrap;
	flex-shrink: 0;
}

.agenda-badge.maternelle {
	background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.agenda-badge.primaire {
	background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

.agenda-badge.commun {
	background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%);
}

/* Empty state placeholder */
.agenda-placeholder {
	text-align: center;
	padding: 3rem 1rem;
	color: var(--text-light);
}

.agenda-placeholder .placeholder-icon {
	font-size: 3rem;
	color: var(--primary);
	opacity: 0.5;
	margin-bottom: 1rem;
}

.agenda-placeholder p {
	font-size: 1.1rem;
	margin-bottom: 0.5rem;
}

.agenda-placeholder .placeholder-hint {
	font-size: 0.9rem;
	opacity: 0.7;
}

/* ================================================================
   DAY EVENTS MODAL
   ================================================================ */

.day-events-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 1000;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.day-events-modal.active {
	display: flex;
}

.modal-content {
	background: white;
	border-radius: 20px;
	max-width: 500px;
	width: 100%;
	max-height: 80vh;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
	from {
		opacity: 0;
		transform: translateY(-20px) scale(0.95);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid #E5E7EB;
	background: var(--light-bg);
}

.modal-header h3 {
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--dark);
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.modal-close {
	width: 36px;
	height: 36px;
	border: none;
	background: white;
	border-radius: 10px;
	cursor: pointer;
	color: var(--text-light);
	font-size: 1rem;
	transition: var(--transition);
	display: flex;
	align-items: center;
	justify-content: center;
}

.modal-close:hover {
	background: #FEE2E2;
	color: #DC2626;
}

.modal-body {
	padding: 1rem;
	overflow-y: auto;
	max-height: calc(80vh - 70px);
}

.modal-event {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem;
	border-radius: 12px;
	margin-bottom: 0.75rem;
	background: var(--light-bg);
	cursor: pointer;
	transition: var(--transition);
}

.modal-event:last-child {
	margin-bottom: 0;
}

.modal-event:hover {
	transform: translateX(5px);
	box-shadow: var(--shadow-sm);
}

.modal-event-color {
	width: 8px;
	min-height: 50px;
	border-radius: 4px;
	flex-shrink: 0;
}

.modal-event-color.maternelle {
	background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.modal-event-color.primaire {
	background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

.modal-event-color.commun {
	background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%);
}

.modal-event-details {
	flex: 1;
}

.modal-event-details h4 {
	font-size: 1rem;
	font-weight: 700;
	color: var(--dark);
	margin-bottom: 0.25rem;
}

.modal-event-details p {
	font-size: 0.85rem;
	color: var(--text-light);
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.modal-event-badge {
	padding: 0.25rem 0.6rem;
	border-radius: 50px;
	font-size: 0.7rem;
	font-weight: 700;
	color: white;
	flex-shrink: 0;
}

.modal-event-badge.maternelle {
	background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.modal-event-badge.primaire {
	background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

.modal-event-badge.commun {
	background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%);
}

/* ================================================================
   RESPONSIVE — 768px
   ================================================================ */

@media (max-width: 768px) {
	.calendar-wrapper {
		padding: 1rem;
	}

	.calendar-days {
		gap: 0.35rem;
	}

	.calendar-day {
		min-height: 70px;
	}

	.calendar-event {
		font-size: 0.65rem;
		padding: 0.15rem 0.3rem;
	}
}

/* ================================================================
   RESPONSIVE — 640px
   ================================================================ */

@media (max-width: 640px) {
	.agenda-item {
		flex-direction: column;
		align-items: flex-start;
		gap: 1rem;
	}

	.agenda-date {
		display: flex;
		align-items: center;
		gap: 0.5rem;
	}

	.agenda-date .day,
	.agenda-date .month {
		display: inline;
	}

	.agenda-date-range .agenda-date {
		min-width: auto;
		padding: 0.4rem 0.5rem;
	}

	.calendar-days {
		gap: 0.25rem;
	}

	.calendar-day {
		min-height: 55px;
		padding: 0.2rem;
	}

	.calendar-day .day-number {
		font-size: 0.75rem;
		padding: 0.15rem;
	}

	.calendar-day.today .day-number {
		width: 22px;
		height: 22px;
	}

	.calendar-event {
		font-size: 0.55rem;
		padding: 0.1rem 0.2rem;
		border-radius: 3px;
	}

	.calendar-day-header {
		font-size: 0.7rem;
		padding: 0.25rem;
	}
}

/* ================================================================
   RESPONSIVE — 480px (very small screens)
   ================================================================ */

@media (max-width: 480px) {
	.calendar-wrapper {
		padding: 0.75rem;
	}

	.calendar-header h3 {
		font-size: 1rem;
	}

	.calendar-nav {
		width: 32px;
		height: 32px;
		font-size: 0.85rem;
	}

	.calendar-days {
		gap: 2px;
	}

	.calendar-day {
		min-height: 45px;
		padding: 0.1rem;
	}

	.calendar-day .day-number {
		font-size: 0.65rem;
		padding: 0.1rem;
	}

	.calendar-day.today .day-number {
		width: 18px;
		height: 18px;
		font-size: 0.6rem;
	}

	/* On very small screens, show dots instead of text */
	.calendar-event {
		font-size: 0;
		width: 10px;
		height: 10px;
		min-height: 10px;
		padding: 0;
		border-radius: 50%;
		margin: 0;
	}

	.calendar-events {
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: center;
		align-items: center;
		gap: 3px;
		margin-top: 2px;
	}

	.calendar-event-more {
		font-size: 0.6rem;
		padding: 0.1rem 0.25rem;
		border-radius: 4px;
		min-width: 18px;
	}

	.calendar-day-header {
		font-size: 0.6rem;
	}

	.calendar-event-more {
		font-size: 0.65rem;
		padding: 0.15rem 0.35rem;
		border-radius: 4px;
	}
}

/* ================================================================
   RESPONSIVE — 360px (extreme small screens)
   ================================================================ */

@media (max-width: 360px) {
	.calendar-day {
		min-height: 42px;
	}

	.calendar-day .day-number {
		font-size: 0.6rem;
	}

	.calendar-event {
		width: 8px;
		height: 8px;
		min-height: 8px;
	}

	.calendar-event-more {
		font-size: 0.55rem;
		padding: 0.08rem 0.2rem;
		min-width: 16px;
	}
}

/* ================================================================
   9. HIGHLIGHT FLASH (scroll-to from modal)
   ================================================================ */

@keyframes agenda-highlight-flash {
	0%   { background-color: rgba(75, 191, 107, 0.3); }
	100% { background-color: transparent; }
}

.agenda-item.highlight-flash {
	animation: agenda-highlight-flash 1.5s ease-out;
}
