/*
 * Copyright (C) 2026 Fluxer Contributors
 *
 * This file is part of Fluxer.
 *
 * Fluxer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Fluxer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
 */

.fieldset {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.labelContainer {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.label {
	font-weight: 500;
	font-size: 0.875rem;
	line-height: 1.25rem;
	color: var(--text-primary);
}

.inputContainer {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}

.inputWrapper {
	display: inline-flex;
	height: 2.75rem;
	overflow: hidden;
	border-radius: 0.5rem;
	border: 1px solid var(--background-modifier-accent);
	transition-property: color, background-color, border-color;
	transition-duration: 150ms;
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.inputWrapper:focus-within {
	border-color: var(--background-modifier-accent-focus);
}

.input {
	height: 100%;
	width: 100%;
	min-width: 0;
	flex: 1 1 0%;
	appearance: none;
	border: none;
	background-color: transparent;
	padding: 0.625rem 1rem;
	font-size: 0.875rem;
	line-height: 1.25rem;
	outline: none;
	color: var(--text-primary);
}

.input::placeholder {
	color: var(--text-primary-muted);
}

.input:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.divider {
	height: auto;
	width: 1px;
	background-color: var(--background-modifier-accent);
}

.calendarButton {
	position: relative;
	display: flex;
	height: 100%;
	width: 3rem;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	color: var(--text-tertiary);
	transition: color 150ms ease;
}

.calendarButton:enabled {
	cursor: pointer;
}

.calendarButton:enabled:hover {
	color: var(--text-primary);
}

.calendarButton:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.description {
	color: var(--text-primary-muted);
	font-size: 0.75rem;
	line-height: 1rem;
}

.errorText {
	color: var(--status-danger);
	font-size: 0.75rem;
	line-height: 1rem;
}

.popover {
	z-index: 20000;
	outline: none;
}

.popover[data-entering] {
	animation: popover-enter 150ms ease-out;
}

.popover[data-exiting] {
	animation: popover-exit 100ms ease-in;
}

@keyframes popover-enter {
	from {
		opacity: 0;
		transform: scale(0.95);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes popover-exit {
	from {
		opacity: 1;
		transform: scale(1);
	}
	to {
		opacity: 0;
		transform: scale(0.95);
	}
}

.dialog {
	outline: none;
}

.calendarContainer {
	background-color: var(--background-primary);
	border: 1px solid var(--background-modifier-accent);
	border-radius: 0.5rem;
	padding: 0.75rem;
	box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
}

/* react-day-picker classNames */

.rdpRoot {
	--rdp-day-size: 2.25rem;
}

.rdpMonths {
	position: relative;
}

.rdpMonth {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.rdpNav {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 2.25rem;
	padding: 0 0.25rem;
	pointer-events: none;
}

.rdpMonthCaption {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 2.25rem;
}

.rdpCaptionLabel {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--text-primary);
}

.rdpButtonPrevious,
.rdpButtonNext {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: var(--radius-md);
	color: var(--text-tertiary);
	cursor: pointer;
	transition:
		background-color 150ms ease,
		color 150ms ease;
	pointer-events: auto;
}

.rdpButtonPrevious:hover,
.rdpButtonNext:hover {
	background-color: var(--background-modifier-hover);
	color: var(--text-primary);
}

.rdpButtonPrevious[aria-disabled='true'],
.rdpButtonNext[aria-disabled='true'] {
	opacity: 0.3;
	cursor: not-allowed;
	pointer-events: none;
}

.rdpChevron {
	width: 1rem;
	height: 1rem;
	fill: currentColor;
}

.rdpMonthGrid {
	border-collapse: collapse;
	border-spacing: 0;
}

.rdpWeekday {
	width: var(--rdp-day-size);
	height: 1.75rem;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--text-primary-muted);
	text-align: center;
	vertical-align: middle;
	padding: 0;
}

.rdpDay {
	width: var(--rdp-day-size);
	height: var(--rdp-day-size);
	text-align: center;
	vertical-align: middle;
	padding: 0;
}

.rdpDayButton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--rdp-day-size) - 4px);
	height: calc(var(--rdp-day-size) - 4px);
	border-radius: var(--radius-md);
	font-size: 0.8125rem;
	color: var(--text-primary);
	cursor: pointer;
	transition: background-color 150ms ease;
}

.rdpDayButton:hover {
	background-color: var(--background-modifier-hover);
}

.rdpToday .rdpDayButton {
	font-weight: 700;
	text-decoration: underline;
	text-decoration-color: var(--brand-primary);
	text-underline-offset: 3px;
}

.rdpSelected .rdpDayButton {
	background-color: var(--brand-primary);
	color: #fff;
	font-weight: 600;
}

.rdpSelected .rdpDayButton:hover {
	background-color: var(--brand-primary);
	opacity: 0.9;
}

.rdpOutside .rdpDayButton {
	color: var(--text-primary-muted);
	opacity: 0.4;
}

.rdpDisabled .rdpDayButton {
	opacity: 0.25;
	cursor: not-allowed;
}

.rdpHidden {
	visibility: hidden;
}

/* Time input row */

.timeRow {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding-top: 0.625rem;
	margin-top: 0.5rem;
	border-top: 1px solid var(--background-modifier-accent);
}

.timeLabel {
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--text-primary-muted);
	flex-shrink: 0;
}

.timeInput {
	flex: 1;
	appearance: none;
	border: 1px solid var(--background-modifier-accent);
	border-radius: var(--radius-md);
	background-color: var(--background-secondary);
	color: var(--text-primary);
	font-size: 0.8125rem;
	padding: 0.3125rem 0.5rem;
	outline: none;
	font-family: inherit;
	transition: border-color 150ms ease;
}

.timeInput::-webkit-calendar-picker-indicator {
	display: none;
}
