/*
 * Część wspólna strony hoovera i strony głównej: baza, pasek górny, menu, okna dialogowe, ikony, ustawienia.
 * Ładowana przed hoover.css / home.css (assets.tpl).
 */
:root {
	--topbar-bg: #1f1f1f;
	--topbar-text: #eee;
	--radius: 6px;
	--gap: 12px;
}

* {
	box-sizing: border-box;
}

button,
input,
select,
textarea {
	font: inherit;
}

/* --- pasek górny --- */
.topbar {
	background: var(--topbar-bg);
	color: var(--topbar-text);
	position: sticky;
	top: 0;
	z-index: 50;
}

.topbar-inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 6px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
}

.topbar a {
	color: var(--topbar-text);
}

.logo img {
	display: block;
	width: auto;
	height: 18px;
}

.menu-button {
	margin-left: auto;
	background: none;
	border: 1px solid #555;
	border-radius: 4px;
	color: var(--topbar-text);
	font-size: 20px;
	line-height: 1;
	padding: 6px 10px;
	cursor: pointer;
}

.menu {
	display: none;
}

.menu.is-open {
	display: block;
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	background: var(--topbar-bg);
	padding: 8px 16px 16px;
	max-height: calc(100vh - 44px);
	overflow-y: auto;
}


/* --- menu na szerokim ekranie --- */
@media (min-width: 1024px) {
	.menu-button {
		display: none;
	}
	.menu,
	.menu.is-open {
		display: flex;
		position: static;
		margin-left: auto;
		padding: 0;
		background: none;
		max-height: none;
		overflow: visible;
	}
}

/* --- okna dialogowe --- */
.dialog {
	width: min(520px, calc(100vw - 24px));
	max-height: calc(100vh - 24px);
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: #fff;
	color: #222;
	box-shadow: 0 10px 40px rgb(0 0 0 / 0.45);
	font: 15px/1.4 "Trebuchet MS", Arial, sans-serif;
}

.dialog-wide {
	width: min(860px, calc(100vw - 24px));
}

.dialog::backdrop {
	background: rgb(0 0 0 / 0.55);
}

.dialog a {
	color: #0b5e86;
}

.dialog-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-bottom: 1px solid #ddd;
	position: sticky;
	top: 0;
	background: #fff;
	z-index: 1;
}

.dialog-title {
	flex: 1;
	margin: 0;
	font-size: 18px;
}

.dialog-close {
	background: none;
	border: 0;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 0 4px;
}

.dialog-body {
	padding: 16px;
}

.dialog.is-busy .dialog-body {
	opacity: 0.6;
	pointer-events: none;
}

.dialog label {
	display: block;
	font-weight: bold;
	margin: 12px 0 4px;
}

.dialog input[type="text"],
.dialog input[type="url"],
.dialog input[type="email"],
.dialog input[type="password"],
.dialog input[type="search"],
.dialog select,
.dialog textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #bbb;
	border-radius: 4px;
	background: #fff;
	color: #222;
}

.dialog textarea {
	min-height: 100px;
	resize: vertical;
}

.dialog .hint {
	font-size: 13px;
	color: #666;
	margin-top: 4px;
}

.dialog .error {
	color: #c0261c;
	font-size: 13px;
	margin-top: 4px;
}

.buttons {
	display: flex;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

.button {
	padding: 8px 16px;
	border: 1px solid var(--tab-border);
	border-radius: 4px;
	background: var(--tab-bg);
	color: var(--tab-text);
	font-weight: bold;
	cursor: pointer;
}

.dialog .button {
	border-color: #0b5e86;
	background: #0b5e86;
	color: #fff;
}

.dialog .button.dialog-cancel,
.dialog .button.secondary {
	background: #fff;
	color: #0b5e86;
}

.button:disabled {
	opacity: 0.6;
	cursor: wait;
}

@media (max-width: 599px) {

	.dialog,
	.dialog-wide {
		width: 100vw;
		max-width: 100vw;
		max-height: 100vh;
		height: 100%;
		margin: 0;
		border-radius: 0;
	}
}

/* przyciski-linki i etykiety pól wyboru (dialogi, menu, ustawienia) */
.link-button {
	background: none;
	border: 0;
	padding: 0;
	color: #0b5e86;
	text-decoration: underline;
	cursor: pointer;
}

.checkbox-label {
	display: flex !important;
	align-items: center;
	gap: 6px;
	font-weight: normal !important;
}

/* --- ikony: pliki gfx/icons/*.svg jako maska w kolorze tekstu --- */
.icon {
	display: inline-block;
	flex: none;
	width: 1.15em;
	height: 1.15em;
	vertical-align: -0.2em;
	background-color: currentColor;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

.icon-gear {
	-webkit-mask-image: url("../gfx/icons/gear.svg");
	mask-image: url("../gfx/icons/gear.svg");
}

.icon-x {
	-webkit-mask-image: url("../gfx/icons/x.svg");
	mask-image: url("../gfx/icons/x.svg");
}

.icon-pencil {
	-webkit-mask-image: url("../gfx/icons/pencil.svg");
	mask-image: url("../gfx/icons/pencil.svg");
}

.icon-note {
	-webkit-mask-image: url("../gfx/icons/note.svg");
	mask-image: url("../gfx/icons/note.svg");
}

.icon-menu {
	-webkit-mask-image: url("../gfx/icons/menu.svg");
	mask-image: url("../gfx/icons/menu.svg");
}

.icon-ban {
	-webkit-mask-image: url("../gfx/icons/ban.svg");
	mask-image: url("../gfx/icons/ban.svg");
}

.icon-plus {
	-webkit-mask-image: url("../gfx/icons/plus.svg");
	mask-image: url("../gfx/icons/plus.svg");
}

.icon-globe {
	-webkit-mask-image: url("../gfx/icons/globe.svg");
	mask-image: url("../gfx/icons/globe.svg");
}

.icon-folder {
	-webkit-mask-image: url("../gfx/icons/folder.svg");
	mask-image: url("../gfx/icons/folder.svg");
}

.icon-palette {
	-webkit-mask-image: url("../gfx/icons/palette.svg");
	mask-image: url("../gfx/icons/palette.svg");
}

.dialog-close .icon {
	width: 22px;
	height: 22px;
}

/* --- menu (pasek narzędzi) --- */
.menu {
	flex-direction: column;
	gap: 2px;
}

.menu.is-open {
	display: flex;
}

.menu-item {
	display: block;
	width: 100%;
	padding: 10px 4px;
	background: none;
	border: 0;
	border-bottom: 1px solid #333;
	color: var(--topbar-text);
	text-align: left;
	text-decoration: none;
	font-size: 15px;
	cursor: pointer;
}

.menu-item.is-red {
	color: #ff8a80;
}

.menu-panel>summary {
	list-style: none;
}

.menu-panel>summary::-webkit-details-marker {
	display: none;
}

.menu-panel>summary::after {
	content: "";
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-left: 4px;
	vertical-align: -1px;
	background-color: currentColor;
	-webkit-mask: url("../gfx/icons/chevron-down.svg") center / contain no-repeat;
	mask: url("../gfx/icons/chevron-down.svg") center / contain no-repeat;
}

.menu-panel-body {
	padding: 6px 4px 12px 14px;
	color: var(--topbar-text);
	font-size: 14px;
}

.menu-panel-body a,
.menu-panel-body .link-button {
	color: #9fd3f0;
}

.panel-list {
	list-style: none;
	margin: 0 0 8px;
	padding: 0;
}

.panel-list li {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 5px 0;
}

.panel-list li.is-active {
	font-weight: bold;
}

.panel-public {
	color: #8bc34a;
	font-size: 12px;
}

.panel-delete {
	margin-left: auto;
	background: none;
	border: 0;
	color: #aaa;
	cursor: pointer;
	min-width: 32px;
}

.register-notice {
	margin: 0 0 12px;
	padding: 10px 12px;
	border-radius: var(--radius);
	background: rgb(0 0 0 / 0.35);
	color: #fff;
	font-size: 14px;
}

.register-notice summary {
	cursor: pointer;
	font-weight: bold;
}

.register-notice-body {
	margin-top: 8px;
}

.register-notice .link-button {
	color: #9fd3f0;
	font-weight: bold;
}

.nick {
	opacity: 0.7;
}

.cookie-disclaimer {
	background: #000;
	color: #ddd;
	font-size: 13px;
	text-align: center;
	padding: 6px 12px;
}

.cookie-disclaimer a {
	color: #fff;
}

.reg-type {
	margin-top: 10px;
}

.startpage ol {
	padding-left: 20px;
}

.startpage .start-page-logo {
	float: left;
	margin-right: 12px;
}

@media (min-width: 1024px) {

	.menu,
	.menu.is-open {
		flex-direction: row;
		align-items: center;
		flex-wrap: wrap;
		justify-content: flex-end;
		gap: 6px;
	}

	.menu-item {
		width: auto;
		padding: 3px 10px;
		border: 1px solid #555;
		border-radius: 4px;
		font-size: 13px;
		font-weight: bold;
		background: #333;
	}

	.menu-panel {
		position: relative;
	}

	.menu-panel-body {
		position: absolute;
		right: 0;
		top: calc(100% + 6px);
		min-width: 260px;
		max-height: 70vh;
		overflow-y: auto;
		padding: 12px 14px;
		background: #222;
		border: 1px solid #444;
		border-radius: 6px;
		box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
		z-index: 60;
	}

}

/* --- ustawienia --- */
.settings-tabs {
	display: flex;
	gap: 4px;
	border-bottom: 1px solid #ddd;
	margin: -4px 0 12px;
}

.settings-tabs [role="tab"] {
	padding: 8px 14px;
	border: 0;
	border-bottom: 3px solid transparent;
	background: none;
	font-weight: bold;
	color: #555;
	cursor: pointer;
}

.settings-tabs [role="tab"][aria-selected="true"] {
	color: #0b5e86;
	border-bottom-color: #0b5e86;
}

.settings-form+.settings-form {
	margin-top: 20px;
	padding-top: 12px;
	border-top: 1px solid #eee;
}

.settings-form h3 {
	margin: 4px 0 8px;
	font-size: 16px;
}

.settings-form h4 {
	margin: 14px 0 6px;
	font-size: 14px;
}

.settings-section {
	margin-bottom: 16px;
	padding: 12px 14px 14px;
	border: 1px solid #dcdcdc;
	border-radius: 8px;
	background: #f7f7f7;
}

.settings-section>h3 {
	margin: 0 -14px 12px;
	padding: 0 14px 8px;
	border-bottom: 1px solid #dcdcdc;
}

.settings-section h4:first-of-type {
	margin-top: 0;
}

.form-row {
	margin-bottom: 4px;
}

.checkbox-row>.checkbox-label {
	font-weight: bold !important;
	margin-top: 10px;
}

.path-input {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
}

.path-input input {
	flex: 1;
	min-width: 140px;
}

.settings-form .thumb {
	display: block;
	max-width: 160px;
	margin-bottom: 6px;
}

.skins {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 10px;
}

.skin {
	padding: 4px;
	border: 2px solid #ddd;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	text-align: center;
	font-size: 13px;
}

.skin img {
	display: block;
	width: 100%;
	margin-bottom: 4px;
}

.skin.is-active {
	border-color: #0b5e86;
}

.background-options {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	margin-top: 8px;
}

.color-boxes {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 12px;
}

.color-group {
	margin: 0;
	padding: 4px 12px 8px;
	border: 1px solid #dcdcdc;
	border-radius: 6px;
	background: #fff;
	min-width: 0;
}

.color-group>legend {
	padding: 0 6px;
	font-weight: bold;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #0b5e86;
}

.color-box {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
}

.color-box+.color-box {
	border-top: 1px solid #eee;
}

.color-box label {
	flex: 1;
	margin: 0 !important;
	font-weight: normal !important;
}

.color-box input[type="color"] {
	width: 44px;
	height: 32px;
	padding: 0;
	border: 1px solid #bbb;
	border-radius: 4px;
	background: none;
	cursor: pointer;
}

.color-box input.is-transparent {
	background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 10px 10px;
}

.color-box .transparent {
	border: 1px solid #bbb;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	width: 32px;
	height: 32px;
}

.startpage ol {
	padding-left: 22px;
}

.startpage li {
	margin-bottom: 8px;
}

.startpage-copy {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 12px 0 0;
}

.startpage-url {
	flex: 1 1 220px;
	min-width: 0;
}

.apikey input {
	width: 100%;
	font-family: monospace;
}

.link-button.danger {
	color: #c0261c;
}
