/* gmailtheme — date range filter (js/daterange.js): pill left of mailnav's pager, panel styled like its
   "go to page" dropdown (.mailnav-goto) */

#gm-daterange.gm-dr-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 30px;
	box-sizing: border-box;
	margin-inline: auto 8px;
	padding: 0 10px 0 10px;
	border: 1px solid var(--color-border, #e0e4e9);
	border-radius: 15px;
	color: var(--gm-text-3, #5e5e5e);
	font: 400 12px/16px var(--gm-font, inherit);
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
	flex: none;
}
#gm-daterange .gm-dr-ic {
	width: 16px;
	height: 16px;
	flex: none;
	background: currentColor;
	-webkit-mask: var(--gm-i-calendar_month) center / 16px no-repeat;
	mask: var(--gm-i-calendar_month) center / 16px no-repeat;
}
#gm-daterange::after {
	content: "";
	width: 6px;
	height: 6px;
	margin: -3px 2px 0 2px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
}
#gm-daterange:hover,
#gm-daterange[aria-expanded="true"] { background: var(--color-background-hover, #f1f3f4); }
#gm-daterange:focus-visible { outline: 2px solid var(--y-purple, #7d2eff); outline-offset: 2px; }
/* a filter is on: purple like the app's selected states */
#gm-daterange.gm-dr-on {
	background: var(--y-purple-light, #f1e9ff);
	border-color: transparent;
	color: var(--y-purple-ink, #39007d);
	font-weight: 600;
}
/* the pager no longer needs to push itself right — the pill does */
#gm-daterange + #mailnav-pager { margin-inline-start: 0 !important; }

/* ------------------------------------------------------------------ panel */
.gm-dr-panel {
	position: fixed;
	z-index: 10000;
	box-sizing: border-box;
	padding: 14px;
	border-radius: 12px;
	background: var(--color-main-background, #fff);
	color: var(--color-main-text, #1f1f1f);
	box-shadow: 0 4px 16px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .08);
	font: 400 13px/18px var(--gm-font, inherit);
}
.gm-dr-body { display: flex; gap: 14px; }
.gm-dr-presets {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 132px;
	padding-inline-end: 14px;
	border-inline-end: 1px solid var(--y-line, #e0e4e9);
}
.gm-dr-panel button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	font: inherit;
}
.gm-dr-panel button:focus-visible { outline: 2px solid var(--y-purple, #7d2eff); outline-offset: 1px; }
.gm-dr-panel button.gm-dr-preset {
	height: 32px;
	padding: 0 12px;
	border-radius: 16px;
	font-weight: 500;
	white-space: nowrap;
}
.gm-dr-panel button.gm-dr-preset:hover { background: var(--y-purple-light, #f1e9ff); }
.gm-dr-panel button.gm-dr-preset.is-on {
	background: var(--y-purple-light, #f1e9ff);
	color: var(--y-purple-ink, #39007d);
	font-weight: 700;
}

.gm-dr-cal { width: 252px; }
.gm-dr-head { display: flex; align-items: center; justify-content: space-between; height: 32px; margin-bottom: 6px; }
.gm-dr-panel button.gm-dr-title {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 32px;
	padding: 0 10px 0 12px;
	border-radius: 16px;
	font-weight: 700;
	font-size: 14px;
	white-space: nowrap;
}
.gm-dr-panel button.gm-dr-title:hover { background: var(--gm-hover, #f1f3f4); }
/* caret: points down (drill up to years), up while in the month / year grid (back down) */
.gm-dr-panel button.gm-dr-title::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
}
.gm-dr-panel button.gm-dr-title.is-up::after { margin-top: 3px; transform: rotate(-135deg); }
.gm-dr-panel button.gm-dr-nav {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--gm-text-2, #444);
}
.gm-dr-panel button.gm-dr-nav::before {
	content: "";
	width: 18px;
	height: 18px;
	background: currentColor;
	-webkit-mask: var(--gm-i-chevron_left) center / 18px no-repeat;
	mask: var(--gm-i-chevron_left) center / 18px no-repeat;
}
.gm-dr-panel button.gm-dr-next::before { -webkit-mask-image: var(--gm-i-chevron_right); mask-image: var(--gm-i-chevron_right); }
.gm-dr-panel button.gm-dr-nav:hover:not(:disabled) { background: var(--gm-hover, #f1f3f4); }
.gm-dr-panel button.gm-dr-nav:disabled { opacity: .3; cursor: default; }

.gm-dr-grid { display: grid; grid-template-columns: repeat(7, 36px); row-gap: 2px; min-height: 236px; align-content: start; }
/* month / year grids: 3 × 4 pills in the same box as the days */
.gm-dr-grid--months,
.gm-dr-grid--years { grid-template-columns: repeat(3, 1fr); gap: 10px 8px; padding-top: 8px; }
.gm-dr-panel button.gm-dr-cell {
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 20px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
}
.gm-dr-panel button.gm-dr-cell:hover:not(:disabled) { background: var(--gm-hover, #f1f3f4); }
.gm-dr-panel button.gm-dr-cell.in-range { background: var(--y-purple-light, #f1e9ff); color: var(--y-purple-ink, #39007d); }
.gm-dr-panel button.gm-dr-cell.is-today { box-shadow: inset 0 0 0 1.5px var(--y-purple, #7d2eff); color: var(--y-purple, #7d2eff); font-weight: 700; }
.gm-dr-panel button.gm-dr-cell.is-edge,
.gm-dr-panel button.gm-dr-cell.is-view { background: var(--y-purple, #7d2eff); color: #fff; font-weight: 700; box-shadow: none; }
.gm-dr-panel button.gm-dr-cell:disabled { opacity: .35; cursor: default; }
.gm-dr-wd {
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-text-maxcontrast, #5e5e5e);
	font-size: 11.5px;
	font-weight: 600;
}
.gm-dr-panel button.gm-dr-day {
	position: relative;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-variant-numeric: tabular-nums;
	z-index: 0;
}
/* the day number sits in a 32px circle; the range band is drawn behind it */
.gm-dr-panel button.gm-dr-day::after {
	content: "";
	position: absolute;
	inset: 1px 2px;
	border-radius: 50%;
	z-index: -1;
}
.gm-dr-panel button.gm-dr-day:hover:not(:disabled)::after { background: var(--gm-hover, #f1f3f4); }
.gm-dr-panel button.gm-dr-day.is-today::after { box-shadow: inset 0 0 0 1.5px var(--y-purple, #7d2eff); }
.gm-dr-panel button.gm-dr-day.is-today { color: var(--y-purple, #7d2eff); font-weight: 700; }
.gm-dr-panel button.gm-dr-day.in-range { background: var(--y-purple-light, #f1e9ff); }
.gm-dr-panel button.gm-dr-day.is-start { border-radius: 17px 0 0 17px; }
.gm-dr-panel button.gm-dr-day.is-end { border-radius: 0 17px 17px 0; }
.gm-dr-panel button.gm-dr-day.is-start.is-end { border-radius: 17px; }
.gm-dr-panel button.gm-dr-day.is-start,
.gm-dr-panel button.gm-dr-day.is-end { color: #fff; font-weight: 700; }
.gm-dr-panel button.gm-dr-day.is-start::after,
.gm-dr-panel button.gm-dr-day.is-end::after,
.gm-dr-panel button.gm-dr-day.is-start:hover::after,
.gm-dr-panel button.gm-dr-day.is-end:hover::after { background: var(--y-purple, #7d2eff); box-shadow: none; }
.gm-dr-panel button.gm-dr-day:disabled { color: var(--color-text-maxcontrast, #5e5e5e); opacity: .35; cursor: default; }

.gm-dr-foot {
	display: flex;
	align-items: flex-end;
	gap: 12px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--y-line, #e0e4e9);
}
/* From / To fields (native date inputs: type a date, or their own picker) */
.gm-dr-fields { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; gap: 8px; }
.gm-dr-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gm-dr-field > span { color: var(--color-text-maxcontrast, #5e5e5e); font-size: 11.5px; font-weight: 600; }
.gm-dr-dash { color: var(--color-text-maxcontrast, #5e5e5e); padding-bottom: 8px; }
.gm-dr-panel input.gm-dr-input {
	width: 132px;
	height: 34px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 8px !important;
	border: 1px solid var(--color-border-dark, #c7cbd0) !important;
	border-radius: 8px !important;
	background: var(--color-main-background, #fff) !important;
	color: var(--color-main-text, #1f1f1f) !important;
	font: 500 13px/1 var(--gm-font, inherit) !important;
	font-variant-numeric: tabular-nums;
	box-shadow: none !important;
}
.gm-dr-panel input.gm-dr-input:focus { border-color: var(--y-purple, #7d2eff) !important; box-shadow: inset 0 0 0 1px var(--y-purple, #7d2eff) !important; outline: none; }
.gm-dr-panel input.gm-dr-input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.gm-dr-actions { display: inline-flex; gap: 8px; flex: none; }
.gm-dr-panel button.gm-dr-btn {
	height: 34px;
	padding: 0 16px;
	border-radius: 17px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
}
.gm-dr-panel button.gm-dr-clear { border: 1px solid var(--y-pill-border, #c7cbd0); }
.gm-dr-panel button.gm-dr-clear:hover { background: #f7f7f7; }
.gm-dr-panel button.gm-dr-apply { background: var(--y-purple, #7d2eff); color: #fff; }
.gm-dr-panel button.gm-dr-apply:disabled { opacity: .4; cursor: default; }

@media only screen and (max-width: 600px) {
	.gm-dr-body { flex-direction: column; }
	.gm-dr-presets { flex-direction: row; flex-wrap: wrap; border: 0; padding: 0; }
	.gm-dr-foot { flex-wrap: wrap; }
	.gm-dr-panel input.gm-dr-input { width: 120px; }
}

/* Nextcloud's own `button:disabled` rule (higher specificity than the `all: unset` above) painted future days and the
   disabled month arrow as grey boxes */
.gm-dr-panel button:disabled { background: transparent !important; border-color: transparent !important; }

/* no room in the toolbar row (gmail.js fitListTools): icon only */
#gm-daterange.gm-dr-compact .gm-dr-label { display: none; }
#gm-daterange.gm-dr-compact { padding: 0 8px; }
/* …but a disabled Apply stays a faded purple pill (white text on nothing otherwise) */
.gm-dr-panel button.gm-dr-apply:disabled { background: var(--y-purple, #7d2eff) !important; opacity: .4; }
