/*
 * Strona hoovera – layout responsywny.
 * Kolory wyłącznie ze zmiennych: skórka (skins/<nazwa>/theme.css) ustawia je na :root,
 * własne kolory hoovera (<style id="design-vars">) nadpisują. Zmienne *-lock ustawia skórka,
 * gdy blokuje własny kolor (odpowiednik !important w starych skórkach).
 */
:root {
	--bg: #127ea6;
	--bg-image: none;
	--bg-repeat: repeat-x;
	--bg-attachment: scroll;
	--bg-position: center top;
	--text: #fff;
	--link: #fff;
	--font: "Trebuchet MS", Arial, Verdana, sans-serif;
	--heading-font-style: normal;
	--heading-text: #fff;
	--pane-sites-bg: transparent;
	--pane-folders-bg: #064157;
	--tab-bg: #064157;
	--tab-border: #808080;
	--tab-text: #fff;
	--heading-border: var(--tab-bg);
	--footer-bg: #064157;
	--footer-text: #698f9f;
	--desktop-areas: "sites folders";
	--desktop-columns: minmax(0, 1fr) 300px;
}

body {
	margin: 0;
	font: 15px/1.4 var(--font);
	color: var(--text);
	background-color: var(--bg);
	background-image: var(--bg-image);
	background-repeat: var(--bg-repeat);
	background-attachment: var(--bg-attachment);
	background-position: var(--bg-position);
	min-height: 100vh;
}

a {
	color: var(--link);
}

/* --- treść --- */
.page {
	max-width: 1200px;
	margin: 0 auto;
	padding: 12px 12px 96px;
}

.search {
	margin: 0 auto 12px;
	max-width: 640px;
}

.search-form {
	display: flex;
	gap: 6px;
}

.search-form input[type="search"] {
	flex: 1;
	min-width: 0;
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
}

.search-form input[type="submit"] {
	padding: 8px 12px;
	cursor: pointer;
}

.board {
	display: grid;
	gap: var(--gap);
}

.pane {
	border-radius: var(--radius);
	padding: 10px;
	min-width: 0;
}

.pane-sites {
	background-color: var(--pane-sites-bg);
}

.pane-folders {
	background-color: var(--pane-folders-bg);
}

.hoover-title,
.folders-title {
	margin: 0 0 10px;
	font-style: var(--heading-font-style);
	border-top: 2px solid var(--heading-border);
	overflow-wrap: anywhere;
}

.hoover-title {
	font-size: 26px;
}

.folders-title {
	font-size: 18px;
}

.hoover-title span,
.folders-title span {
	display: inline-block;
	padding: 0 6px;
	color: var(--heading-text);
	background: var(--heading-bg-lock, var(--tab-bg));
}

/* zakładki Strony / Foldery – tylko na wąskim ekranie */
.tabs {
	display: flex;
	gap: 6px;
	margin: 0 0 12px;
}

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

.tabs button[aria-selected="true"] {
	background: var(--tab-text);
	color: var(--tab-bg);
}

.board[data-tab="sites"] .pane-folders,
.board[data-tab="folders"] .sites {
	display: none;
}

.board[data-tab="folders"] .pane-folders .folders-title {
	display: none;
}

.sites,
.folders {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* --- stopka --- */
.footer {
	margin-top: 20px;
	padding: 6px 10px;
	text-align: center;
	font-size: 13px;
	border-radius: var(--radius);
	background: var(--footer-bg);
	color: var(--footer-text);
}

.footer a {
	color: var(--footer-text);
	text-decoration: none;
}

.footer a:hover {
	text-decoration: underline;
}

/* --- tablet poziomo i desktop: dwie kolumny --- */
@media (min-width: 1024px) {
	.board {
		grid-template-columns: var(--desktop-columns);
		grid-template-areas: var(--desktop-areas);
		align-items: start;
	}

	.pane-sites {
		grid-area: sites;
	}

	.pane-folders {
		grid-area: folders;
	}

	.tabs {
		display: none;
	}

	.board[data-tab] .pane-folders,
	.board[data-tab] .pane-folders .folders-title {
		display: block;
	}

	.board[data-tab] .sites {
		display: grid;
	}
}

/* --- strony główne: kafelki --- */
.sites {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	min-height: 60px;
}

@media (min-width: 600px) {
	.sites {
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
		gap: 14px;
	}
}

.site-tile {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.site-head {
	display: flex;
	align-items: flex-start;
	gap: 4px;
	min-width: 0;
}

.site-title {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.site-tile .site-title {
	padding: 2px 0 4px;
}

.site-thumb {
	display: block;
	aspect-ratio: 4 / 3;
	border: 1px solid var(--tab-border);
	overflow: hidden;
	background: rgb(0 0 0 / 0.15);
}

.site-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top;
}

.note-toggle,
.site-action,
.folder-action {
	flex: none;
	background: none;
	border: 0;
	color: inherit;
	cursor: pointer;
	padding: 0 4px;
	font-size: 15px;
	line-height: 1.4;
	opacity: 0.8;
}

.note {
	white-space: pre-line;
	font-size: 13px;
	padding: 6px 8px;
	margin-top: 4px;
	border-radius: 4px;
	background: rgb(0 0 0 / 0.35);
	color: #fff;
	overflow-wrap: anywhere;
}

/* --- foldery --- */
.folders>li {
	margin-bottom: 4px;
}

.folder-head {
	display: flex;
	align-items: center;
	background: var(--tab-bg);
	border: 1px solid var(--tab-border);
	border-radius: 3px;
}

.folder-toggle {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 6px;
	text-align: left;
	background: none;
	border: 0;
	color: var(--tab-text);
	font-weight: bold;
	padding: 8px 8px;
	cursor: pointer;
}

.folder-toggle::before {
	content: "";
	flex: none;
	width: 14px;
	height: 14px;
	background-color: currentColor;
	opacity: 0.7;
	-webkit-mask: url("../gfx/icons/chevron-right.svg") center / contain no-repeat;
	mask: url("../gfx/icons/chevron-right.svg") center / contain no-repeat;
}

.folder-toggle[aria-expanded="true"]::before {
	-webkit-mask-image: url("../gfx/icons/chevron-down.svg");
	mask-image: url("../gfx/icons/chevron-down.svg");
}

.folder-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.folder-sites {
	list-style: none;
	margin: 0;
	padding: 4px 0 4px 10px;
	min-height: 8px;
}

.site-row {
	padding: 5px 0;
}

.site-row .site-title {
	display: flex;
	align-items: center;
	gap: 6px;
}

.site-title-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.site-row .favicon {
	flex: none;
	width: 16px;
	height: 16px;
}

/* --- wyszukiwarka stron hoovera --- */
.find {
	position: relative;
	margin-bottom: 10px;
}

.find-input {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
}

.find-results {
	position: absolute;
	z-index: 20;
	left: 0;
	right: 0;
	margin: 2px 0 0;
	padding: 4px 0;
	list-style: none;
	background: #fff;
	border: 1px solid #ccc;
	border-radius: 4px;
	max-height: 350px;
	overflow-y: auto;
}

.find-results a {
	display: block;
	padding: 6px 10px;
	color: #222;
	text-decoration: none;
}

.find-results a:hover {
	background: #eee;
}

@media (min-width: 1024px) {
	.folders-title {
		font-size: 18px;
	}

	.folder-toggle {
		padding: 4px 8px;
	}
}

/* --- tryb edycji --- */
.site-action {
	font-size: 14px;
}

.site-add .site-title {
	opacity: 0.8;
}

.site-add-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 4 / 3;
	border: 2px dashed var(--tab-border);
	background: rgb(255 255 255 / 0.06);
	color: var(--link);
	font: inherit;
	font-size: 48px;
	line-height: 1;
	cursor: pointer;
}

.site-add-button:hover,
.site-add-button:focus-visible {
	background: rgb(255 255 255 / 0.16);
}

@media (hover: hover) {
	.site .site-action {
		visibility: hidden;
	}

	.site:hover .site-action,
	.site:focus-within .site-action {
		visibility: visible;
	}
}

.fab {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 40;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	/* stały kolor niezależnie od skórki – przycisk ma być widoczny na każdym tle */
	border: 2px solid #333;
	background: #FFF;
	color: #333;
	font-size: 36px;
	font-weight: bold;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 14px rgb(0 0 0 / 0.45);
	display: grid;
	place-items: center;
	padding: 0;
}

.fab .icon {
	width: 30px;
	height: 30px;
}

.site-add-button .icon {
	width: 48px;
	height: 48px;
}

.fab:hover,
.fab:focus-visible {
	background: #EEE;
}

.site-thumb-edit {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.site-thumb-edit img {
	width: 120px;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border: 1px solid #ccc;
}

.site-thumb-edit input[type="file"] {
	width: 100%;
}

@media (pointer: coarse) {

	.site-action,
	.note-toggle,
	.folder-action {
		min-width: 36px;
		min-height: 32px;
		font-size: 17px;
	}

}

/* --- akcje folderów --- */
.folder-head .folder-action {
	color: var(--tab-text);
}

@media (hover: hover) {
	.folder-head .folder-action {
		visibility: hidden;
	}

	.folder-head:hover .folder-action,
	.folder-head:focus-within .folder-action {
		visibility: visible;
	}
}

.folder-rename {
	flex: 1;
	padding: 4px;
}

.folder-name-input {
	width: 100%;
	padding: 6px 8px;
	border: 1px solid #bbb;
	border-radius: 3px;
}

.folder.is-busy {
	opacity: 0.6;
}

.add-folder-box {
	margin-top: 10px;
	text-align: right;
}

/* --- przeciąganie --- */
.is-ghost {
	opacity: 0.35;
}

.is-chosen .site-thumb,
.is-chosen.site-row,
.is-chosen>.folder-head {
	outline: 2px dashed var(--tab-text);
	outline-offset: 2px;
}

.is-dragging .folder-head,
.is-dragging .tabs button[data-tab="folders"] {
	outline: 1px dashed var(--tab-text);
}

.is-dragging .folder-sites:not([hidden]) {
	min-height: 40px;
}

.is-edit .site,
.is-edit .folder-head {
	-webkit-touch-callout: none;
	user-select: none;
}
