/* DasRSS glue styles.
   The Feedly look comes entirely from themes/light.css + themes.local/feedly.css,
   which are reused verbatim from the tt-rss install. This file only supplies the
   layout that Dojo's BorderContainer normally synthesises, plus the few widgets
   that are reimplemented without Dojo. */

/* ---------------------------------------------------------------- layout -- */

body.ttrss_index #feeds-holder {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--feeds-toggle-width, var(--base-spacing, 45px));
	width: 20%;
}

body.ttrss_index #content-wrap {
	position: absolute;
	top: 0;
	bottom: 0;
	left: calc(var(--feeds-toggle-width, var(--base-spacing, 45px)) + 20%);
	right: 0;
	margin-left: 0;
}

#feeds-holder #feedTree {
	height: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	margin-left: calc(-1 * var(--feeds-toggle-width, var(--base-spacing, 45px)));
	width: calc(100% + var(--feeds-toggle-width, var(--base-spacing, 45px)));
}

#toolbar-frame {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: var(--base-spacing, 45px);
	z-index: 2;
}

#headlines-wrap-inner {
	position: absolute;
	top: var(--base-spacing, 45px);
	left: 0;
	right: 0;
	bottom: 0;
}

#headlines-frame {
	position: absolute;
	inset: 0;
	overflow-y: auto;
	overflow-x: hidden;
}

/* three panel mode: headlines on the left, article on the right */
body[data-layout="three-panel"] #headlines-frame {
	right: 50%;
}

body[data-layout="three-panel"] #content-insert {
	display: block !important;
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 50%;
	overflow-y: auto;
	background: #fff;
	border-left: 1px solid rgba(0, 0, 0, 0.07);
}

/* the narrow fixed strip on the far left that toggles the feed list */
#feeds-toggle {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	width: var(--feeds-toggle-width, var(--base-spacing, 45px));
	padding: 0;
	border: 0;
	background: linear-gradient(to right, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0));
	cursor: pointer;
	z-index: 3;
	transition: background-position 0.1s;
	background-size: calc(-1 * var(--feeds-toggle-width, 45px)) 100%;
}

#feeds-toggle span {
	position: absolute;
	top: calc(45px + 8px);
	left: 50%;
	width: 16px;
	height: 2px;
	background: currentColor;
	color: rgba(0, 0, 0, 0.4);
	transform: translateX(-50%);
	box-shadow: 0 6px 0 currentColor, 0 12px 0 currentColor;
	opacity: 0.4;
}

#feeds-toggle:hover span { opacity: 0.75; }

body.feeds-hidden #feeds-holder { display: none; }
body.feeds-hidden #main { padding-left: 0 !important; }
body.feeds-hidden #content-wrap { left: 0; }
body.feeds-hidden #feeds-toggle span { opacity: 0.5; }

/* ------------------------------------------------------------- toolbar -- */

#toolbar select {
	appearance: none;
	-webkit-appearance: none;
	background-color: transparent;
	border: 0;
	box-shadow: none;
	color: rgba(0, 0, 0, 0.7);
	font: inherit;
	font-size: 13px;
	line-height: 1;
	padding: 6px 20px 6px 6px;
	margin: 0;
	cursor: pointer;
	border-radius: 3px;
	background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23000' stroke-opacity='0.45' stroke-width='1.6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 5px center;
}

#toolbar select:hover { background-color: rgba(0, 0, 0, 0.04); color: rgba(0, 0, 0, 0.9); }

#toolbar-main {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-shrink: 0;
}

#toolbar-headlines .feed_title { color: rgba(0, 0, 0, 0.72); }

#toolbar-headlines .right { gap: 4px; }

#selected_prompt { color: rgba(0, 0, 0, 0.4); font-style: normal; }

/* action chooser */
.action-chooser { position: relative; order: 30; margin-right: 4px; }

.action-chooser .action-button {
	cursor: pointer;
	padding: 4px;
	border-radius: 3px;
	display: flex;
	align-items: center;
}

.action-chooser .action-button:hover { background: rgba(0, 0, 0, 0.05); }

.action-chooser .dropdown-menu {
	position: absolute;
	top: calc(100% + 4px);
	right: 0;
	min-width: 210px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 4px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
	padding: 4px 0;
	z-index: 50;
	font-size: 13px;
	white-space: nowrap;
}

.action-chooser .menu-item { padding: 7px 16px; cursor: pointer; color: rgba(0, 0, 0, 0.75); }
.action-chooser .menu-item:hover { background: rgba(37, 122, 167, 0.1); color: #257aa7; }
.action-chooser .menu-section {
	padding: 8px 16px 3px;
	color: rgba(0, 0, 0, 0.35);
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	margin-top: 2px;
}
.action-chooser .menu-section:first-child { border-top: 0; margin-top: 0; }

/* ---------------------------------------------------------- feed tree -- */

#feedTree .dijitTreeRow { cursor: pointer; }
#feedTree .dijitTreeRow .dijitTreeContent { display: flex; align-items: center; flex-grow: 2; min-width: 0; }

/* The theme's expander glyph has no box of its own (it collapses to 0 width as a
   flex item), so the triangle is not clickable. Give it a real hit area; only
   this element toggles a folder's list. */
#feedTree .dijitTreeRow > .dijitTreeExpando {
	display: inline-block;
	flex: 0 0 auto;
	width: 14px;
	min-width: 14px;
	height: 14px;
	line-height: 14px;
	font-size: 14px;
	text-align: center;
	cursor: pointer;
}

/* the loading dots shown in the category rows are decorative in tt-rss */
#feedTree .loadingNode { display: none; }

/* --------------------------------------------------------- headlines -- */

.ttrss_main #headlines-frame .hl,
.ttrss_main #headlines-frame .cdm { cursor: default; }

/* tt-rss pins each card's header under the toolbar while you scroll (its JS
   only sticks the top-most card). Our headers are always sticky, so they need
   an opaque background and the frame needs one too, otherwise the article
   content scrolls *through* the title. */
#headlines-frame { background-color: #fff; }

#headlines-frame .cdm .header { background-color: #fff; }

.ttrss_main #headlines-frame .cdm .collapse {
	cursor: pointer;
}

.ttrss_main #headlines-frame .cdm .content-inner img,
.ttrss_main #headlines-frame .cdm .content-inner video,
.ttrss_main #headlines-frame .cdm .content-inner iframe {
	max-width: 100%;
}

/* kill animation-heavy bits we do not reproduce */
#overlay { display: none; }

#notify { pointer-events: none; }

/* ----------------------------------------------------------- dialogs -- */

.dlg-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.35);
	z-index: 90;
}

.dasrss-dialog {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	border-radius: 5px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
	z-index: 100;
	width: 480px;
	max-width: 92vw;
}

.dasrss-dialog header {
	padding: 14px 20px;
	font-size: 16px;
	font-weight: 600;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	color: #555;
}

.dasrss-dialog section { padding: 16px 20px; }
.dasrss-dialog section p { margin: 0 0 12px; }

.dasrss-dialog fieldset { border: 0; padding: 4px 0; margin: 0; }

.dasrss-dialog fieldset > label {
	display: inline-block;
	min-width: 90px;
	font-weight: bold;
	color: #555;
}

.dasrss-dialog input[type=text] {
	padding: 6px 8px;
	border: 1px solid #ccc;
	border-radius: 3px;
	font-size: 14px;
	width: 320px;
	max-width: 100%;
}

.dasrss-dialog select {
	padding: 6px 8px;
	border: 1px solid #ccc;
	border-radius: 3px;
	font-size: 14px;
	background: #fff;
}

.dasrss-dialog footer {
	padding: 12px 20px 16px;
	text-align: right;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* --------------------------------------------------- login / buttons -- */

body.ttrss_utility .content input[type=text],
body.ttrss_utility .content input[type=password] {
	padding: 6px 8px;
	border: 1px solid #c3c3c3;
	border-radius: 3px;
	font-size: 14px;
	color: #555;
	min-width: 240px;
}

body.ttrss_utility .content input:focus {
	border-color: #257aa7;
	outline: none;
}

button.alt-primary,
.dasrss-dialog button.alt-primary {
	background: #257aa7;
	color: #fff;
	border: 0;
	border-radius: 3px;
	padding: 8px 14px;
	font-size: 14px;
	cursor: pointer;
}

body.ttrss_utility.ttrss_login .content button.alt-primary { width: 100%; padding: 8px; }

.dasrss-dialog button.dlg-cancel {
	background: #f1f1f1;
	color: #555;
	border: 1px solid #ccc;
	border-radius: 3px;
	padding: 8px 14px;
	font-size: 14px;
	cursor: pointer;
	margin-right: 8px;
}

button.alt-primary:hover { background: #1f6a92; }

/* ------------------------------------------------------------- misc -- */

#feedlistLoading { padding-top: 12px; }

.spinner-inline { color: #888; font-size: 12px; }

#drawer-backdrop { display: none; }

/* -------------------------------------------------------------- mobile -- */

@media (max-width: 992px) {
	/* Replace the theme's swipeable panes with a slide-in drawer. */
	body.ttrss_index #main {
		padding-left: 0 !important;
		overflow: hidden !important;
		scroll-snap-type: none !important;
	}

	body.ttrss_index #feeds-holder {
		display: block !important;
		position: fixed !important;
		top: 0;
		bottom: 0;
		left: 0 !important;
		width: min(86vw, 340px) !important;
		margin: 0 !important;
		z-index: 60;
		background: #f6f6f6 !important;
		box-shadow: 0 0 24px rgba(0, 0, 0, 0.35);
		transform: translateX(-100%);
		transition: transform 0.22s ease;
	}

	body.ttrss_index:not(.feeds-hidden) #feeds-holder { transform: translateX(0); }

	body.ttrss_index #content-wrap {
		position: absolute !important;
		top: 0;
		bottom: 0;
		left: 0 !important;
		right: 0 !important;
		width: auto !important;
		margin-left: 0 !important;
	}

	body.ttrss_index #feeds-holder #feedTree {
		margin-left: 0;
		width: 100%;
	}

	/* the theme reserves space here for the fixed desktop toggle strip */
	body.ttrss_index #feeds-holder #feedTree > .dijitTreeContainer {
		padding-top: 14px !important;
		padding-bottom: 24px !important;
	}

	#drawer-backdrop {
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: 55;
	}

	body.ttrss_index:not(.feeds-hidden) #drawer-backdrop { display: block; }

	/* floating toggle button */
	#feeds-toggle {
		top: auto;
		bottom: 18px;
		left: auto;
		right: 18px;
		width: 52px;
		height: 52px;
		border-radius: 999px;
		background: #257aa7;
		background-image: none;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
		z-index: 70;
	}

	#feeds-toggle span {
		top: 18px;
		width: 20px;
		height: 2px;
		color: #fff;
		opacity: 1;
		box-shadow: 0 7px 0 currentColor, 0 14px 0 currentColor;
	}

	#feeds-toggle:hover span { opacity: 1; }

	/* tighter toolbar on phones */
	#toolbar { padding: 6px 10px !important; }
}
