/* Make main content area independent scrollable */
/* html, body {
	height: 100vh;
	overflow: hidden;
}
main {
	height: calc(100vh - 60px);
	overflow-y: auto;
} */

wa-breadcrumb {
	background-color: hsl(48 94% 87% / 1);
    border-radius: 8px;
    padding-left: var(--wa-space-s);
	border: 1px solid hsl(48 94% 57% / 1);
	font-size: var(--wa-font-size-s);

	& input {
		font-size: var(--wa-font-size-m);
		border: none;
		border-left: 1px solid hsl(48 94% 57% / 1);
		border-top-left-radius: 0;
		border-bottom-left-radius: 0;
	}
}

/* Django form errors */
form ul.errorlist {
	list-style: none;
	padding: 1em;
	border-style: var(--wa-panel-border-style);
  	border-width: var(--wa-panel-border-width);
	border-color: var(--wa-color-danger-border-quiet);
	background-color: var(--wa-color-danger-fill-quiet);
	border-radius: var(--wa-panel-border-radius);
	font-size: var(--wa-font-size-s);
}
form ul.errorlist > li {
	margin: 0;
}

header {
	/* background-color: var(--wa-color-yellow-90); */
	background-color: var(--titlebar-color);
	box-shadow: var(--wa-shadow-s);
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	padding: var(--wa-space-xs);
	align-items: center;

	/* Keep the header bar at the top always */
	position: sticky;
    top: 0;
    z-index: 20; /* .prose-menu-bar has a z-index of 10 */
}
header h1 {
	/* font-size: var(--wa-font-size-l); */
	margin: 0;
	font-size: var(--wa-font-size-m);
    font-weight: 600;
    font-weight: var(--wa-font-weight-semibold);
}
header wa-dropdown a {
	text-decoration: none;
}

header .action-buttons {
	display: flex;
    gap: var(--wa-space-xs);
}
header .action-buttons wa-radio-group {
	display: inline-flex;
}

#menu-item-logged-in-text {
	background-color: var(--wa-color-gray-95);
	padding: var(--wa-space-2xs) var(--wa-space-m);
	margin: 2px -4px -4px -4px;
	border-bottom-left-radius: var(--wa-border-radius-s);
	border-bottom-right-radius: var(--wa-border-radius-s);
}

#logout-menu-item::part(prefix) {
	align-items: flex-start;
	margin-top: 6px;
}

body {
	background-color: var(--main-background);
}
main {
	padding: var(--wa-space-2xl) var(--wa-space-l);
}


.full-screen-dialog-box {
	min-height: 100%;
    overflow: auto;
    background-color: var(--main-background);
	--scroller-padding-top: var(--wa-space-xl); /* Used by the sticky prose toolbar */
    padding: var(--scroller-padding-top) var(--wa-space-xl) var(--wa-space-xl);
}

/* Set both the dialog box, and it's container to full screen (100%)
We use a container (.dialog-content) because we want to display using flex, and putting display:flex on the dialog interrupts the native show/hide behaviour */
.full-screen-dialog-box,
.full-screen-dialog-box > .dialog-content {
	width: 100%;
	max-width: 100%;
	border-radius: 0;
	max-height: 100%;
	margin: auto;
}
/* Use display:flex for the dialog (container) and set background.
z-index is used so the prose editor toolbars are displayed correctly */
.full-screen-dialog-box > .dialog-content {
	display: flex;
	flex-direction: column;
	gap: var(--wa-space-l);
	align-items: center;
	z-index: 10;
}
.dialog-box-form-container {
	width: 100%;
	max-width: 400px;
	display: flex;
	flex-direction: column;
	gap: var(--wa-space-l);
}
.dialog-box-footer {
	margin-top: var(--wa-space-s);
}
.full-screen-dialog-x-button {
	position: fixed;
    right: var(--wa-space-l);
	top: var(--wa-space-s);
	z-index: 10;
}
.full-screen-dialog-box form {
	display: flex;
    flex-direction: column;
	gap: var(--wa-space-m);
}
label ~ .prose-editor {
	margin-block-start: 0.5em;
}

/* These styles are intended for wa-button[variant="neutral"][appearance="outlined"] */
.filled-white::part(base) {
	/* background-color: var(--wa-color-neutral-95); */
	background-color: #FAFAFA;
	border-color: var(--wa-color-neutral-80);
}
.filled-white:hover::part(base) {
	background-color: var(--wa-color-neutral-90);
}

.doc-editor {
	width: 100%;
	/* max-width: 700px; */
}

main .prose-menubar:not(:empty), 
dialog .prose-menubar:not(:empty)  {
	background: none;
	box-shadow: none;
	border: none;
	padding: 0;

	/* The toolbar is drawn above the editor without taking up space: the menubar has no height and is shifted up with `transform`.
	It's sticky so it stays in view when a long field is scrolled. Pages scroll inside #main-wrapper (below the header), so `top` is measured from the header's bottom edge.
	`top` includes the shift so the stuck toolbar sits flush against the header (or the top of a dialog), -1px so its top border is hidden.
	Sticky `top` is measured from inside the scroll container's padding, so it's subtracted. Scroll containers (#main-wrapper, dialogs) set --scroller-padding-top. */
	--prose-toolbar-shift: 52px;
	position: sticky;
	top: calc(-1px - var(--scroller-padding-top, 0px) + var(--prose-toolbar-shift));
	height: 0;
	transform: translateY(calc(-1 * var(--prose-toolbar-shift)));
	align-items: flex-start; /* Not stretch, which would squash the toolbar to the menubar's zero height */
    justify-content: center;
    width: 100%;
}

.prose-editor .prose-menubar {
	display: none !important;
}
/* .prose-editor:focus-within .prose-menubar {
	display: inline-flex !important;
} */
.prosemirror-has-focus .prose-menubar {
	/* This uses AlpineJS to add/remove the show-menu class
	 * See base/shared/alpine-pmeditor-focus.html 
	 * Not inline-flex: an inline menubar sits in a line box, which takes up space (pushing the editor down) even though the menubar has no height
	 */
	display: flex !important;
}

form .prose-editor .ProseMirror {
	padding: var(--wa-space-xs) var(--wa-form-control-padding-inline);
	color: var(--wa-form-control-value-color);
	font-size: var(--wa-form-control-value-size);
	font-family: inherit;
	font-weight: var(--wa-form-control-value-font-weight);
	line-height: var(--wa-form-control-value-line-height);
	background-color: var(--wa-form-control-background-color);
	border-color: var(--wa-form-control-border-color);
	border-style: var(--wa-form-control-border-style);
	border-width: var(--wa-form-control-border-width);
	border-radius: var(--wa-form-control-border-radius);

	/* &:focus-visible {
		outline: var(--wa-focus-ring);
		outline-offset: var(--wa-focus-ring-offset);
	} */
}
.prose-editor .ProseMirror {
	/* django-prose-editor adds a black 2px outline to the editor when it has focus. This removes that default styling. */
	outline: none;
}
.prosemirror-has-focus .prose-editor .ProseMirror {
	/* Adds a WebAwesome-like focus style */
	outline: var(--wa-focus-ring);
	outline-offset: var(--wa-focus-ring-offset);
}

wa-radio-group > wa-radio:first-of-type {
	border-top-left-radius: 50px;
	border-bottom-left-radius: 50px;
}
wa-radio-group > wa-radio:last-of-type {
	border-top-right-radius: 50px;
	border-bottom-right-radius: 50px;
}

.field.error-text {
	font-size: var(--wa-font-size-xs);
	color: var(--wa-color-danger-40);
}

wa-button.icon-delete-button:not(.disabled):not(.loading):hover::part(base) {
	color: var(--wa-color-danger-on-quiet);
	background-color: var(--wa-color-danger-fill-quiet);
}
wa-button.icon-delete-button {
	box-shadow: none;
}

.wa-button-spacer {
	/* This is for things like the sidebar prompts panel where we want the heading to be in the same place as the other tabs even though it doesn't have a button taking up space. This solution seemed easier than using positioning. */
	display: inline-block;
    height: 43px;
    width: 43px;
}

.dialog-box-footer > button {
	width: 6rem;
}

.beginner-help {
	color: var(--wa-color-text-quiet);
}

.icon {
	border-radius: 0;
}
h2 .icon { width: var(--wa-font-size-l); }


/* Loading spinner for buttons. 
 * Always hide unless there is a htmx-request happening (denoted by a class added by htmx to the body element).
 */
button wa-spinner.htmx-indicator { 
	display: none;
	width: 0;
	margin-top: -6px; /* wa-spinners need a nudge up for some reason 🤷 */
}
.delayed.htmx-request button wa-spinner.htmx-indicator {
	display: inline-block;
	width: auto;
}

body:has(.delayed.htmx-request) {
    cursor: wait;
}


/* @view-transition {
navigation: auto;
}
::view-transition-group(*) {
animation-duration: 0.3s;
}*/