/* Palette and shapes taken from obec-borek.eu: dark green, sand accent line, pastel tiles. */
:root {
	--brand: #163f21;
	--brand-hover: #0f2c17;
	--accent: #d3be90;
	--pastel-green: #98f391;
	--pastel-blue: #aef0ff;
	--pastel-pink: #ffccd0;
	--pastel-yellow: #fdffc6;

	--bs-body-color: #333;
	--bs-body-font-family: Helvetica, Arial, sans-serif;
	--bs-primary: var(--brand);
	--bs-primary-rgb: 22, 63, 33;
	--bs-link-color: var(--brand);
	--bs-link-color-rgb: 22, 63, 33;
	--bs-link-hover-color: var(--brand-hover);
	--bs-link-hover-color-rgb: 15, 44, 23;
	--bs-border-radius: 3px;
	--bs-border-radius-sm: 3px;
	--bs-border-radius-lg: 3px;
	--bs-focus-ring-color: rgba(22, 63, 33, 0.5);
}

h1, h2, h3, h4, h5, h6 {
	font-weight: 500;
}

/* Header as on obec-borek.eu: white bar under a thin green line, the logo left, green menu right. */
.app-header {
	background: #fff;
	border-top: 3px solid var(--brand);
	border-bottom: 1px solid #e6e6e6;
}

.app-logo {
	display: block;
	width: auto;
	height: 60px;
	max-width: 60vw;
	object-fit: contain;
	object-position: left center;
}

.app-header .navbar-nav .nav-link {
	color: var(--brand);
	font-size: 1.05rem;
	padding-left: 0.9rem;
	padding-right: 0.9rem;
}

.app-header .navbar-nav .nav-link:hover {
	color: var(--brand-hover);
	text-decoration: underline;
}

/* The current page: bold with the sand underline, not colour alone (WCAG 1.4.1). */
.app-header .navbar-nav .nav-link.active {
	color: var(--brand);
	font-weight: 600;
	box-shadow: inset 0 -3px 0 var(--accent);
}

.app-header .navbar-text {
	color: var(--brand);
}

.btn-primary {
	--bs-btn-bg: var(--brand);
	--bs-btn-border-color: var(--brand);
	--bs-btn-hover-bg: var(--brand-hover);
	--bs-btn-hover-border-color: var(--brand-hover);
	--bs-btn-active-bg: var(--brand-hover);
	--bs-btn-active-border-color: var(--brand-hover);
	--bs-btn-disabled-bg: var(--brand);
	--bs-btn-disabled-border-color: var(--brand);
}

.btn-outline-primary {
	--bs-btn-color: var(--brand);
	--bs-btn-border-color: var(--brand);
	--bs-btn-hover-bg: var(--brand);
	--bs-btn-hover-border-color: var(--brand);
	--bs-btn-active-bg: var(--brand-hover);
	--bs-btn-active-border-color: var(--brand-hover);
}

.btn-outline-secondary.active {
	--bs-btn-active-bg: var(--brand);
	--bs-btn-active-border-color: var(--brand);
}

.form-control:focus,
.form-select:focus {
	border-color: #6b8f73;
	box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
}

/* White card with soft shadow and the sand underline */
.app-card {
	background: #fff;
	border: 0;
	border-bottom: 4px solid var(--accent);
	box-shadow: 0 0 30px rgba(0, 0, 0, 0.15);
}

.app-tile {
	display: block;
	height: 100%;
	padding: 1rem 1.25rem;
	color: #333;
	text-decoration: none;
	border-radius: var(--bs-border-radius);
	transition: transform 0.1s ease-in-out;
}

.app-tile:hover {
	color: #333;
	transform: translateY(-2px);
}

.app-tile .display-6 {
	font-weight: 700;
}

.tile-green { background: var(--pastel-green); }
.tile-blue { background: var(--pastel-blue); }
.tile-pink { background: var(--pastel-pink); }
.tile-yellow { background: var(--pastel-yellow); }

.table > thead th {
	color: var(--brand);
	border-bottom: 2px solid var(--accent);
}

/* Availability calendar */
.calendar {
	table-layout: fixed;
}

.calendar th {
	background: #f5f5f5;
	border: 1px solid #d7d7d7;
}

.calendar td {
	padding: 0;
	vertical-align: top;
	border: 1px solid #adadad;
}

.calendar td.cal-gap {
	--bs-table-bg: #f9f9f9;
	border-color: #eaeaea;
}

/* Day states use the four pastel tiles, lightened so the bookings stay readable. */
.cal-free { --bs-table-bg: #e3fbe1; }
.cal-partial { --bs-table-bg: var(--pastel-yellow); }
.cal-full { --bs-table-bg: var(--pastel-pink); }
.cal-extension { --bs-table-bg: var(--pastel-blue); }

.cal-swatch {
	display: inline-block;
	width: 0.9rem;
	height: 0.9rem;
	vertical-align: -0.1rem;
	border: 1px solid #adadad;
	background: var(--bs-table-bg);
}

.calendar .cal-day {
	display: block;
	min-height: 72px;
	padding: 0.3rem 0.4rem;
	text-decoration: none;
	color: inherit;
}

.calendar .cal-day:hover {
	outline: 2px solid var(--brand);
	outline-offset: -2px;
}

.calendar .cal-num {
	font-weight: 600;
	line-height: 1;
}

.calendar .cal-avail {
	font-size: 0.75rem;
}

.calendar .cal-bookings {
	display: block;
	clear: both;
	margin-top: 0.25rem;
}

.calendar .cal-booking {
	font-size: 0.7rem;
	line-height: 1.2;
	margin-top: 0.1rem;
	padding: 0 0.2rem;
	border-radius: 0.15rem;
	background: rgba(255, 255, 255, 0.6);
	border-left: 3px solid #69727d; /* reserved (default) */
}

/* actually lent out */
.calendar .cal-booking.cal-lent {
	border-left-color: var(--brand);
	font-weight: 600;
}

/* loan reaching this day from outside the reserved window (early pickup / late return) */
.calendar .cal-booking.cal-ext {
	border-left-color: #1e73be;
	font-style: italic;
}

/* request waiting for approval: shown, but holds no units */
.calendar .cal-booking.cal-pending,
.cal-legend-pending {
	border-left: 3px dashed #c9a400;
}

.calendar .cal-booking.cal-pending {
	opacity: 0.75;
}

.cal-legend-pending {
	display: inline-block;
	width: 0.9rem;
	height: 0.9rem;
	vertical-align: -0.1rem;
	background: #f9f9f9;
}

/* Accessibility: a skip link for keyboard and screen-reader users, and a focus ring that stays
   clearly visible on every background (WCAG 2.4.1, 2.4.7). */
.skip-link {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	z-index: 1080;
	padding: 0.5rem 1rem;
	background: #fff;
	color: var(--brand);
	font-weight: 600;
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.form-check-input:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
	outline: 3px solid #1e73be;
	outline-offset: 2px;
}

.calendar .cal-day:focus-visible {
	outline-offset: -3px;
}

/* #main receives focus only from the skip link; the ring there would frame the whole page. */
main:focus {
	outline: none;
}

/* Bootstrap's outline warning text (#ffc107) has 1.6:1 contrast on white; darker text keeps the
   yellow look at 4.5:1 or more (WCAG 1.4.3). */
.btn-outline-warning {
	--bs-btn-color: #8a6100;
	--bs-btn-border-color: #c79100;
	--bs-btn-hover-color: #000;
	--bs-btn-hover-bg: #ffc107;
	--bs-btn-hover-border-color: #ffc107;
	--bs-btn-active-color: #000;
	--bs-btn-active-bg: #ffc107;
	--bs-btn-active-border-color: #ffc107;
}

/* The footer sits at the bottom of the window even on short pages. */
body {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

main {
	flex: 1 0 auto;
	width: 100%;
}

.app-footer {
	border-top: 1px solid #e6e6e6;
	background: #fff;
	color: #595959;
}
