
/* xd-docs */

body.user-unauthenticated .xd-hide-unauth { display: none !important; }

#xd-docs-main {
	max-width: 30em; margin: 0 auto; padding-top: 2em;
}

#xd-fayt-result {
	position: absolute; z-index: 5;
	display: grid; grid: auto-flow / auto auto; gap: 2px 1px; margin-top: 3px;
	max-width: 90vw; max-height: 50vh; overflow: auto; font-size: .875rem;
	background: #ddd; border: none 1px #aaa; border-radius: 5px; box-shadow: 1px 1px 6px 0 #555;
	&:empty { display: none; }
	& > button {
		display: block; white-space: nowrap; background: white; border: none; border-radius: 0;
		&.xd-doctype-doc::after { content:'doc'; float: right; text-align: center; width: 30px; background: lightblue; border-radius: 3px; }
		&.xd-doctype-wb::after { content:'she'; float: right; text-align: center; width: 30px; background: lightgreen; border-radius: 3px; }
	}
	& > button[name="doc_button"] { text-align: left; min-width: 15em; }
	& > button[name="doc_opts_button"] {
		&::after { content: '\22EE'; }
	}
	& > button:focus { box-shadow: none; background: lightblue; }
}

#xd-docs-create-button { height: 2.5em; }

#xd-doc-props-dialog {
	z-index: 1; margin: 12em auto;
/*	&:not([data-cur-doc-id="0"]) > #xd-select-doctype { display:none; }*/
	& > div {
		margin-bottom: .5em;
		& > input { width: 100%; }
	}
	&[data-cur-doc-id="0"] .xd-hide-at-create { display:none; }
}

#xd-document-type-select { width: 100% }

#xd-document-owner { display: block; }

/*#xd-document-groups { margin: 8px 0; }*/
#xd-doc-groups-table {
	width: 100%; border-collapse: collapse; margin: 1em 0 4px; font-size: 80%;
	& > * > tr {
		border: solid 1px #777;
/*		& > th { color: #777; }*/
		& > * { padding: 0 5px; }
		& > *:first-child {
			border-right: solid 1px #777;
			& > button { text-decoration: underline; }
		}
	}
	& button { height: auto; padding: 0; line-height: 2; border: none; background: none; }
	& input { margin: 0; }
}
/*#xd-create-group-button { margin: 3px 0; }*/

#xd-group-dialog {
	z-index: 1; margin: 14em auto;
/*	& > h2 + div {
		display: flex; flex-flow: row wrap; gap: 8px; max-width: 25em;
		& > div { flex: 0 min-content; display: flex; flex-flow: row wrap; align-content: flex-start; gap: 2px; }
	}*/
	& button[value="add_members"] { float: left; }

	&[data-my-group-role="0"] button[value="add_members"],
	&:not([data-my-group-role="2"]) button[value="delete_group"],
	[data-group-id="0"] button[value="delete_group"] { display: none; }
}
#xd-group-name { display: block; width: 14em; }

#xd-group-member-div { height: 12em; max-height: 50vh; overflow: auto; border: solid 1px #777; }
#xd-group-member-table {
	width: max-content; font-size: 80%;
	& > thead {
		position: sticky; top: 0; background: #dfdedd;
		&::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: #777; }
	}
	& > * > tr {
		border-bottom: solid 1px #777;
		& > * { padding: 4px 8px; }
		& > *:first-child { border-right: solid 1px #777; }
		& > *:last-child { border-left: solid 1px #777; }
		& > :nth-child(n+2):nth-child(-n+5) { width: 5em; text-align: center; }
	}
/*	& > tbody > tr:last-child { border-bottom: none; }*/
}


/*********************************************************************************/
/* xish-sheets */

#xd-workbook-html {
	height: 100%; overscroll-behavior-y: contain;
	body { height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: white; }
	header {
		display: grid; grid: auto auto / 13rem 1fr; font-family: monospace; border-bottom: solid 1px #aaa;
		& > div {
			display: flex; align-items: baseline;
			& > span { padding: 0 4px; }
		}
	}
	main { position: relative; overflow: auto scroll; }
	footer { border-top: solid 1px #aaa; }
}
#xish-doc-name { height: auto; font-size: 110%; border: 1px #ccc; background: hsl(120 50 80); border-style: none none solid none; }
#xish-cell-input {
	height: 3.2rem; min-height: 1.6rem; line-height: 1.5; padding-top: 3px; resize: vertical; border: 1px #ccc; border-style: none none solid solid;
	&:focus { outline: solid 2px red; outline-offset: -2px; box-shadow: none; }
	&.zoom:focus { position: absolute; left: 0; right: 0; height: 30vh; z-index: 10; }
}

#xish-cell-name-input { width: 100%; height: auto; line-height: 2; padding: 0 3px; border: none; }
#xish-cell-value-div {
	height: 1.6rem; min-height: 1.6rem; resize: vertical; overflow: hidden auto; word-break: break-word; text-overflow: ellipsis;
	padding: 0 5px; line-height: 1.5; padding-top: 3px; border-left: solid 1px #ccc;
/*	&:empty { display: none; }*/
}
#xish-sheet-tabs > button {
	background: none; border-style: none solid none none;
	&.xish-active-sheet { background: hsl(200 50 80); }
}

#xish-sheet-root {
	display: grid; grid-auto-rows: minmax(21px, auto); width: max-content; line-height: 1; font-size: .875rem; /*background: hsl(240 100 50);*/ user-select: none;
	& > button {
		/*width: 100%;*/
		height: 100%; overflow: hidden; line-height: 1; padding: 0 3px; text-align: left; background: white; white-space: nowrap;
		border: 1px #ddd; border-style: none solid solid none; border-radius: 0;

		&:first-child { z-index: 4; position: sticky; left: 0; top: 0; text-align: center; background: #e8e8e8; border-color: #aaa; }
		&.xish-sheet-row { z-index: 1; position: sticky; left: 0; text-align: center; background: #e8e8e8; border-color: #aaa; }
		&.xish-frozen-columns { position: sticky; z-index: 1; }
		&.xish-sheet-column { z-index: 2; position: sticky; top: 0; text-align: center; background: #e8e8e8; border-color: #aaa; }
		&.xish-sheet-column.xish-frozen-columns { z-index: 3; }
		&.xish-frozen-columns-boundry { border-right-width: 2px; border-right-color: #999; }

		&.xish-number { text-align: right; }

		&.xish-v-align-top { display: flex; flex-direction: column; white-space: pre-wrap; justify-content: flex-start; }
		&.xish-v-align-middle { display: flex; flex-direction: column; white-space: pre-wrap; justify-content: center; }
		&.xish-v-align-bottom { display: flex; flex-direction: column; white-space: pre-wrap; justify-content: flex-end; }

		&.xish-h-align-left { text-align: left; }
		&.xish-h-align-center { text-align: center; }
		&.xish-h-align-right { text-align: right; }

		&.xish-selected-cell {
			background: hsl(240 80 94) !important; /*	opacity: .8;*/
/*			position: relative !important; left: auto !important; top: auto !important;
			&::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: hsl(240 100 75 / .3); }*/
		}
		&.xish-selection-start-cell { background: #7f7 !important; }

		&:focus { box-shadow: none; }
		&.xish-focused-cell { outline: solid 2px hsl(240 100 70); outline-offset: -2px; }
		&.xish-focused-heading { background: hsl(240 80 90); }

/*		&[value]::before { position: absolute; height: 8px; width: attr(data-bar-h px); }*/
	}
}


.xish-font-family-serif { font-family: serif; }
.xish-font-family-sans { font-family: sans-serif; }
.xish-font-family-mono { font-family: monospace; }
.xish-font-family-cursive { font-family: cursive; }
.xish-font-family-fantasy { font-family: fantasy; }



/*********************************************************************************/
/* xd-document */

#xd-document-html {
	height: 100%; overscroll-behavior-y: contain;
	body { height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: white; /*font-size: .875rem;*/ }
	header {
		display: flex; flex-flow: row wrap; gap: 4px 1px; background: hsl(120 4 75); font-family: monospace; border-bottom: solid 2px #999;
		#xd-doc-name { width: 12em; height: auto; background: hsl(120 50 80); border: none; border-radius: 0; }
		#xd-doc-position { width: 8em; align-self: center; text-align: center; /*padding: 0 1em;*/ border: none; border-radius: 0; }
		#xd-caret-path {
			margin-right: 1em; min-width: 10em; padding: 0 8px; background: white;
			& > button {
				&::before { display: inline-block; content: '/'; padding-right: 5px; text-decoration: none; }
				margin: 0; padding: 0; padding-right: 5px; background: none; border: none; border-radius: 0; text-decoration: underline;
				&.xd-selected-caret-path-segment { font-weight: bold; }
			}
		}
		#xd-new-elements-toolbox-div {
			position: relative;
			& > button { margin-right: 1em; }
			& > div {
				position: absolute; width: max-content; margin: 3px 0; z-index: 1; border: solid 1px #000; border-radius: .5em;
				& > button { display: block; width: 100%; text-align: left; }
			}
		}
	}
	main {
		display: flex; overflow: hidden;
		#xd-main-left { flex: 1; background: gray; }
		#xd-main-center { position: relative; overflow: auto scroll; background: #ccc; border: 1px #aaa; border-style: none solid; }
		#xd-main-right { flex: 1; background: gray; }
		.xd-cur-element { outline: solid 1px blue; outline-offset: 1px; }
	}
	footer { display: flex; justify-content: space-between; border-top: solid 1px #aaa; }
}

#xd-element-tools {
	display: flex; flex-flow: row wrap; gap: 2px;
	& > select { max-width: 14em; }

	#xd-e-set-break-button { margin-right: 1em; }
	#xd-e-set-break-div {
		position: absolute; z-index: 1; margin: 3em auto; left: 0; right: 0; width: max-content;
		& > select { display: block; width: 100%; }
	}
}

#xd-classes-select {
	position: relative; margin-right: 1em; padding: 0 0 0 4px; text-align: left;
	& > div { visibility: hidden; display: inline-block; margin: 0 5px; padding: 0 3px; line-height: 1; background: hsl(210 100 75); border-radius: 8px; }
	&.xd-classes-select-checkmark > div { visibility: visible; }

	&::after { display: inline-block; vertical-align: middle; width: 16px; height: 16px; content: ''; background: url(/static/pics/svgrepo-com-dropdown-arrow.svg) center center / 100% no-repeat; }
	&.xd-e-select-open { border-style: inset; }
}
#xd-e-classes-ul { /* drop-down select classes */
	position: absolute; z-index: 1; display: grid; grid: auto-flow / repeat(3, 10em); align-items: center; gap: 6px; left: 0; top: 2.5em; padding: 3px; white-space: normal;
	background: lightgray; border: solid 1px black;
	& > li {
		position: relative; background: white; overflow: hidden;
		& > div { position: relative; height: 4em; cursor: pointer; }
	}
}
.xd-classes-checkmark::before {
	position: absolute; z-index: 10; right: 2px; bottom: 2px; width: 16px; height: 16px; content: '\2714'; line-height: 1; text-align: center;
	background: hsl(210 100 75); border: solid 1px hsl(0 0 33); border-radius: 8px;
}

#xd-e-css-div {
	position: absolute; z-index: 1; display: flex; flex-flow: column nowrap; left: max(20cm - 31em, min(100vw - 31em, ((100vw - 20cm) / 2) + 20cm)); margin-top: 3em; width: max-content; background: gray; border: solid 2px black;
	& > button[name="xd-e-css-save-button"] { flex: 0 3em; }

	#xd-e-css-editor { width: 30em; max-width: 95vw; height: 30em; max-height: 50vh; overflow: auto; background: black; }

/*	#xd-e-format-editor {
		display: flex;
		& > div:last-of-type {
			display: flex; flex-flow: column nowrap;
		}
	}*/
}


#xd-element-tools {
/*	&[data-v=""], &[data-v="b"], &[data-v="i"], &[data-v="strong"] { & > * { display: none; } }*/
	&[data-v="img"] {
		& > [name="xd-e-toggle-button"], & > #xd-e-set-break-button { display: none; }
	}
	&:not([data-v="img"]) {
		& > [name="xd-e-src"],
		& > [name="xd-e-position"] { display: none; }
	}

	button[name="xd-e-toggle-button"] {
		&[value="b"] { font-weight: bold; }
		&[value="i"] { font-style: italic; }
		&[value="u"] { text-decoration: underline; }
		&[value="strong"] { font-weight: bold; background-color: #ddd; }
	}

	#xd-e-align-h { margin: 0 1em; & > button { padding: 0 4px; } }
}

#xd-co-editors { flex: 1; align-self: center;
	& > li {
		display: inline-block; width: 2em; height: 2em; line-height: 2; margin: 2px; text-align: center; font-family: monospace;
		border: solid 1px gray; border-radius: 50%;
	}
}


#css-color-picker {
	position: absolute; padding: 3px; border: solid 1px gray;
	#css-color-picker-inform { position: absolute; padding: 3px; border: solid 1px gray; }
	#css-color-table {
		display: grid; grid: auto-flow / 5em 10em 5em 10em 5em 10em 5em; align-items: center; gap: 1px; font-family: monospace; font-size: 70%; margin-top: 1em; background: #777; border: solid 1px #777;
		& > * { text-align: center; }
		& > div { height: 100%; background: #ddd; }
		& > button { height: 3em; border: none; border-radius: 0; }
	}
	#css-gray-scale-table {
		display: flex; margin: .5em 0; border: solid 1px #777;
		& > button { flex: 1; height: 2em; }
	}
	#css-color-picker-submit-div {
		& > button[name="css-color-picker-rgb"] { background: none; }
	}
}


#xd-document-root {
	margin: 1px; background: white;
	&:focus { outline: none; }

/*
	p { margin: 0; }

	div.xd-div-border-1 { border: solid 1px black; margin: 0 5em; }

	h1 { font-size: 1.5em; font-family: serif; }
	h2 { font-size: 1.2em; }

	ul {
		list-style: disc; padding-left: 2em;
		& > li { padding-bottom: 2px; }
	}
	ol {
		padding-left: 2em; list-style: decimal;
		& > li {
			padding-bottom: 2px;
			& > ol { padding-left: 1em; list-style: lower-latin; }
		}
	}

	dl { display: grid; overflow: hidden; gap: 0 5px;
		& > dt { grid-column: 1; }
		& > dd { grid-column: 2; min-width: 3em; text-align: right; }
	}

	.xd-e-class-1 { padding: 2px 4px; border: solid 1px #000; background: #eee; }
	.xd-e-class-2 { padding: 1em; border: outset 2px #777; background: #eee; }
	.xd-e-class-3 { padding: 2px 4px; border: dashed 2px red; background: #eee; }
	.xd-e-class-4 { padding: 2px 4px; border: dashed 2px yellow; background: #eee; }

	.xd-e-background-color-darkgray { background: #888; }
	.xd-e-background-color-gray { background: #bbb; }
	.xd-e-background-color-lightgray { background: #eee; }
	.xd-e-background-color-red { background: #f99; }
	.xd-e-background-color-green { background: #9f9; }
	.xd-e-background-color-blue { background: #99f; }

	.xd-e-position-block { display: block; }
	.xd-e-position-floatleft { float: left; }
	.xd-e-position-floatright { float: right; }
*/
}


