/*   11/27/25   M. Brenner	*/


body {
	margin: 0;
	font-family: sans-serif;
	height: 100vh;
	display: flex;
	flex-direction: column;
}


:root {
	--ball-stroke: 1px solid rgba(0,0,0,.25); /* or 'none' */
	--status-bar-bg: #00c0ff;
	--status-bar-height: 46px;
	
	--ball-size: 22px;
	--ball-color: #B00000;
}

 
 
#resizable-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

#main-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding-bottom: 10px;
}

.field {
	display: flex;
	margin: 10px;
	width: 80%;
	max-width: 600px;
}

.field label {
	width: 120px;
	line-height: 2em;
}

.field input {
	flex: 1;
	padding: 5px;
}

.button-row {
	display: flex;
	justify-content: center;
	gap: 20px;
	margin-top: 20px;
}

button {
	padding: 5px 10px;
	font-size: 12px;
}




/****************************************
*			Custom Console				*
****************************************/

#divider {
	height: 6px;
	background: #ccc;
	cursor: row-resize;
	touch-action: none;			/* allow touch-drag to resize */
}

#custom-console {
	height: 150px;
	overflow-y: auto;
	background: #f0f0f0;
	font-family: monospace;
	font-size: 14px;
	padding: 10px;
	box-sizing: border-box;
	white-space: pre-wrap;
}




/************************************
*			Title Bar				*
************************************/

#status-bar {
	display: grid;
	grid-template-columns: auto 1fr auto auto;
	align-items: center;
	height: var(--status-bar-height);
	background: var(--status-bar-bg);
	padding: 0 12px;
	box-sizing: border-box;
	overflow: hidden;					/* prevents any accidental spillover */
}

/* center the logo horiztally and vertically				*/
/* Use height instead of only max-height; keep width auto	*/
#logo {
	display: block;
	justify-self: center;
	align-self: center;
	height: calc(var(--status-bar-height) - 20px);
	width: auto;
	object-fit: contain;				/* safe with explicit height */
}

#status-bar .gps-status-wrap,
#status-bar .con-status-wrap {
	position: static;					/* override earlier absolute positioning */
	display: inline-flex;
	align-items: center;				/* vertical centering of dot + labels */
	gap: 8px;
}


/* Small labels flanking the dot */
.dot-label {
	font-size: .9rem;
	font-weight: normal;
}


.status-ball {
	position: relative;
	width: var(--ball-size);
	height: var(--ball-size);
	border-radius: 50%;
	background: var(--ball-color);		 /* solid base */
	border: none;
	/* subtle “3D” via two inset shadows (works well at 20–36px) */
	box-shadow:
		inset 0 -1px 2px rgba(0,0,0,.25),
		inset 0	1px 0.5px rgba(255,255,255,.55);
	cursor: pointer;
}

.status-ball::after {
	content: "";
	position: absolute;
	top: 18%;
	left: 22%;
	width: 20%;
	height: 20%;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255,255,255,.85), rgba(255,255,255,0) 70%);
	pointer-events: none;
}

/* Larger, square hit area equal to the status bar height */
.status-ball::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: var(--status-bar-height);
	height: var(--status-bar-height);
 	transform: translate(-50%, -50%);
	border-radius: 0;					/* square (not rounded) */
	background: transparent;			/* invisible hit area   visible: background: rgba(0,255,255,.3); */
 	pointer-events: auto;				/* allow taps/clicks here */
}

/* Header stays on top */
#status-bar {
	position: sticky;
	top: 0;
	z-index: 2000;
}




/********************************************
*			Sliding Side Menu				*
********************************************/

#menu-toggle {
	border: 0;
	background: transparent;
	font-size: 1.25rem;
	margin-left: auto;			/* push to far right in a flex row */
	padding: 0;					/* no space on left/right */
	padding-left: 8px;
	cursor: pointer;
}

.side-menu {
	position: fixed;
	top: 0;
	left: 0;
	height: auto;
	max-height: 100vh;
	overflow-y: auto;
	width: 280px;
	max-width: 90vw;
	background: #eff;
	box-shadow: 2px 0 10px rgba(0,0,0,.2);
	transform: translateX(-100%);
	transition: transform 250ms ease;
	z-index: 2000;
	display: flex;
	flex-direction: column;
}

.side-menu.open { transform: translateX(0); }

.menu-header {
	font-weight: 600;
	padding: 1rem 1rem .5rem 1rem;
	border-bottom: 1px solid #eee;
}

.menu-list {
	list-style: none;
	margin: 0;
	padding: .5rem;
}

.menu-item {
	display: block;
	width: 100%;
	text-align: left;
	padding: .75rem 1rem;
	border: 0;
	background: transparent;
	cursor: pointer;
}

/* make the menu header (top line) in the menu larger */
.side-menu .menu-header { font-size: 1.125rem; }

/* bump only the slide-out menu buttons */
.side-menu .menu-item { font-size: 1rem; }   /* ~18px; use 1.25rem for ~20px */

.menu-item:focus { outline: 2px solid #999; }

.menu-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.25);
	opacity: 0;
	transition: opacity 200ms ease;
	z-index: 1999;
	pointer-events: none;
}

/* NEW: Only accept taps when the side menu is open */
.side-menu.open + .menu-backdrop {
	opacity: 1;
	pointer-events: auto;
}


[hidden] {
	display: none !important;
}

.hidden {
	display: none !important;
}




/************************************
*				About				*
************************************/

/* Styling for About (manu choice) */
.about-container {
	display: flex;
	justify-content: center;
	align-items: center;
	height: auto;
	flex-direction: column;
}

#about-button {
	padding: 10px 20px;
	font-size: 16px;
}

#about-screen {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background-color: #ffffff;					/* white for 'About' screen  */
	padding: 20px;
	border: 2px solid #b00;
	border-radius: 10px;
	z-index: 1000;
	width: 80%;
	max-width: 400px;
	text-align: center;
}

#about-title {
	font-size: 2em;
	color: #B00;
	display: block;
	margin-bottom: .5em;
}

#about-title sup {
	font-size: .55em;
	line-height: 0;
	vertical-align: super;
}

#trademark, #web-site {
	font-size: 10px;
}





/************************************
*				Forms				*
************************************/

.form-buttons {
	display: flex;
	justify-content: center;
	gap: 20px;
	margin-top: 16px;
}

.form-title {
	margin: 0 0 .5rem 0;
	text-align: center;
}

.form-row {
	display: grid;
	grid-template-columns: 150px 1fr;
	align-items: center;
	gap: 8px;
	margin: .5rem 0;
}

.form-row .inline-group {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.form-row .narrow {
	max-width: 120px;
}

.form-row input[type="text"],
.form-row input[type="number"] {
	width: 100%;
	box-sizing: border-box;
	padding: 6px 8px;
}

.form-scroll {
	flex: 1;							/* take remaining space between header & buttons */
	overflow-y: auto;
	min-height: 0;
}




/************************************
*				Dialogs				*
************************************/

/* Styling for Survey Config and Settings (menu choice) */
#plan-screen,
#loc-survey-screen,
#settings-screen {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%,-50%);
	padding: 20px;
	border: 2px solid #b00;
	border-radius: 10px;
	box-sizing: border-box;
	z-index: 1000;
	width: 95%;
	max-width: 640px;
	max-height: 90vh;
	overflow-y: auto;
}




/****************************************
*			Settings Dialog				*
****************************************/

#settings-screen {
	background-color: #fff7f9;				/* very pale rose for 'Settings' screen */
}




/****************************************
*			Location Survey				*
****************************************/

/* Survey dialog: fill screen *below* the header */
#loc-survey-screen {
	position: fixed;
	top: var(--status-bar-height);
	transform: translateX(-50%);			/* center horizontally only */
	height: calc(100dvh - var(--status-bar-height));
	max-width: 100vw;
	box-sizing: border-box;
	padding: 0;								/* important: no outer padding so height math works */
	padding-bottom: 10px;
	z-index: 1000;							/* below the header */
	display: flex;
	flex-direction: column;
	overflow: hidden;						/* only inner section scrolls */
 	background-color: #fff7eb;				/* very pale orange for 'Location Survey' screen */
}

.loc-survey-container {
	display: flex;
	flex-direction: column;
	flex: 1;								/* fill the dialog */
	min-height: 0;							/* allow child overflow areas to shrink */
}

.loc-survey-form {
	display: flex;
	flex-direction: column;
	flex: 1;								/* fill the dialog */
	min-height: 0;							/* allow child overflow areas to shrink */
}

#loc-survey-screen .form-scroll > fieldset.form-fieldset:first-of-type {
	background-color: #f9ebd6;				/* light creme for 'Parameters' region */
}

#loc-survey-screen .loc-survey-form > .form-row {
	padding: 0 16px;
}

/* Keep internal layout solid */
#loc-survey-screen .loc-survey-container,
#loc-survey-screen .loc-survey-form {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;                         /* allow the scroller to size correctly */
}

/* The only scrolling region */
#loc-survey-screen .form-scroll {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 16px;
	padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* Bottom button row: always visible */
#loc-survey-screen .button-row {
	flex-shrink: 0;                        /* never collapse */
	padding: 12px 16px;
	border-top: 1px solid #eee;
	background: #fff;                      /* stays readable over content */
}

/* Read-only + focus tweaks for the same field */
#loc-survey-screen input#loc-survey-start-pos:is([readonly], [readonly]:focus) {
	background-image: none !important;
	outline: none !important;
	box-shadow: none !important;
	border: 1px solid #444 !important;
}

#sectors-fieldset .form-row {
	grid-template-columns: 1fr;
}
#sectors-fieldset .loc-sector-row > label {
	display: none;
}

#pplans-fieldset .plan-element-row + .plan-element-row,
#sectors-fieldset .loc-sector-row + .loc-sector-row {
	border-top: 1px solid #8faf8f;
/*	margin-top: 8px;	*/
/*	padding-top: 8px;	*/
}


#sectors-fieldset .inline-group {
	display: grid;										/* override the generic flex */
	grid-template-columns: max-content max-content 1fr auto auto;	/* Dec | Hex | input | button		*/
	grid-template-rows: auto auto;						/* row 1: radios, row 2: controls */
	column-gap: 10px;
	row-gap: 6px;
	align-items: start;
	justify-content: center;			/* center the text+button pair		*/
}

#sectors-fieldset .inline-group > label {
	display: inline-flex;				/* radio + text inline				*/
	align-items: center;
	gap: 8px;
}

#sectors-fieldset .inline-group > label:nth-of-type(1) {
	grid-row: 1;
	grid-column: 2;
}

#sectors-fieldset .inline-group > label:nth-of-type(2) {
	grid-row: 1;
	grid-column: 3;
}

#sectors-fieldset .inline-group > .sector-ecgi {
	grid-row: 2;
	grid-column: 1;
}

#sectors-fieldset .inline-group > input[type="text"] {
	grid-row: 2;
	grid-column: 2 / span 2;
}

#sectors-fieldset .inline-group > .sector-add {
	grid-row: 2;
	grid-column: 4;
}

#sectors-fieldset .inline-group > .sector-del {
	grid-row: 2; 
	grid-column: 4;
}

#sectors-fieldset {
	background-color: #f7e1be;					/* desert orange for "Cells of Interest' */
}

.loc-survey-id-row input[type="text"] {
	max-width: 260px;
}

.loc-survey-select {
	padding: 6px 10px;
}


.loc.survey-form {
	display: flex;
	flex-direction: column;
}

.suffix {
	min-width: 52px;
	text-align: left;
}




/****************************************
*				Survey Plan				*
****************************************/

.plan-container {
	display: flex;
	flex-direction: column;
	flex: 1;									/* fill the dialog */
	min-height: 0;								/* allow child overflow areas to shrink */
	padding: 0;
	background-color: #e0ffff;					/* very pale cyan for 'Survey Plan' screen */
}
.plan-form {
	display: flex;
	flex-direction: column;
	flex: 1;						/* fill the dialog */
	min-height: 0;						/* allow child overflow areas to shrink */
}


#plan-screen {
	position: fixed;
	top: calc(var(--status-bar-height) + 2.5vw);
	transform: translateX(-50%);
	bottom: 2.5vw;
	height: calc(100dvh - var(--status-bar-height) -5vw);
	max-height: none;
	max-width: 100vw;
	box-sizing: border-box;
	padding: 0;
	padding-bottom: 10px;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background-color: #e5ffff;				/* very pale cyan for 'Survey Plan' screen */
}
#plan-screen .form-buttons {
	flex-shrink: 0;							/* never collapse */
	padding: 12px 16px;
	border-top: 1px solid #eee;
	background: #eff;
}

#plan-screen .plan-form > .form-row {
	padding: 0 16px;
}

#plans-fieldset {
	background-color: #c8ffff;				/* medum pale blue for 'Plan Elements' panel in plans */
}

/* Keep legend ('Plan Elements') and border in place	*/
#plan-screen .form-scroll {
	display: flex;
	flex-direction: column;
	flex: 1;						/* fill space between top rows and buttons */
	min-height: 0;					/* allow interal scroller to shrink */
	overflow-y: hidden;				/* rows inside scroll instead */
}
#plan-screen #plans-fieldset {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
}
#plan-element-rows {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}


/* Alternating backgrounds for plan element rows */
/* 1st, 3rd, 5th, ... rows: original panel color */
#plan-element-rows > .plan-element-row {
	background-color: #95ffff;									/* #cff */
/*	width: 100%;
	box-sizing: border-box;		*/
}

/* 2nd, 4th, 6th, ... rows: slightly darker cyan */
#plan-element-rows > .plan-element-row:nth-child(even) {
	background-color: #00dddd;									/* slightly darker cyan */
}

#plans-fieldset .plan-element-row1 {
	flex-wrap: nowrap;
	gap: 4px;
}

.plan-element-row2 {
	display: inline-flex;
	flex: 0 0 100%;
	gap: 0px;
	align-items: center;
}

/*
.element-id-valid-plan {
	display: inline-flex;
	align-items: center;
}
*/
.element-validity-plan {
	display: inline-flex;
	align-items: center;
}

.element-buttons-plan {
	margin-left: auto;
	display: inline-flex;
	gap: 4px;
}

.element-desc-label-plan {
	margin-left: 3px;
}

#plans-fieldset input.element-desc-plan {
	margin-left: 0;
	margin-right: 0;
	max-width: 35%;					/* absolute max of 50% of container	*/
	flex: 0 1 35%;					/* 0=don't grow beyond basis, */
									/* 1=can shrink, 50%=flex with basis */
	min-width: 0;
	border: 1px solid #444;			/* normal border */
	outline: none;
	box-shadow: none;	
}


.element-up-plan {
	order: 99;
}


/*
.element-valid-label-plan {
	margin-left: 2px;
	margin-right: 2px;
	flex: 0 0 auto;
}

#plans-fieldset .element-valid-plan {
	border: none;
	background: transparent;
	padding: 0;
	margin-right: 0;
	width: 3ch;           /* just enough for "yes"/"no" 
	flex: 0 0 auto;
	text-align: left;
	font: inherit;
	box-shadow: none;
	outline: none;
}
*/

#plans-fieldset .form-row {
	grid-template-columns: 1fr;
}

/* NEW */
#plans-fieldset .plan-element-row {
	padding: 8px 4px;
}


.form-row .plan-element-row1 {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}



.element-type-plan {
	width: max-content;
	box-sizing: border-box;
	padding: 6px 8px;
	font-size: 1rem;
}


#plans-fieldset input.element-seq-plan {
	border: none;
	background: transparent;
	padding: 0;
	margin-right: 8px;      /* space before the dropdown */
	width: 1ch;             /* about two characters wide */
	font: inherit;          /* match surrounding text */
	box-shadow: none;
	outline: none;
	flex: 0 0 auto;         /* don't let flexbox shrink it to nothing */
	position: relative;
	top: 1.25em;
}

#plans-fieldset input.element-validity-plan,
#plans-fieldset input.element-id-plan {
	border: none;
	background: transparent;
	padding: 0;
	width: auto;            /* not full width */
	font: inherit;
	box-shadow: none;
	outline: none;
	flex: 0 0 auto;
	min-width: 0;
	max-width: 7ch;        /* short label-like field */
}

#plans-fieldset input.element-id-plan.unspecified {
	margin-left: 3px;
	color: #ff0000;							
}

/*
#plans-fieldset .element-valid-plan {
	margin-left: 3px;
	color: #000000;
}

#plans-fieldset .element-valid-plan[value="no"] {
	color: #ff0000;
}
*/
#plans-fieldset .element-validity-plan[value="invalid"] {
	color: #ff0000;
}
#plans-fieldset .element-validity-plan {
	margin-left: 3px;
	color #0000ff;
}

/*
.desc-label-plan {
	margin-left: 0;
}
*/
.desc-label-plan {
	margin-left: calc(1ch + 10px);
}




/****************************************
*				Map region				*
****************************************/

#map {
	flex: 1;
	width: 100%;
	position: relative;
	min-height: 200px; /* safety fallback if flex fails */
	
	/****************/
	z-index: 1;
}


/* Override global button styles inside Leaflet controls */
.leaflet-bar .easy-button-button {
	padding: 0;
	font-size: 18px;
	text-align: center;
}



/****************************************
*				Guide compass			*
****************************************/

/* Guide-to-Location dialog */
#guide-dialog {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%,-50%);
	background-color: #eff;
	padding: 20px;
	border: 2px solid #b00;
	border-radius: 10px;
	z-index: 1000;
	width: 90%;
	max-width: 360px;
	text-align: center;
}

.guide-title {
	font-weight: 600;
	margin-bottom: .5rem;
}

.guide-compass {
	position: relative;
	margin: 10px auto;
	width: 220px;
	height: 220px;
	border: 2px solid #333;
	border-radius: 50%;
	box-shadow: inset 0 0 8px rgba(0,0,0,.1);
}

.guide-needle {
	position: absolute;
	left: 50%;
	bottom: 50%;
	width: 2px;
	height: 42%;
	background: #b00;
	transform-origin: 50% 100%;
	transform: translateX(-50%) rotate(0deg);
}

.guide-n-label {
	position: absolute;
	top: -6px;
	left: 50%;
	transform: translateX(-50%);
	font-weight: 600;
}

.guide-distance {
	font-size: 1.1rem;
	margin-top: 10px;
}

/* heading readout inside the compass (center-anchored) */
.guide-heading {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	font-weight: 600;
	font-size: 1.25rem;
	line-height: 1;
	pointer-events: none;
	user-select: none;
}

.guide-heading.above {
	margin-top: -0.75em;
}

/* Size of the up-arrow inside the compass */
.guide-n-label {
	font-size: 2rem;
}

.guide-heading.below {
	margin-top: 0.75em;
}




/********************************************
*				Capture lat/lon				*
********************************************/

#capture-wrap {
	position: absolute;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);

top: 85%;
transform: translate (-50%, -50%);
z-index: 5000;
}

#capture-inner {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	gap: 8px;		/* “close together” */
}

input#capture-loc {
	width: 200px;
	min-height: 26px;
	padding: 2px 6px;
	background: #eee !important;
	backgruond-color: #eee !important;
	border: 1px solid #444 !important;
	pointer-events: none;
}

#capture-button {
	font: inherit;
}





html {
	height: 100%;
}



/* Consolidated Start Pos field styles */
/* #loc-survey-screen input#loc-survey-start-pos {	*/
.input-readonly {
	background: #eee;
	width: auto;
	max-width: 100%;
	flex: 0 1 auto;
	white-space: nowrap;
	border: 1px solid #444;
}


