/* =====================================================================
   ICAAM custom enhancements
   - Dynamic separators (replaces the old "-----" dash lines)
   - Responsive / overflow fixes
   - Mobile two-button navigation (left = main menu, right = quick links)
   Loaded on every page after bootstrap.min.css + mezzanine.css.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Dynamic separators
   The old markup used a fixed string of dashes ("------------") which did
   not scale and forced horizontal overflow on small screens. These are
   now real dividers that stretch to the width of their container.
   --------------------------------------------------------------------- */

/* Divider inside the side-panel quick-links list */
li.menu-divider {
	list-style: none;
	height: 0;
	margin: 10px 4px;
	padding: 0;
	border: 0;
	border-top: 1px solid #c9c4a8;
}

/* Divider used inside page content (e.g. between sponsor logos) */
hr.content-divider {
	border: 0;
	border-top: 1px solid #cfcaad;
	max-width: 100%;
	margin: 18px auto;
}

/* ---------------------------------------------------------------------
   2. General responsive / overflow fixes
   Some content tables used fixed pixel widths (width="860") and some
   images were oversized, which pushed the right-hand panel off-screen on
   phones. Keep everything within the viewport.
   --------------------------------------------------------------------- */

html, body {
	overflow-x: hidden;
}

#content img,
.panel img {
	max-width: 100%;
	height: auto;
}

#content table {
	width: 100% !important;
	max-width: 100%;
	table-layout: auto;
}

#content table td {
	width: auto !important;
	word-break: break-word;
}

/* ---------------------------------------------------------------------
   3. Mobile navigation bar (two buttons)
   The bar and drawers are injected by site-enhance.js. They are hidden
   on desktop and only appear at <= 767px.
   --------------------------------------------------------------------- */

/* Injected elements are hidden by default (desktop) */
.m-topbar,
.m-drawer,
.m-overlay {
	display: none;
}

@media (max-width: 767px) {

	/* Hide the original Bootstrap navbar (toggle + inline menu) and the
	   inline right-hand side panel; they are replaced by the drawers. */
	.navbar {
		display: none !important;
	}
	.col-md-3.right {
		display: none !important;
	}

	/* --- Sticky top bar with the two buttons --- */
	.m-topbar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: sticky;
		top: 0;
		z-index: 1030;
		background: linear-gradient(#0081ac, #005b79);
		color: #fff;
		padding: 8px 10px;
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	}

	.m-topbar .m-title {
		font: bold 16px/1.2 "Trebuchet MS", Arial, sans-serif;
		color: #fff;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		padding: 0 8px;
		flex: 1 1 auto;
		text-align: center;
	}

	.m-btn {
		flex: 0 0 auto;
		display: inline-flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 2px;
		min-width: 48px;
		height: 46px;
		padding: 8px 10px;
		background: rgba(255, 255, 255, 0.12);
		border: 1px solid rgba(255, 255, 255, 0.35);
		border-radius: 8px;
		color: #fff;
		font: 10px/1 Arial, sans-serif;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}
	.m-btn:active {
		background: rgba(255, 255, 255, 0.28);
	}
	.m-btn .m-bars {
		display: block;
		flex: none;
		width: 20px;
		height: 2px;
		background: #fff;
		border-radius: 2px;
		box-shadow: 0 6px 0 #fff, 0 -6px 0 #fff;
		margin: 6px 0 11px;
	}
	.m-btn .m-btn-label {
		font-size: 10px;
		font-weight: bold;
		letter-spacing: 0.3px;
		line-height: 1;
	}

	/* --- Slide-in drawers --- */
	.m-drawer {
		display: block;
		position: fixed;
		top: 0;
		bottom: 0;
		width: 78%;
		max-width: 320px;
		background: #ebe8d9;
		z-index: 1050;
		box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		transition: transform 0.28s ease;
	}
	.m-drawer.m-left {
		left: 0;
		transform: translateX(-105%);
	}
	.m-drawer.m-right {
		right: 0;
		transform: translateX(105%);
	}
	.m-drawer.m-open {
		transform: translateX(0);
	}

	.m-drawer .m-drawer-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: linear-gradient(#0081ac, #005b79);
		color: #fff;
		padding: 12px 14px;
		font: bold 15px/1.2 "Trebuchet MS", Arial, sans-serif;
	}
	.m-drawer .m-close {
		background: none;
		border: 0;
		color: #fff;
		font-size: 24px;
		line-height: 1;
		cursor: pointer;
		padding: 0 4px;
	}

	.m-drawer ul {
		list-style: none;
		margin: 0;
		padding: 6px 0;
	}
	.m-drawer li {
		margin: 0;
		padding: 0;
	}
	.m-drawer li a {
		display: block;
		padding: 12px 16px;
		color: #005b79;
		font-size: 15px;
		text-decoration: none;
		border-bottom: 1px solid #ddd9c4;
	}
	.m-drawer li a:hover,
	.m-drawer li a:active {
		background: #dfe0c8;
	}
	.m-drawer li.active > a,
	.m-drawer li.active-branch > a {
		background: #d5e6ec;
		font-weight: bold;
	}
	/* Non-link items (e.g. "Registration Open" label) */
	.m-drawer li.m-text {
		padding: 12px 16px;
		font-size: 15px;
		color: #333;
		border-bottom: 1px solid #ddd9c4;
	}
	/* Divider carried into the drawer */
	.m-drawer li.menu-divider {
		border-top: 1px solid #c9c4a8;
		margin: 6px 12px;
	}

	/* --- Dark overlay behind an open drawer --- */
	.m-overlay {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.45);
		z-index: 1040;
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.28s ease, visibility 0.28s ease;
	}
	.m-overlay.m-open {
		opacity: 1;
		visibility: visible;
	}

	/* Prevent body scroll while a drawer is open */
	body.m-nav-open {
		overflow: hidden;
	}
}
