/*
 * Personal calendar controls and the Takvimim account section.
 *
 * Built from the shared tokens only, because these controls appear both on the
 * event template and inside the account shell, and the event template's local
 * colour aliases do not exist there.
 *
 * The calendar action deliberately does not look like the save bookmark. The
 * bookmark is a round, icon-only control that fills navy when active; the
 * calendar action is a wide, labelled pill that fills petrol when active. Shape,
 * glyph, label and hue all differ, so the two never read as a pair of bookmarks.
 *
 * Focus rings come from the global :where() rule in base.css and are left alone.
 */

/*
 * Icon sizing.
 *
 * The account template's icon helper prints bare <svg viewBox="0 0 24 24">
 * with no dimensions and no paint, and account.css sizes them through an
 * explicit list of parent selectors. Calendar contexts are not on that list, so
 * without this rule the SVG falls back to the replaced-element default of
 * 300x150 filled solid black. These are the same values that list uses — the
 * icons are joining the existing system, not getting one of their own.
 */
.bgm-calendar-flag svg,
.bgm-calendar-tabs svg,
.bgm-calendar-entry svg {
	width: 1.15rem;
	height: 1.15rem;
	flex: 0 0 auto;
	fill: none;
	stroke: currentcolor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.75;
}

.bgm-calendar-flag svg {
	width: 0.95rem;
	height: 0.95rem;
}

/* ---------------------------------------------------------------- action */

.bgm-calendar-action {
	display: flex;
	flex-wrap: wrap;
	gap: var(--bgm-space-2);
	align-items: center;
}

.bgm-calendar-button {
	display: inline-flex;
	min-height: 3.2rem;
	align-items: center;
	justify-content: center;
	gap: var(--bgm-space-2);
	padding: 0 1.2rem;
	border: var(--bgm-border-width) solid var(--bgm-color-success-hover);
	border-radius: var(--bgm-radius-pill);
	color: var(--bgm-color-success-hover);
	background: transparent;
	font-family: inherit;
	font-size: var(--bgm-text-sm);
	font-weight: var(--bgm-weight-extrabold);
	line-height: 1;
	cursor: pointer;
	transition:
		border-color 180ms ease,
		background-color 180ms ease,
		color 180ms ease;
}

.bgm-calendar-button svg {
	width: 1.15rem;
	height: 1.15rem;
	flex: 0 0 auto;
	fill: none;
	stroke: currentcolor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/*
 * reset.css carries a blanket button:hover/:focus { color: var(--bgm-color-
 * surface) } (near-white) for buttons whose hover state darkens to a filled
 * background — button + :hover outranks the plain .bgm-calendar-button class
 * on specificity, so without a matching override here the "not yet added"
 * hover silently painted near-white text over its own light mint background:
 * unreadable, not just low-contrast. Scoping through the wrapper is enough
 * specificity to win outright, no !important needed.
 */
.bgm-calendar-action .bgm-calendar-button:hover {
	background: var(--bgm-color-success-soft);
	color: var(--bgm-color-success-hover);
}

/*
 * The committed state carries a check glyph and its own label, so its meaning
 * never rests on colour alone.
 */
.bgm-calendar-button[aria-pressed="true"] {
	color: var(--bgm-color-on-primary);
	background: var(--bgm-color-success-hover);
}

.bgm-calendar-button[aria-pressed="true"]:hover {
	color: var(--bgm-color-on-primary);
	background: var(--bgm-color-success-hover);
}

.bgm-calendar-button[disabled] {
	cursor: progress;
	opacity: 0.62;
}

.bgm-calendar-reminder {
	display: inline-flex;
	min-height: 3.2rem;
	align-items: center;
	gap: var(--bgm-space-2);
	padding: 0 1rem;
	border: var(--bgm-border-width) dashed var(--bgm-color-border);
	border-radius: var(--bgm-radius-pill);
	color: var(--bgm-color-text-muted);
	background: transparent;
	font-family: inherit;
	font-size: var(--bgm-text-sm);
	font-weight: var(--bgm-weight-semibold);
	line-height: 1;
	cursor: pointer;
	transition:
		border-color 180ms ease,
		background-color 180ms ease,
		color 180ms ease;
}

/*
 * Same reset.css button:hover trap as .bgm-calendar-button above, but it
 * sets both color AND background (a dark navy fill) on every plain
 * button:hover — leaving only color fixed here still landed dark navy text
 * on that same reset-driven dark navy background. Both have to be reclaimed
 * together.
 */
.bgm-calendar-action .bgm-calendar-reminder:hover {
	border-color: var(--bgm-color-text-muted);
	background: var(--bgm-color-surface);
	color: var(--bgm-color-text);
}

.bgm-calendar-reminder svg {
	width: 1.05rem;
	height: 1.05rem;
	flex: 0 0 auto;
	fill: none;
	stroke: currentcolor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Solid border plus a filled bell separate this from the dashed "off" state. */
.bgm-calendar-reminder[aria-pressed="true"] {
	border-style: solid;
	border-color: var(--bgm-badge-success-text);
	color: var(--bgm-badge-success-text);
	background: var(--bgm-badge-success-bg);
}

.bgm-calendar-reminder[disabled] {
	cursor: progress;
	opacity: 0.62;
}

.bgm-calendar-action__planned {
	flex: 1 0 100%;
	max-width: none;
	margin: 0;
	color: var(--bgm-color-text-muted);
	font-size: var(--bgm-text-sm);
	font-weight: var(--bgm-weight-semibold);
}

.bgm-calendar-action__planned[hidden] {
	display: none;
}

.bgm-calendar-action__status {
	flex: 1 0 100%;
	max-width: none;
	margin: 0;
	color: var(--bgm-color-text-muted);
	font-size: var(--bgm-text-sm);
}

.bgm-calendar-action__status:empty {
	display: none;
}

.bgm-calendar-action__status.is-error {
	color: var(--bgm-color-danger);
}

/* Marks the control the visitor was reaching for before they signed in. */
.bgm-calendar-action.is-resumed .bgm-calendar-button {
	box-shadow: var(--bgm-shadow-focus);
}

@media (max-width: 600px) {
	.bgm-calendar-action {
		width: 100%;
	}

	.bgm-calendar-button,
	.bgm-calendar-reminder {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bgm-calendar-button,
	.bgm-calendar-reminder {
		transition: none;
	}
}

/* ------------------------------------------------- visit day dialog */

/*
 * Shell, backdrop, header and close button all come from the shared .bgm-dialog
 * used by search, saved items and the newsletter. Only the form inside it is
 * described here.
 */
.bgm-dialog.bgm-calendar-dialog {
	width: min(30rem, calc(100% - (2 * var(--bgm-gutter))));
}

.bgm-calendar-dialog .bgm-dialog-header {
	padding: var(--bgm-space-6);
}

.bgm-calendar-dialog .bgm-dialog-header h2 {
	font-size: clamp(1.5rem, 3.5vw, 2rem);
}

.bgm-calendar-dialog__form {
	display: grid;
	gap: var(--bgm-space-3);
	padding: var(--bgm-space-6);
}

.bgm-calendar-dialog__form label {
	color: var(--bgm-color-text);
	font-size: var(--bgm-text-sm);
	font-weight: var(--bgm-weight-semibold);
}

.bgm-calendar-dialog__form input[type="date"] {
	width: 100%;
	min-height: 3.2rem;
	padding: 0 var(--bgm-space-4);
	border: var(--bgm-border-width) solid var(--bgm-input-border);
	border-radius: var(--bgm-input-radius);
	background: var(--bgm-input-bg);
	color: var(--bgm-input-text);
	font-family: inherit;
	font-size: var(--bgm-text-base);
}

.bgm-calendar-dialog__hint {
	max-width: none;
	margin: 0;
	color: var(--bgm-color-text-muted);
	font-size: var(--bgm-text-sm);
}

.bgm-calendar-dialog__error {
	max-width: none;
	margin: 0;
	color: var(--bgm-color-danger);
	font-size: var(--bgm-text-sm);
}

.bgm-calendar-dialog__error:empty {
	display: none;
}

.bgm-calendar-dialog__submit {
	min-height: 3.2rem;
	margin-top: var(--bgm-space-1);
	padding: 0 var(--bgm-space-6);
	border: var(--bgm-border-width) solid var(--bgm-color-success-hover);
	border-radius: var(--bgm-radius-pill);
	background: var(--bgm-color-success-hover);
	color: var(--bgm-color-on-primary);
	font-family: inherit;
	font-size: var(--bgm-text-sm);
	font-weight: var(--bgm-weight-extrabold);
	cursor: pointer;
}

.bgm-calendar-dialog__submit[disabled] {
	cursor: progress;
	opacity: 0.62;
}

/* ------------------------------------------------------------- Takvimim */

.bgm-calendar-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--bgm-space-2);
	margin-bottom: var(--bgm-space-6);
}

.bgm-calendar-tabs a {
	display: inline-flex;
	min-height: 2.75rem;
	align-items: center;
	gap: var(--bgm-space-2);
	padding: 0 1rem;
	border: var(--bgm-border-width) solid var(--bgm-color-border);
	border-radius: var(--bgm-radius-pill);
	color: var(--bgm-color-text);
	background: var(--bgm-color-surface);
	font-size: var(--bgm-text-sm);
	font-weight: var(--bgm-weight-semibold);
	text-decoration: none;
}

.bgm-calendar-tabs a[aria-current="page"] {
	border-color: var(--bgm-color-primary);
	color: var(--bgm-color-on-primary);
	background: var(--bgm-color-primary);
}

.bgm-calendar-tabs a span {
	font-size: var(--bgm-text-xs);
	opacity: 0.78;
}

.bgm-calendar-list {
	display: grid;
	gap: var(--bgm-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bgm-calendar-entry {
	display: grid;
	grid-template-columns: 4.5rem minmax(0, 1fr) auto;
	gap: var(--bgm-space-4);
	align-items: start;
	padding: var(--bgm-space-4);
	border: var(--bgm-border-width) solid var(--bgm-color-border);
	border-radius: var(--bgm-radius-lg);
	background: var(--bgm-color-surface);
	box-shadow: var(--bgm-shadow-soft);
}

.bgm-calendar-entry.is-past {
	background: transparent;
	box-shadow: none;
}

.bgm-calendar-entry__date {
	display: grid;
	gap: 0.15rem;
	padding: var(--bgm-space-2) 0;
	border-radius: var(--bgm-radius-card-sm);
	background: var(--bgm-color-bg);
	text-align: center;
}

.bgm-calendar-entry__date strong {
	font-family: var(--bgm-font-heading);
	font-size: var(--bgm-text-xl);
	line-height: 1;
}

.bgm-calendar-entry__date span {
	font-size: var(--bgm-text-2xs);
	font-weight: var(--bgm-weight-semibold);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.bgm-calendar-entry__body {
	display: grid;
	gap: 0.35rem;
	min-width: 0;
}

.bgm-calendar-entry__body h3 {
	margin: 0;
	font-size: var(--bgm-text-lg);
	line-height: 1.35;
}

.bgm-calendar-entry__body h3 a {
	color: inherit;
	text-decoration: none;
}

.bgm-calendar-entry__meta {
	max-width: none;
	margin: 0;
	color: var(--bgm-color-text-muted);
	font-size: var(--bgm-text-sm);
}

.bgm-calendar-entry__flags {
	display: flex;
	flex-wrap: wrap;
	gap: var(--bgm-space-2);
	margin-top: var(--bgm-space-1);
}

.bgm-calendar-flag {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.2rem 0.6rem;
	border-radius: var(--bgm-radius-pill);
	background: var(--bgm-badge-success-bg);
	color: var(--bgm-badge-success-text);
	font-size: var(--bgm-text-xs);
	font-weight: var(--bgm-weight-semibold);
}

.bgm-calendar-flag.is-muted {
	background: var(--bgm-color-bg);
	color: var(--bgm-color-text-muted);
}

.bgm-calendar-entry__replan {
	display: flex;
	flex-wrap: wrap;
	gap: var(--bgm-space-2);
	align-items: center;
	margin-top: var(--bgm-space-2);
}

.bgm-calendar-entry__replan label {
	color: var(--bgm-color-text-muted);
	font-size: var(--bgm-text-xs);
	font-weight: var(--bgm-weight-semibold);
}

.bgm-calendar-entry__replan input[type="date"] {
	min-height: 2.75rem;
	padding: 0 var(--bgm-space-3);
	border: var(--bgm-border-width) solid var(--bgm-input-border);
	border-radius: var(--bgm-input-radius);
	background: var(--bgm-input-bg);
	color: var(--bgm-input-text);
	font-family: inherit;
	font-size: var(--bgm-text-sm);
}

.bgm-calendar-entry__replan button {
	min-height: 2.75rem;
	padding: 0 var(--bgm-space-4);
	border: var(--bgm-border-width) solid var(--bgm-color-border);
	border-radius: var(--bgm-radius-pill);
	background: var(--bgm-color-surface);
	color: var(--bgm-color-text);
	font-family: inherit;
	font-size: var(--bgm-text-sm);
	font-weight: var(--bgm-weight-semibold);
	cursor: pointer;
}

.bgm-calendar-entry__actions {
	display: grid;
	gap: var(--bgm-space-2);
	justify-items: stretch;
}

.bgm-calendar-entry__actions form {
	display: contents;
}

.bgm-calendar-entry__actions button,
.bgm-calendar-entry__actions .bgm-calendar-detail {
	display: inline-flex;
	min-height: 2.75rem;
	align-items: center;
	justify-content: center;
	gap: var(--bgm-space-2);
	padding: 0 0.9rem;
	border: var(--bgm-border-width) solid var(--bgm-color-border);
	border-radius: var(--bgm-radius-pill);
	color: var(--bgm-color-text);
	background: var(--bgm-color-surface);
	font-family: inherit;
	font-size: var(--bgm-text-sm);
	font-weight: var(--bgm-weight-semibold);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

.bgm-calendar-entry__actions .bgm-calendar-remove {
	border-color: transparent;
	color: var(--bgm-color-danger);
	background: transparent;
}

@media (max-width: 820px) {
	.bgm-calendar-entry {
		grid-template-columns: 3.75rem minmax(0, 1fr);
	}

	.bgm-calendar-entry__actions {
		grid-column: 1 / -1;
		grid-auto-flow: column;
		justify-content: start;
	}
}

/*
 * Three nowrap labels side by side stop fitting well before the narrowest
 * viewport, and the account shell narrows the content column further, so they
 * stack early rather than pushing the page sideways.
 */
@media (max-width: 640px) {
	.bgm-calendar-entry__actions {
		grid-auto-flow: row;
	}

	.bgm-calendar-entry__actions button,
	.bgm-calendar-entry__actions .bgm-calendar-detail {
		white-space: normal;
	}
}

/*
 * Shared "sign in to continue" dialog — opened by Etkinliğe Katıl, Bekleme
 * Listesine Katıl and Takvimime Ekle instead of any of them navigating a
 * guest away. Lives here rather than in meetup.css because a plain event
 * page (no join/waitlist, calendar only) needs it too, and this stylesheet
 * is the one both templates already load. Reuses the shared .bgm-dialog
 * shell and the newsletter popup's enter/exit transition and close timing
 * verbatim, so it feels like the same product rather than a bolted-on
 * alert box.
 */
.bgm-dialog.bgm-auth-dialog {
	width: min(27rem, calc(100% - (2 * var(--bgm-gutter-mobile))));
	opacity: 0;
	transform: translateY(0.875rem) scale(0.98);
	transition: opacity var(--bgm-duration-normal) var(--bgm-ease-out), transform var(--bgm-duration-normal) var(--bgm-ease-out);
}

.bgm-dialog.bgm-auth-dialog.is-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.bgm-auth-dialog::backdrop {
	background: rgb(var(--bgm-navy-rgb) / 0.42);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity var(--bgm-duration-normal) var(--bgm-ease-out);
}

.bgm-auth-dialog.is-visible::backdrop {
	opacity: 1;
}

.bgm-auth-dialog .bgm-dialog-header {
	align-items: center;
}

.bgm-auth-dialog__mark {
	display: grid;
	width: 2.75rem;
	height: 2.75rem;
	margin-bottom: var(--bgm-space-3);
	border-radius: var(--bgm-radius-round);
	background: var(--bgm-leaf-100);
	color: var(--bgm-color-primary);
	place-items: center;
}

.bgm-auth-dialog__mark svg {
	width: 1.15rem;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.7;
}

.bgm-auth-dialog__body {
	display: grid;
	gap: var(--bgm-space-5);
	padding: var(--bgm-space-8);
}

.bgm-auth-dialog__body > p:first-child {
	margin: 0;
	color: var(--bgm-color-text-muted);
	font-size: var(--bgm-text-sm);
	line-height: var(--bgm-leading-body);
}

.bgm-auth-dialog__actions {
	display: grid;
	gap: var(--bgm-space-3);
}

.bgm-auth-dialog__cta {
	display: inline-flex;
	min-height: 3rem;
	align-items: center;
	justify-content: center;
	border-radius: var(--bgm-radius-pill);
	font-family: inherit;
	font-size: var(--bgm-text-sm);
	font-weight: var(--bgm-weight-extrabold);
	text-decoration: none;
	transition: background var(--bgm-duration-fast) var(--bgm-ease-out), color var(--bgm-duration-fast) var(--bgm-ease-out), border-color var(--bgm-duration-fast) var(--bgm-ease-out), transform var(--bgm-duration-fast) var(--bgm-ease-out);
}

.bgm-auth-dialog__cta--primary {
	border: 0;
	background: var(--bgm-color-primary);
	color: var(--bgm-color-surface);
}

.bgm-auth-dialog__cta--primary:hover,
.bgm-auth-dialog__cta--primary:focus-visible {
	background: var(--bgm-color-primary-hover);
	color: var(--bgm-color-surface);
	transform: translateY(-1px);
}

.bgm-auth-dialog__cta--quiet {
	border: var(--bgm-border-width) solid var(--bgm-color-border);
	background: transparent;
	color: var(--bgm-color-text);
}

.bgm-auth-dialog__cta--quiet:hover,
.bgm-auth-dialog__cta--quiet:focus-visible {
	border-color: var(--bgm-color-primary);
	background: var(--bgm-leaf-100);
	color: var(--bgm-color-primary);
	transform: translateY(-1px);
}

.bgm-auth-dialog__microcopy {
	margin: 0;
	color: var(--bgm-color-text-soft);
	font-size: var(--bgm-text-2xs);
	text-align: center;
}

@media (min-width: 480px) {
	.bgm-auth-dialog__actions {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 767px) {
	.bgm-dialog.bgm-auth-dialog {
		width: calc(100% - 2rem);
		margin-inline: auto;
	}

	.bgm-auth-dialog .bgm-dialog-header,
	.bgm-auth-dialog__body {
		padding: var(--bgm-space-6);
	}

	.bgm-auth-dialog__actions {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bgm-dialog.bgm-auth-dialog,
	.bgm-auth-dialog::backdrop {
		transform: none;
	}
}
