/**
 * Voxel Calendar Frontend Styles
 *
 * @package Voxel_Calendar
 * @since 1.0.0
 */

/* ========================================
   Container
   ======================================== */

.voxel-calendar-container {
	position: relative;
	width: 100%;
	font-family: inherit;
	background-color: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	overflow: hidden;
}

.voxel-calendar-container.voxel-calendar-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* ========================================
   Header
   ======================================== */

.voxel-calendar-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px;
	background-color: #f8f9fa;
	border-bottom: 1px solid #e0e0e0;
	min-height: 76px;
}

.voxel-calendar-nav {
	display: flex;
	gap: 10px;
}

.voxel-calendar-nav-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #ddd;
	background-color: #fff;
	color: #333;
	font-size: 18px;
	font-weight: bold;
	cursor: pointer;
	border-radius: 4px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.voxel-calendar-nav-button:hover {
	background-color: #007bff;
	color: #fff;
	border-color: #007bff;
}

.voxel-calendar-nav-button:focus {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

.voxel-calendar-today {
	width: auto;
	min-width: fit-content;
	padding: 0 16px;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

.voxel-calendar-current-month {
	font-size: 20px;
	font-weight: 600;
	color: #333;
}

/* ========================================
   View Switcher
   ======================================== */

.voxel-calendar-view-switcher {
	display: flex;
	gap: 4px;
	background-color: #f0f0f0;
	padding: 4px;
	border-radius: 6px;
	flex-shrink: 0;
}

.voxel-calendar-view-button {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	min-height: 36px;
	width: 36px;
	height: 36px;
	padding: 0;
	margin: 0;
	background-color: transparent;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	color: #666;
	transition: background-color 0.2s ease, color 0.2s ease;
	flex-shrink: 0;
	position: relative;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.voxel-calendar-view-button:hover {
	background-color: #e0e0e0;
	color: #333;
}

.voxel-calendar-view-button.active {
	background-color: #2196f3;
	color: #fff;
}

.voxel-calendar-view-button svg {
	width: 16px;
	height: 16px;
	pointer-events: none;
	display: block;
}

/* ========================================
   Calendar Body
   ======================================== */

.voxel-calendar-body {
	padding: 0;
}

/* ========================================
   Calendar Grid
   ======================================== */

.voxel-calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 0;
}

/* ========================================
   Day Headers
   ======================================== */

.voxel-calendar-day-header {
	padding: 12px 8px;
	text-align: center;
	font-weight: 700;
	font-size: 14px;
	color: #666;
	background-color: #f5f5f5;
	border: 1px solid #e0e0e0;
	border-right: 0;
	border-top: 0;
}

.voxel-calendar-day-header:last-child {
	border-right: 1px solid #e0e0e0;
}

/* ========================================
   Day Cells
   ======================================== */

.voxel-calendar-day {
	position: relative;
	height: 120px;
	padding: 8px;
	border: 1px solid #e0e0e0;
	border-right: 0;
	border-bottom: 0;
	background-color: #fff;
	transition: background-color 0.2s ease;
	overflow: hidden;
}

.voxel-calendar-day:nth-child(7n) {
	border-right: 1px solid #e0e0e0;
}

.voxel-calendar-grid .voxel-calendar-day:nth-last-child(-n+7) {
	border-bottom: 1px solid #e0e0e0;
}

.voxel-calendar-day.other-month {
	opacity: 0.5;
	background-color: #fafafa;
}

.voxel-calendar-day.today {
	background-color: #e3f2fd;
	border-color: #2196f3;
}

.voxel-calendar-day:hover {
	background-color: #f8f9fa;
}

/* ========================================
   Day Number
   ======================================== */

.voxel-calendar-day-number {
	position: relative;
	padding: 4px 8px;
	font-size: 14px;
	font-weight: 600;
	color: #333;
	margin-bottom: 8px;
}

.voxel-calendar-day.today .voxel-calendar-day-number {
	color: #2196f3;
	font-weight: 700;
}

.voxel-calendar-day.other-month .voxel-calendar-day-number {
	color: #999;
}

/* ========================================
   Events Container
   ======================================== */

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

/* ========================================
   Event Items
   ======================================== */

.voxel-calendar-event {
	padding: 4px 8px;
	margin: 0;
	font-size: 11px;
	line-height: 1.3;
	color: #fff;
	background-color: #2196f3;
	border-radius: 3px;
	cursor: pointer;
	overflow: hidden;
	transition: background-color 0.2s ease, transform 0.1s ease;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.voxel-calendar-event-title {
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.voxel-calendar-event-time {
	font-size: 10px;
	opacity: 0.9;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.voxel-calendar-event:hover {
	background-color: #1976d2;
	transform: translateY(-1px);
}

/* Multi-day event styling */
.voxel-calendar-event.multi-day {
	opacity: 0.9;
}

.voxel-calendar-event.multi-day-start {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.voxel-calendar-event.multi-day-middle {
	border-radius: 0;
}

.voxel-calendar-event.multi-day-end {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

/* ========================================
   More Events Indicator
   ======================================== */

.voxel-calendar-more-events {
	padding: 4px 8px;
	margin-top: 4px;
	font-size: 11px;
	font-weight: 600;
	color: #666;
	text-align: center;
	background-color: #f0f0f0;
	border-radius: 3px;
	cursor: pointer;
	transition: background-color 0.2s ease;
	position: relative;
}

.voxel-calendar-more-events:hover {
	background-color: #e0e0e0;
	color: #333;
}

/* ========================================
   Events Popup
   ======================================== */

.voxel-calendar-events-popup {
	position: absolute;
	z-index: 1000;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	padding: 12px;
	min-width: 280px;
	max-width: 400px;
}

.voxel-calendar-events-popup::before {
	content: '';
	position: absolute;
	top: -8px;
	left: 20px;
	width: 0;
	height: 0;
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-bottom: 8px solid #ddd;
}

.voxel-calendar-events-popup::after {
	content: '';
	position: absolute;
	top: -7px;
	left: 21px;
	width: 0;
	height: 0;
	border-left: 7px solid transparent;
	border-right: 7px solid transparent;
	border-bottom: 7px solid #fff;
}

.voxel-calendar-popup-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid #e0e0e0;
}

.voxel-calendar-popup-title {
	font-size: 14px;
	font-weight: 700;
	color: #333;
}

.voxel-calendar-popup-close {
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	color: #666;
	padding: 0;
	border-radius: 3px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.voxel-calendar-popup-close:hover {
	background-color: #f0f0f0;
	color: #333;
}

.voxel-calendar-popup-events {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 400px;
	overflow-y: auto;
}

.voxel-calendar-popup-event {
	padding: 10px;
	background-color: #f8f9fa;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.2s ease;
	border-left: 3px solid #2196f3;
}

.voxel-calendar-popup-event:hover {
	background-color: #e9ecef;
}

.voxel-calendar-popup-event-title {
	font-size: 13px;
	font-weight: 600;
	color: #333;
	margin-bottom: 4px;
}

.voxel-calendar-popup-event-time {
	font-size: 12px;
	color: #666;
}

/* ========================================
   List View
   ======================================== */

.voxel-calendar-list-view {
	padding: 16px;
}

.voxel-calendar-list-date-group {
	margin-bottom: 24px;
}

.voxel-calendar-list-date-group:last-child {
	margin-bottom: 0;
}

.voxel-calendar-list-date-header {
	display: flex;
	align-items: baseline;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 2px solid #2196f3;
	margin-bottom: 12px;
}

.voxel-calendar-list-day-name {
	font-size: 18px;
	font-weight: 700;
	color: #333;
}

.voxel-calendar-list-date {
	font-size: 14px;
	font-weight: 500;
	color: #666;
}

.voxel-calendar-list-events {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.voxel-calendar-list-event {
	display: block;
	padding: 12px 16px;
	background-color: #f8f9fa;
	border-left: 4px solid #2196f3;
	border-radius: 4px;
	text-decoration: none;
	transition: background-color 0.2s ease, transform 0.1s ease;
}

.voxel-calendar-list-event:hover {
	background-color: #e9ecef;
	transform: translateX(4px);
}

.voxel-calendar-list-event-content {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.voxel-calendar-list-event-time {
	font-size: 13px;
	font-weight: 600;
	color: #2196f3;
	min-width: 120px;
}

.voxel-calendar-list-event-title {
	font-size: 15px;
	font-weight: 600;
	color: #333;
	flex: 1;
}

.voxel-calendar-list-event-badge {
	font-size: 11px;
	font-weight: 600;
	color: #666;
	background-color: #e0e0e0;
	padding: 4px 8px;
	border-radius: 3px;
}

/* ========================================
   Agenda View
   ======================================== */

.voxel-calendar-agenda-view {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.voxel-calendar-agenda-event {
	display: flex;
	gap: 16px;
	padding: 16px;
	background-color: #f8f9fa;
	border-radius: 6px;
	text-decoration: none;
	transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.voxel-calendar-agenda-event:hover {
	background-color: #e9ecef;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.voxel-calendar-agenda-event.is-today {
	background-color: #e3f2fd;
	border: 1px solid #2196f3;
}

.voxel-calendar-agenda-event.is-today:hover {
	background-color: #bbdefb;
}

.voxel-calendar-agenda-date {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 60px;
	padding: 8px;
	background-color: #fff;
	border-radius: 4px;
	border: 1px solid #e0e0e0;
	position: relative;
}

.voxel-calendar-agenda-event.is-today .voxel-calendar-agenda-date {
	background-color: #2196f3;
	border-color: #2196f3;
}

.voxel-calendar-agenda-day {
	font-size: 24px;
	font-weight: 700;
	color: #333;
	line-height: 1;
}

.voxel-calendar-agenda-event.is-today .voxel-calendar-agenda-day {
	color: #fff;
}

.voxel-calendar-agenda-month {
	font-size: 12px;
	font-weight: 600;
	color: #666;
	text-transform: uppercase;
	margin-top: 4px;
}

.voxel-calendar-agenda-event.is-today .voxel-calendar-agenda-month {
	color: #fff;
}

/* Removed - Today badge no longer used, highlighted with background color instead */

.voxel-calendar-agenda-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.voxel-calendar-agenda-title {
	font-size: 16px;
	font-weight: 600;
	color: #333;
}

.voxel-calendar-agenda-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 13px;
	color: #666;
}

.voxel-calendar-agenda-day-name {
	font-weight: 600;
}

.voxel-calendar-agenda-time {
	color: #2196f3;
	font-weight: 600;
}

.voxel-calendar-agenda-badge {
	font-size: 11px;
	font-weight: 600;
	background-color: #e0e0e0;
	padding: 4px 8px;
	border-radius: 3px;
}

/* No events message */
.voxel-calendar-no-events {
	padding: 32px;
	text-align: center;
	font-size: 14px;
	color: #999;
	background-color: #f8f9fa;
	border-radius: 4px;
}

/* ========================================
   Responsive Styles
   ======================================== */

/* Tablet */
@media (max-width: 768px) {
	.voxel-calendar-header {
		padding: 15px;
		flex-direction: row;
		flex-wrap: wrap;
		gap: 12px;
		align-items: center;
		justify-content: space-between;
		min-height: auto;
	}

	.voxel-calendar-current-month {
		font-size: 18px;
		order: 1;
		text-align: left;
		flex: 1 1 100%;
	}

	.voxel-calendar-nav {
		order: 2;
		flex: 1 1 auto;
	}

	.voxel-calendar-view-switcher {
		order: 3;
		flex: 0 0 auto;
	}

	.voxel-calendar-nav-button {
		width: 32px;
		height: 32px;
		font-size: 16px;
		min-width: 32px;
		min-height: 32px;
	}

	.voxel-calendar-today {
		font-size: 13px;
		padding: 0 12px;
		min-height: 32px;
	}

	.voxel-calendar-view-button {
		width: 32px;
		height: 32px;
		min-width: 32px;
		min-height: 32px;
		padding: 0;
	}

	.voxel-calendar-view-button svg {
		width: 14px;
		height: 14px;
	}

	.voxel-calendar-day {
		height: 100px;
		padding: 6px;
	}

	.voxel-calendar-day-number {
		font-size: 13px;
	}

	.voxel-calendar-event {
		font-size: 11px;
		padding: 3px 6px;
	}

	.voxel-calendar-day-header {
		font-size: 12px;
		padding: 10px 6px;
	}
}

/* Mobile */
@media (max-width: 480px) {
	.voxel-calendar-header {
		flex-direction: column;
		gap: 10px;
		padding: 12px;
		align-items: center;
		min-height: auto;
	}

	.voxel-calendar-current-month {
		order: 1;
		font-size: 16px;
		text-align: center;
		width: 100%;
	}

	.voxel-calendar-nav {
		order: 2;
		width: 100%;
		justify-content: center;
		gap: 8px;
	}

	.voxel-calendar-nav-button {
		min-width: 36px;
		min-height: 36px;
		flex-shrink: 0;
	}

	.voxel-calendar-today {
		flex: 0 1 auto;
		min-width: fit-content;
		max-width: 100px;
		padding: 0 16px;
		white-space: nowrap;
		overflow: visible;
	}

	.voxel-calendar-view-switcher {
		order: 3;
		justify-content: center;
		margin: 0 auto;
	}

	.voxel-calendar-view-button {
		min-width: 40px;
		min-height: 40px;
		width: 40px;
		height: 40px;
	}

	.voxel-calendar-view-button svg {
		width: 16px;
		height: 16px;
	}

	.voxel-calendar-day {
		height: 80px;
		padding: 4px;
	}

	.voxel-calendar-day-number {
		font-size: 12px;
		padding: 2px 4px;
		margin-bottom: 4px;
	}

	.voxel-calendar-event {
		font-size: 10px;
		padding: 2px 4px;
	}

	.voxel-calendar-day-header {
		font-size: 11px;
		padding: 8px 4px;
	}

	.voxel-calendar-more-events {
		font-size: 10px;
		padding: 2px 4px;
	}
}

/* ========================================
   Loading State
   ======================================== */

.voxel-calendar-container.voxel-calendar-loading::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(255, 255, 255, 0.7);
	z-index: 10;
}

/* ========================================
   Accessibility
   ======================================== */

.voxel-calendar-nav-button:focus-visible {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

.voxel-calendar-event:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -2px;
}

/* ========================================
   Search & Filters
   ======================================== */

.voxel-calendar-search-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	padding: 16px 20px;
	background-color: #f8f9fa;
	border-bottom: 1px solid #e0e0e0;
	align-items: center;
}

.voxel-calendar-search-box {
	flex: 1 1 250px;
	min-width: 200px;
}

.voxel-calendar-search-input {
	width: 100%;
	padding: 10px 14px;
	font-size: 14px;
	line-height: 1.4;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	background-color: #fff;
	transition: border-color 0.2s ease;
}

.voxel-calendar-search-input:focus {
	outline: none;
	border-color: #5c9ded;
	box-shadow: 0 0 0 2px rgba(92, 157, 237, 0.1);
}

.voxel-calendar-search-input::placeholder {
	color: #999;
}

.voxel-calendar-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	flex: 1 1 auto;
}

.voxel-calendar-filter {
	flex: 0 1 auto;
	min-width: 150px;
}

.voxel-calendar-filter-select {
	width: 100%;
	padding: 10px 32px 10px 14px;
	font-size: 14px;
	line-height: 1.4;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 12px;
	appearance: none;
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.voxel-calendar-filter-select:focus {
	outline: none;
	border-color: #5c9ded;
	box-shadow: 0 0 0 2px rgba(92, 157, 237, 0.1);
}

.voxel-calendar-clear-filters {
	padding: 10px 16px;
	font-size: 14px;
	line-height: 1.4;
	border: 1px solid #d0d0d0;
	border-radius: 4px;
	background-color: #fff;
	color: #666;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.voxel-calendar-clear-filters:hover {
	background-color: #f8f9fa;
	border-color: #b0b0b0;
	color: #333;
}

.voxel-calendar-clear-filters:active {
	background-color: #e9ecef;
}

/* Tablet and below */
@media (max-width: 768px) {
	.voxel-calendar-search-filters {
		gap: 10px;
		padding: 12px 16px;
	}

	.voxel-calendar-search-box {
		flex: 1 1 100%;
	}

	.voxel-calendar-filters {
		flex: 1 1 100%;
		gap: 8px;
	}

	.voxel-calendar-filter {
		flex: 1 1 calc(50% - 4px);
		min-width: 0;
	}

	.voxel-calendar-clear-filters {
		width: 100%;
	}
}

/* Mobile */
@media (max-width: 480px) {
	.voxel-calendar-search-filters {
		padding: 12px;
	}

	.voxel-calendar-filter {
		flex: 1 1 100%;
	}
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
	.voxel-calendar-nav,
	.voxel-calendar-search-filters {
		display: none;
	}

	.voxel-calendar-container {
		border: 1px solid #000;
	}

	.voxel-calendar-day {
		break-inside: avoid;
	}

	.voxel-calendar-event {
		background-color: #ddd !important;
		color: #000 !important;
	}
}
