/* required styles */

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
	position: absolute;
	left: 0;
	top: 0;
	}
.leaflet-container {
	overflow: hidden;
	}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
	-webkit-user-select: none;
	   -moz-user-select: none;
	        user-select: none;
	  -webkit-user-drag: none;
	}
/* Prevents IE11 from highlighting tiles in blue */
.leaflet-tile::selection {
	background: transparent;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
	image-rendering: -webkit-optimize-contrast;
	}
/* hack that prevents hw layers "stretching" when loading new tiles */
.leaflet-safari .leaflet-tile-container {
	width: 1600px;
	height: 1600px;
	-webkit-transform-origin: 0 0;
	}
.leaflet-marker-icon,
.leaflet-marker-shadow {
	display: block;
	}
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container .leaflet-overlay-pane svg {
	max-width: none !important;
	max-height: none !important;
	}
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile {
	max-width: none !important;
	max-height: none !important;
	width: auto;
	padding: 0;
	}

.leaflet-container img.leaflet-tile {
	/* See: https://bugs.chromium.org/p/chromium/issues/detail?id=600120 */
	mix-blend-mode: plus-lighter;
}

.leaflet-container.leaflet-touch-zoom {
	-ms-touch-action: pan-x pan-y;
	touch-action: pan-x pan-y;
	}
.leaflet-container.leaflet-touch-drag {
	-ms-touch-action: pinch-zoom;
	/* Fallback for FF which doesn't support pinch-zoom */
	touch-action: none;
	touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
	-ms-touch-action: none;
	touch-action: none;
}
.leaflet-container {
	-webkit-tap-highlight-color: transparent;
}
.leaflet-container a {
	-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
}
.leaflet-tile {
	filter: inherit;
	visibility: hidden;
	}
.leaflet-tile-loaded {
	visibility: inherit;
	}
.leaflet-zoom-box {
	width: 0;
	height: 0;
	-moz-box-sizing: border-box;
	     box-sizing: border-box;
	z-index: 800;
	}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
	-moz-user-select: none;
	}

.leaflet-pane         { z-index: 400; }

.leaflet-tile-pane    { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane  { z-index: 500; }
.leaflet-marker-pane  { z-index: 600; }
.leaflet-tooltip-pane   { z-index: 650; }
.leaflet-popup-pane   { z-index: 700; }

.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg    { z-index: 200; }

.leaflet-vml-shape {
	width: 1px;
	height: 1px;
	}
.lvml {
	behavior: url(#default#VML);
	display: inline-block;
	position: absolute;
	}


/* control positioning */

.leaflet-control {
	position: relative;
	z-index: 800;
	pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
	pointer-events: auto;
	}
.leaflet-top,
.leaflet-bottom {
	position: absolute;
	z-index: 1000;
	pointer-events: none;
	}
.leaflet-top {
	top: auto;
	bottom: 0;
}
.leaflet-control-zoom {
    margin-left: 10px !important;
    margin-bottom: 30px !important;
}
.leaflet-right {
	right: 0;
	}
.leaflet-bottom {
	bottom: 0;
	}
.leaflet-left {
	left: 0;
	}
.leaflet-control {
	float: left;
	clear: both;
	}
.leaflet-right .leaflet-control {
	float: right;
	}
.leaflet-top .leaflet-control {
	margin-top: 10px;
	}
.leaflet-bottom .leaflet-control {
	margin-bottom: 10px;
	}
.leaflet-left .leaflet-control {
	margin-left: 10px;
	}
.leaflet-right .leaflet-control {
	margin-right: 10px;
	}


/* zoom and fade animations */

.leaflet-fade-anim .leaflet-popup {
	opacity: 0;
	-webkit-transition: opacity 0.2s linear;
	   -moz-transition: opacity 0.2s linear;
	        transition: opacity 0.2s linear;
	}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
	opacity: 1;
	}
.leaflet-zoom-animated {
	-webkit-transform-origin: 0 0;
	    -ms-transform-origin: 0 0;
	        transform-origin: 0 0;
	}
svg.leaflet-zoom-animated {
	will-change: transform;
}

.leaflet-zoom-anim .leaflet-zoom-animated {
	-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
	   -moz-transition:    -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
	        transition:         transform 0.25s cubic-bezier(0,0,0.25,1);
	}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile {
	-webkit-transition: none;
	   -moz-transition: none;
	        transition: none;
	}

.leaflet-zoom-anim .leaflet-zoom-hide {
	visibility: hidden;
	}


/* cursors */

.leaflet-interactive {
	cursor: pointer;
	}
.leaflet-grab {
	cursor: -webkit-grab;
	cursor:    -moz-grab;
	cursor:         grab;
	}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
	cursor: crosshair;
	}
.leaflet-popup-pane,
.leaflet-control {
	cursor: auto;
	}
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive,
.leaflet-dragging .leaflet-marker-draggable {
	cursor: move;
	cursor: -webkit-grabbing;
	cursor:    -moz-grabbing;
	cursor:         grabbing;
	}

/* marker & overlays interactivity */
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
	pointer-events: none;
	}

.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
	pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
	pointer-events: auto;
	}

/* visual tweaks */

.leaflet-container {
	background: #ddd;
	outline-offset: 1px;
	}
.leaflet-container a {
	color: #0078A8;
	}
.leaflet-zoom-box {
	border: 2px dotted #38f;
	background: rgba(255,255,255,0.5);
	}


/* general typography */
.leaflet-container {
	font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-size: 0.75rem;
	line-height: 1.5;
	}


/* general toolbar styles */

.leaflet-bar {
	box-shadow: 0 1px 5px rgba(0,0,0,0.65);
	border-radius: 4px;
	}
.leaflet-bar a {
	background-color: #fff;
	border-bottom: 1px solid #ccc;
	width: 26px;
	height: 26px;
	line-height: 26px;
	display: block;
	text-align: center;
	text-decoration: none;
	color: black;
	}
.leaflet-bar a,
.leaflet-control-layers-toggle {
	background-position: 50% 50%;
	background-repeat: no-repeat;
	display: block;
	}
.leaflet-bar a:hover,
.leaflet-bar a:focus {
	background-color: #f4f4f4;
	}
.leaflet-bar a:first-child {
	border-top-left-radius: 4px;
	border-top-right-radius: 4px;
	}
.leaflet-bar a:last-child {
	border-bottom-left-radius: 4px;
	border-bottom-right-radius: 4px;
	border-bottom: none;
	}
.leaflet-bar a.leaflet-disabled {
	cursor: default;
	background-color: #f4f4f4;
	color: #bbb;
	}

.leaflet-touch .leaflet-bar a {
	width: 30px;
	height: 30px;
	line-height: 30px;
	}
.leaflet-touch .leaflet-bar a:first-child {
	border-top-left-radius: 2px;
	border-top-right-radius: 2px;
	}
.leaflet-touch .leaflet-bar a:last-child {
	border-bottom-left-radius: 2px;
	border-bottom-right-radius: 2px;
	}

/* zoom control */

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
	font: bold 18px 'Lucida Console', Monaco, monospace;
	text-indent: 1px;
	}

.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out  {
	font-size: 22px;
	}


/* layers control */

.leaflet-control-layers {
	box-shadow: 0 1px 5px rgba(0,0,0,0.4);
	background: #fff;
	border-radius: 5px;
	}
.leaflet-control-layers-toggle {
	background-image: url(images/layers.png);
	width: 36px;
	height: 36px;
	}
.leaflet-retina .leaflet-control-layers-toggle {
	background-image: url(images/layers-2x.png);
	background-size: 26px 26px;
	}
.leaflet-touch .leaflet-control-layers-toggle {
	width: 44px;
	height: 44px;
	}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
	display: none;
	}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
	display: block;
	position: relative;
	}
.leaflet-control-layers-expanded {
	padding: 6px 10px 6px 6px;
	color: #333;
	background: #fff;
	}
.leaflet-control-layers-scrollbar {
	overflow-y: scroll;
	overflow-x: hidden;
	padding-right: 5px;
	}
.leaflet-control-layers-selector {
	margin-top: 2px;
	position: relative;
	top: 1px;
	}
.leaflet-control-layers label {
	display: block;
	font-size: 13px;
	font-size: 1.08333em;
	}
.leaflet-control-layers-separator {
	height: 0;
	border-top: 1px solid #ddd;
	margin: 5px -10px 5px -6px;
	}

/* Default icon URLs */
.leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */
	background-image: url(images/marker-icon.png);
	}


/* attribution and scale controls */

.leaflet-container .leaflet-control-attribution {
	background: #fff;
	background: rgba(255, 255, 255, 0.8);
	margin: 0;
	}
.leaflet-control-attribution,
.leaflet-control-scale-line {
	padding: 0 5px;
	color: #333;
	line-height: 1.4;
	}
.leaflet-control-attribution a {
	text-decoration: none;
	}
.leaflet-control-attribution a:hover,
.leaflet-control-attribution a:focus {
	text-decoration: underline;
	}
.leaflet-attribution-flag {
	display: inline !important;
	vertical-align: baseline !important;
	width: 1em;
	height: 0.6669em;
	}
.leaflet-left .leaflet-control-scale {
	margin-left: 5px;
	}
.leaflet-bottom .leaflet-control-scale {
	margin-bottom: 5px;
	}
.leaflet-control-scale-line {
	border: 2px solid #777;
	border-top: none;
	line-height: 1.1;
	padding: 2px 5px 1px;
	white-space: nowrap;
	-moz-box-sizing: border-box;
	     box-sizing: border-box;
	background: rgba(255, 255, 255, 0.8);
	text-shadow: 1px 1px #fff;
	}
.leaflet-control-scale-line:not(:first-child) {
	border-top: 2px solid #777;
	border-bottom: none;
	margin-top: -2px;
	}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
	border-bottom: 2px solid #777;
	}

.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
	box-shadow: none;
	}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
	border: 2px solid rgba(0,0,0,0.2);
	background-clip: padding-box;
	}


/* popup */

.leaflet-popup {
	position: absolute;
	text-align: center;
	margin-bottom: 20px;
	}
.leaflet-popup-content-wrapper {
	padding: 1px;
	text-align: left;
	border-radius: 12px;
	}
.leaflet-popup-content {
	margin: 13px 24px 13px 20px;
	line-height: 1.3;
	font-size: 13px;
	font-size: 1.08333em;
	min-height: 1px;
	}
.leaflet-popup-content p {
	margin: 17px 0;
	margin: 1.3em 0;
	}
.leaflet-popup-tip-container {
	width: 40px;
	height: 20px;
	position: absolute;
	left: 50%;
	margin-top: -1px;
	margin-left: -20px;
	overflow: hidden;
	pointer-events: none;
	}
.leaflet-popup-tip {
	width: 17px;
	height: 17px;
	padding: 1px;

	margin: -10px auto 0;
	pointer-events: auto;

	-webkit-transform: rotate(45deg);
	   -moz-transform: rotate(45deg);
	    -ms-transform: rotate(45deg);
	        transform: rotate(45deg);
	}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
	background: white;
	color: #333;
	box-shadow: 0 3px 14px rgba(0,0,0,0.4);
	}
.leaflet-container a.leaflet-popup-close-button {
	position: absolute;
	top: 0;
	right: 0;
	border: none;
	text-align: center;
	width: 24px;
	height: 24px;
	font: 16px/24px Tahoma, Verdana, sans-serif;
	color: #757575;
	text-decoration: none;
	background: transparent;
	}
.leaflet-container a.leaflet-popup-close-button:hover,
.leaflet-container a.leaflet-popup-close-button:focus {
	color: #585858;
	}
.leaflet-popup-scrolled {
	overflow: auto;
	}

.leaflet-oldie .leaflet-popup-content-wrapper {
	-ms-zoom: 1;
	}
.leaflet-oldie .leaflet-popup-tip {
	width: 24px;
	margin: 0 auto;

	-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
	filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
	}

.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
	border: 1px solid #999;
	}


/* div icon */

.leaflet-div-icon {
	background: #fff;
	border: 1px solid #666;
	}


/* Tooltip */
/* Base styles for the element that has a tooltip */
.leaflet-tooltip {
	position: absolute;
	padding: 6px;
	background-color: #fff;
	border: 1px solid #fff;
	border-radius: 3px;
	color: #222;
	white-space: nowrap;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	pointer-events: none;
	box-shadow: 0 1px 3px rgba(0,0,0,0.4);
	}
.leaflet-tooltip.leaflet-interactive {
	cursor: pointer;
	pointer-events: auto;
	}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
	position: absolute;
	pointer-events: none;
	border: 6px solid transparent;
	background: transparent;
	content: "";
	}

/* Directions */

.leaflet-tooltip-bottom {
	margin-top: 6px;
}
.leaflet-tooltip-top {
	margin-top: -6px;
}
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-top:before {
	left: 50%;
	margin-left: -6px;
	}
.leaflet-tooltip-top:before {
	bottom: 0;
	margin-bottom: -12px;
	border-top-color: #fff;
	}
.leaflet-tooltip-bottom:before {
	top: 0;
	margin-top: -12px;
	margin-left: -6px;
	border-bottom-color: #fff;
	}
.leaflet-tooltip-left {
	margin-left: -6px;
}
.leaflet-tooltip-right {
	margin-left: 6px;
}
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
	top: 50%;
	margin-top: -6px;
	}
.leaflet-tooltip-left:before {
	right: 0;
	margin-right: -12px;
	border-left-color: #fff;
	}
.leaflet-tooltip-right:before {
	left: 0;
	margin-left: -12px;
	border-right-color: #fff;
	}

/* Printing */

@media print {
	/* Prevent printers from removing background-images of controls. */
	.leaflet-control {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
		}
	}
	
	/* Mobile tweaks for small screens */
/* Mobile tweaks - Clean "Three Corners" Layout */
@media (max-width: 600px) {

    /* 1. SLIDE-IN MENU: Full width */
    #controls {
        width: 85vw;
        padding: 16px;
    }
    .close-panel {
        font-size: 24px;
        padding: 10px;
    }

    /* 2. HIDE REDUNDANT CONTROLS */
    /* Hide Zoom (+/-) and Fit All on mobile */
    .leaflet-control-zoom,
    #zoomToggle {
        display: none !important; 
    }

    /* 3. BUTTON STYLES (Shared) */
    #menuBtn, #toggleIndex {
        height: 48px;                  
        min-width: 48px;
        font-size: 14px !important;    
        display: flex;                 
        align-items: center;
        justify-content: center;
        touch-action: manipulation;    
        box-shadow: 0 2px 5px rgba(0,0,0,0.3);
        padding: 0 16px;
        position: absolute; 
        width: auto !important;
    }

    /* --- CORNER 1: TOP LEFT (Menu) --- */
    #menuBtn {
        top: 16px !important;
        left: 16px !important;
        right: auto !important;
        bottom: auto !important;
        margin: 0;
    }

    /* --- CORNER 2: TOP RIGHT (Territories) --- */
    #toggleIndex { 
        top: 16px !important; 
        right: 16px !important; 
        left: auto !important;
        bottom: auto !important;
        margin: 0;
    }

    /* --- CORNER 3: BOTTOM RIGHT (GPS) --- */
    #gpsButton {
        width: 52px;
        height: 52px;
        bottom: 30px !important; 
        right: 16px !important;
        top: auto !important;
        left: auto !important;
    }
    

    /* 4. MAP SCALE (Bottom Left) */
    /* Since "Fit All" is gone, we let the scale sit comfortably at the bottom left */
    .leaflet-control-scale {
        margin-bottom: 35px !important; /* Aligns with GPS button */
        margin-left: 16px !important;
    }

    /* 5. LIST PANELS */
    .file-entry { padding: 12px 8px; font-size: 14px; }
    .delete-btn { padding: 10px; }

    #polygonIndex {
        top: 70px;      
        right: 16px;
        bottom: 90px;   
        width: 75vw;
    }
    
    .polygon-item { padding: 12px; font-size: 14px; }
}

    /* Basic Page Styles */
    html, body { height: 100%; margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overflow: hidden; }
    #map { width: 100%; height: 100%; background: #ddd; }
    


    /* --- Sliding Panel (Menu) --- */
    #controls { 
        position: absolute; top: 0; left: 0; bottom: 0;
        width: 300px; background: white; z-index: 2000;
        box-shadow: 2px 0 5px rgba(0,0,0,0.3);
        padding: 20px; overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        display: flex; flex-direction: column;
    }
    #controls.open { transform: translateX(0); }
    
    .close-panel { 
        align-self: flex-end; cursor: pointer; font-size: 24px; 
        color: #666; margin-bottom: 10px; font-weight: bold;
    }
    
    /* --- File List Styles --- */
    .file-list { margin-top: 10px; border-top: 1px solid #eee; padding-top: 5px; }
    .file-entry { display: flex; justify-content: space-between; align-items: center; padding: 8px; font-size: 13px; border-radius: 4px; }
    .delete-btn { cursor: pointer; font-weight: bold; padding: 0 8px; }

    /* --- Progress Bar --- */
    #progressContainer { display: none; margin-top: 10px; }
    #progressBar { width: 100%; height: 10px; background: #eee; border-radius: 5px; overflow: hidden; }
    #progressFill { height: 100%; background: #28a745; width: 0%; transition: width 0.2s; }

    /* --- Floating Map Controls (Right Side) --- */
   
    
/* 3. GPS Button (Bottom Right) */
#gpsButton { 
    position: absolute; bottom: 30px; right: 10px; z-index: 1000; 
    background: white; width: 40px; height: 40px; border-radius: 4px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.3); cursor: pointer; 
    display: flex; align-items: center; justify-content: center; font-size: 20px;
    border: none; /* Matches Fit All and Territories */
}
#gpsButton:hover { background: #f4f4f4; }
#gpsButton.active { background: #4CAF50; color: white; }
#gpsButton.searching { background: #FFC107; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

    /* --- Polygon List Panel (Popup) --- */
    #polygonIndex { 
        position: absolute; top: 60px; right: 60px; bottom: 80px;
        z-index: 999; background: white; width: 250px; padding: 10px;
        border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.3); 
        overflow-y: auto; display: none;
    }
    #polygonIndex.visible { display: block; }
    .polygon-item { padding: 8px; margin: 2px 0; cursor: pointer; }

    /* --- Status Styles --- */
    .online { color: green; } .offline { color: red; }
	
	/* --- Custom Floating Alert --- */
#customAlertOverlay {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 99999; /* Above everything */
    min-width: 300px; max-width: 80%;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: none; /* Hidden by default */
    animation: slideDown 0.3s ease-out;
    border-left: 5px solid #2196F3;
}
@keyframes slideDown { from { top: -100px; opacity: 0; } to { top: 20px; opacity: 1; } }

#customAlertMsg { margin-bottom: 15px; font-size: 14px; color: #333; line-height: 1.5; }

.alert-btn {
    padding: 8px 20px; border: none; border-radius: 4px; 
    cursor: pointer; font-weight: bold; margin: 0 5px;
    transition: background 0.2s;
}
.btn-ok { background: #2196F3; color: white; }
.btn-ok:hover { background: #1976D2; }
.btn-cancel { background: #eee; color: #333; }
.btn-cancel:hover { background: #ddd; }
.btn-danger { background: #d32f2f; color: white; }

/* --- Password Overlay --- */
#passwordOverlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 100000;
    display: none; align-items: center; justify-content: center;
}
#passwordBox {
    background: white; padding: 20px; border-radius: 8px;
    width: 300px; text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border-top: 5px solid #333;
}
#passInput {
    width: 90%; padding: 8px; margin: 15px 0;
    border: 1px solid #ccc; border-radius: 4px; font-size: 16px;
}

/* Replace the existing button styles with this unified approach */

/* --- Modern Floating Buttons --- */

/* --- Modern Floating Buttons (Menu & Search) --- */
#menuBtn, #toggleIndex {
    position: absolute;
    
    top: 15px;
    
    z-index: 1000;
    
    /* Modern Appearance */
    background: white;
    color: #333;
    padding: 10px 20px;
    border-radius: 30px; 
    border: none;
    
    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    
    /* Soft Shadow */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    
    /* Interactive */
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Positioning */
#menuBtn { left: 20px; }
#toggleIndex { right: 20px; }

/* Add Search Icon */
#toggleIndex::before {
    content: "🔍";
    font-size: 14px;
}

/* Hover Effects */
#menuBtn:hover, #toggleIndex:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
#menuBtn:active, #toggleIndex:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: #f5f5f5;
}

/* --- MOBILE TWEAKS --- */
@media (max-width: 600px) {
    
    /* Keep top buttons reachable but compact on mobile */
    #menuBtn, #toggleIndex {
        padding: 8px 16px;
        font-size: 13px;
        /* Ensure safe area applies here too */
        top: calc(env(safe-area-inset-top) + 15px); 
    }
    #menuBtn { left: 15px; }
    #toggleIndex { right: 15px; }

    /* 2. BIGGER GPS BUTTON ON MOBILE */
    #gpsButton {
        width: 60px !important;   /* Was 52px */
        height: 60px !important;  /* Was 52px */
        bottom: 40px !important;  /* Moved up slightly */
        right: 20px !important;
        
        /* Make the icon inside bigger too */
    }
    #gpsButton svg {
        width: 32px !important;   /* Was 28px */
        height: 32px !important;
    }
}

/* 3. Add Search Icon via CSS (Optional polish) */
#toggleIndex::before {
    content: "🔍"; /* Adds a search icon automatically */
    font-size: 14px;
}

/* 4. Hover & Active States */
#menuBtn:hover, #toggleIndex:hover {
    background: #ffffff;
    transform: translateY(-2px); /* Slight lift effect */
    box-shadow: 0 6px 16px rgba(0,0,0,0.2); /* Deepen shadow */
}

#menuBtn:active, #toggleIndex:active {
    transform: translateY(0); /* Press down */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: #f5f5f5;
}

/* 5. Mobile Adjustments (Keep them uniform on small screens) */
@media (max-width: 600px) {
    #menuBtn, #toggleIndex {
        top: 15px;
        padding: 8px 16px;
        font-size: 13px;
    }
    #menuBtn { left: 15px; }
    #toggleIndex { right: 15px; }
}

/* --- Google-Style GPS Marker --- */
.user-location-icon {
    background: transparent;
    border: none;
}

.gps-dot {
    width: 16px;
    height: 16px;
    background-color: #4285F4; /* Google Blue */
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.gps-pulse {
    width: 40px;
    height: 40px;
    background-color: rgba(66, 133, 244, 0.4);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    animation: gps-pulse-anim 2s infinite;
}

@keyframes gps-pulse-anim {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

/* --- Delete Button Visibility --- */
.delete-btn { 
    display: none; /* Hidden by default */
}

/* Only show when body has 'admin-mode' class */
body.admin-mode .delete-btn { 
    display: inline-block; 
}

/* --- Accordion & Search Styles --- */
#polygonIndex {
    /* Existing styles... ensure padding is sufficient */
    display: flex;
    flex-direction: column;
    max-height: 70vh; /* Prevent it from being taller than screen */
}



/* The Scrollable Area */
#listScrollContainer {
    overflow-y: auto;
    flex: 1;
    display: none; /* HIDDEN BY DEFAULT */
    border-top: 1px solid #eee;
    margin-top: 5px;
}

/* Update this specific style */
#listScrollContainer {
    overflow-y: auto;
    flex: 1;
    display: none; /* HIDDEN BY DEFAULT */
    border-top: 1px solid #eee;
    margin-top: 5px;
}



/* KMZ Headers */
.kmz-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding: 12px 10px;
    margin-bottom: 2px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* The Arrow Icon */
.kmz-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

/* Rotate arrow when open */
.kmz-header.active .kmz-arrow {
    transform: rotate(180deg);
}

/* The Container for Polygons (Hidden by default) */
.kmz-content {
    display: none;
    padding-left: 5px;
    margin-bottom: 5px;
}

.kmz-content.visible {
    display: block;
}

/* Individual Polygon Items */
.polygon-item {
    /* Your existing styles... */
    padding: 10px;
    margin: 1px 0;
    cursor: pointer;
    font-size: 14px;
}

/* --- Floating Panel (The Container) --- */
#polygonIndex { 
    position: absolute; 
    top: 60px; 
    right: 60px; 
    /* removed bottom: 80px -> allows it to shrink */
    max-height: 70vh; /* Cap the height so it doesn't go off screen */
    z-index: 999; 
    background: white; 
    width: 250px; 
    padding: 10px;
    border-radius: 4px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.3); 
    
    /* Flex column allows the list to grow/shrink */
    display: none; 
    flex-direction: column;
}

#polygonIndex.visible { 
    display: flex; 
}



/* --- The Scrollable List (Hidden Initially) --- */
#listScrollContainer {
    display: none; /* HIDDEN: This makes the parent box shrink */
    overflow-y: auto;
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 5px;
    flex: 1; /* Takes available space up to max-height */
}

/* Mobile Tweak: Adjust position for small screens */
@media (max-width: 600px) {
    #polygonIndex {
        top: 70px;
        right: 16px;
        width: 60vw; /* Slightly wider on mobile */
    }
}

/* --- Floating Panel (Container) --- */
#polygonIndex { 
    position: absolute; 
    top: 60px; 
    right: 60px; 
    max-height: 70vh; 
    width: 260px; 
    z-index: 999; 
    background: white; 
    border-radius: 6px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
    
    /* Flex layout to handle headers/lists */
    display: none; 
    flex-direction: column; 
    overflow: hidden; /* Clips corners */
}

#polygonIndex.visible { 
    display: flex; 
}

/* --- Level 1: Map List Styles --- */
.map-select-header {
    padding: 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.map-card {
    padding: 15px;
    margin: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.map-card:active { transform: scale(0.98); }
.map-card::after { content: '›'; font-size: 18px; font-weight: bold; }

/* --- Level 2: Polygon List Styles --- */
.back-header {
    padding: 10px;
    background: #f4f4f4;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    display: flex;
    align-items: center;
    color: #555;
}
.back-header:hover { background: #eee; color: #000; }
.back-icon { margin-right: 8px; font-size: 16px; }



#level2List {
    overflow-y: auto;
    flex: 1;
}

.poly-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 14px;
}
.poly-item:hover { background: #f9f9f9; }

/* Mobile Tweak */
@media (max-width: 600px) {
    #polygonIndex { top: 70px; right: 16px; width: 70vw; }
}



.file-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px; 
}

.file-header::after {
    content: '▼';
    font-size: 10px;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg); 
    transition: transform 0.2s;
}

.file-header.expanded::after {
    transform: translateY(-50%) rotate(0deg); 
}

.file-content-group {
    display: none; 
    padding-left: 5px; 
}

.file-content-group.visible {
    display: block;
}


.password-box {
  width: 100%;
  padding: 15px;
  border-top: 1px solid #eee;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.password-box label {
  font-size: 14px;
  color: #000;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.password-box input[type="email"],
.password-box input[type="password"],
.password-box input[type="text"] {
  width: 100%;
  height: 42px;
  padding: 10px;
  font-size: 14px;
  line-height: 22px;         /* lock text metrics */
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  appearance: none;
}



.show-password {
  flex-direction: row;
  align-items: center;
  
  gap: 8px;
  font-size: 13px;
  color: #000;
}

#loginBtn {
  margin-top: 8px;
  height: 42px;
  font-size: 14px;
  border: 1px solid #ddd;
  background: #000;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}

#loginBtn:active {
  opacity: 0.85;
}

#closeInstBtn {
    cursor: pointer;
    padding: 5px;
    font-weight: bold;
    color: #666;
    transition: color 0.2s;
}

#closeInstBtn:hover {
    color: #000;
}

/* Ensure the overlay uses flex for alignment */
/* #instructionOverlay — canonical styles below near "Admin Help Overlay" */

/* Admin Panel Container */
#adminPanel {
    margin-top: 10px;
    text-align: left;
    background: #f9f9f9;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #eee;
}

/* Section Containers */
.admin-section {
    margin-bottom: 12px;
}

/* Primary Labels (Steps) */
.admin-label {
    font-size: 12px;
    font-weight: bold;
    display: block;
    color: #444;
}

/* Base Button Style for Admin Panel */
.admin-btn {
    width: 100%;
    margin-top: 4px;
    cursor: pointer;
    padding: 8px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    transition: background 0.2s;
}

.admin-btn:hover {
    background: #f0f0f0;
}

/* Dark Button Variant (Export) */
.btn-dark {
    background: #333;
    color: #fff;
    border: none;
}

.btn-dark:hover {
    background: #000;
}

/* Settings Divider Section */
.settings-divider {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
}

/* Settings Uppercase Label */
.settings-label {
    font-size: 11px;
    font-weight: bold;
    display: block;
    color: #888;
    text-transform: uppercase;
}

/* Smaller Buttons for Settings */
.btn-small {
    padding: 6px;
    font-size: 12px;
}

/* Danger Button (Reset) */
.btn-danger-outline {
    color: #d32f2f;
    border: 1px solid #fdeaea;
    background: #fff;
}

.btn-danger-outline:hover {
    background: #fff5f5;
}

/* Instructions Button Container */
#openHelpBtn {
    margin-top: 20px;
    padding: 10px;
    background: #eef6f9;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    border: 1px solid #d1e3eb;
    transition: background-color 0.2s ease;
}

#openHelpBtn:hover {
    background: #e1eff5; /* Subtle color change when hovering */
}

/* Instructions Button Text */
.help-btn-text {
    color: #0078A8;
    font-size: 13px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Custom Select Dropdown Styling */
.admin-select {
    width: 100%;
    margin-top: 4px;
    cursor: pointer;
    padding: 8px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    font-size: 13px; /* Matches your labels/buttons */
    color: #444;
    outline: none;
    appearance: none; /* Removes default browser styling */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
}

.admin-select:hover {
    background-color: #f0f0f0;
    border-color: #bbb;
}

.admin-select:focus {
    border-color: #0078A8; /* Matches your theme blue */
}


/* --- Admin Help Overlay --- */
#instructionOverlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.6); 
    z-index: 999999;
    display: none; 
    
    /* FIX: 'left' is not valid for flexbox. Use 'center' to center the modal on screen */
    align-items: center; 
    justify-content: center;
    
    backdrop-filter: blur(2px);
}

#instructionBox {
    background: white; 
    width: 90%; 
    max-width: 600px; 
    max-height: 90vh;
    border-radius: 8px; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
    animation: zoomIn 0.2s ease-out;

    /* FIX: Ensure the box itself doesn't force centering */
    text-align: left; 
}

#instructionHeader {
    background: #333; 
    color: white; 
    padding: 15px;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    font-size: 16px; 
    font-weight: bold;
    
    /* Header usually looks better with standard alignment */
    text-align: left; 
}

#instructionBody {
    padding: 20px; 
    overflow-y: auto; 
    font-size: 14px; 
    line-height: 1.6; 
    color: #333;

    /* FIX: FORCE text to the left */
    text-align: left !important; 
}

/* Optional: Ensure the table inside isn't centered either */
#instructionBody table th,
#instructionBody table td {
    text-align: left;
}

.inst-step { margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.inst-step:last-child { border-bottom: none; }
.inst-title { font-weight: bold; color: #0078A8; font-size: 15px; margin-bottom: 5px; display: block; }
.inst-note { background: #fff3cd; padding: 8px; border-radius: 4px; font-size: 12px; margin-top: 5px; border: 1px solid #ffeeba; }

#closeInstBtn { cursor: pointer; font-size: 24px; line-height: 1; opacity: 0.8; }
#closeInstBtn:hover { opacity: 1; color: #ffeb3b; }

@keyframes zoomIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }


/* The Container for the buttons */
.admin-button-style {
    background-color: #f0f8ff; /* Light blue background */
    border: 1px solid #d1e3f5; /* Soft blue border */
    border-radius: 8px;        /* Rounded corners */
    padding: 12px;
    margin-top: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.admin-button-style:hover {
    background-color: #e1f0ff;
    border-color: #b8d4f0;
}

/* The Text inside the buttons */
.help-btn-text {
    color: #0078A8;           /* Blue text color */
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Collapsible logic for Admin Tools */
#adminTools {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    max-height: 0;
    background: #ffffff;
    border-radius: 0 0 8px 8px;
}

#adminTools.expanded {
    max-height: 500px;
    margin-top: -5px; /* Pulls it up to "connect" to the button */
    border: 1px solid #d1e3f5;
    border-top: none;
    padding: 15px 10px;
    margin-bottom: 10px;
}

.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000;
}

.custom-modal-box {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.custom-modal-box h3 { margin-top: 0; color: #333; }
.custom-modal-box p { color: #666; font-size: 14px; }

#adminPassInput {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border: 2px solid #d1e3f5;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    box-sizing: border-box;
}

.custom-modal-actions {
    display: flex;
    gap: 10px;
}

.modal-btn-primary, .modal-btn-secondary {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.modal-btn-primary { background: #0078A8; color: white; }
.modal-btn-secondary { background: #eee; color: #666; }

.password-box {
    max-width: 500px;
    background: white;
    padding: 24px;
    border-radius: 8px;
}

/* Container for Email + Remember */
.input-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 10px;
}

/* Let the email box take up the available width */
.email-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.email-field label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    display: block;
}

/* Container for Password + Show Password */
.password-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
}

/* Let the password box take up the available width */
.password-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.password-field label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    display: block;
}

/* Style the remember checkbox area - fixed width */
.remember-me {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    white-space: nowrap;
    padding-bottom: 2px;
    cursor: pointer;
    margin: 0;
    width: 95px;
}

/* Style the show password checkbox area - fixed width */
.show-password {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    white-space: nowrap;
    padding-bottom: 2px;
    cursor: pointer;
    margin: 0;
    width: 95px;
}

/* Input styling */
.password-box input[type="email"], 
.password-box input[type="password"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.password-box input[type="email"]:focus, 
.password-box input[type="password"]:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

/* Checkbox styling */
.password-box input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Button styling */
.password-box button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.password-box #loginBtn {
    background: #0066cc;
    color: white;
    margin-bottom: 8px;
}

.password-box #loginBtn:hover {
    background: #0052a3;
}

.password-box #newAccountBtn {
    background: #f0f0f0;
    color: #333;
}

.password-box #newAccountBtn:hover {
    background: #e0e0e0;
}

/* Sticky Search Bar */
#polySearchInput {
    width: 90%;
    padding: 10px;
    margin: 5px auto 10px auto;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    /* Keeps search visible while scrolling list */
    position: sticky; 
    top: 0;
    z-index: 10;
}

/* Optional: Make the search input look more like a button initially */
#polySearchInput {
    /* existing styles... */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    background-repeat: no-repeat;
    background-position: 10px center;
    padding-left: 35px; /* Make room for icon */
}

/* --- The Search Bar --- */
#polySearchInput {
    width: 100%; /* Full width of container */
    padding: 10px;
    box-sizing: border-box; /* Ensures padding doesn't break width */
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    /* Icon styling */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    background-repeat: no-repeat;
    background-position: 10px center;
    padding-left: 35px;
}

#polySearchInput {
    margin: 8px;
    width: calc(100% - 16px); /* Full width minus margin */
    padding: 10px 10px 10px 35px; /* Room for icon */
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    background-repeat: no-repeat;
    background-position: 10px center;
}

/* --- Search & Accordion Styles --- */
#polySearchInput {
    width: 90%;
    padding: 8px;
    margin: 5px auto 10px auto;
    display: block;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}


#polySearchInput {
    /* Final Dimensions & Spacing (From Block 5) */
    display: block;
    width: 90%;
    margin: 5px auto 10px auto;
    padding: 8px; /* Note: This overrides the 35px icon padding from previous blocks */

    /* Persistent Layout (From Block 1 & 3) */
    position: sticky;
    top: 0;
    z-index: 10;
    box-sizing: border-box; /* Persists from Block 3, keeps padding inside width */

    /* Standard Styling (From all blocks) */
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    
    /* Clean up */
    background-image: none; /* Ensures the symbol is gone */
}





/* Style for the toggle button */
#toggleAdminBtn {
    width: 100%;
    margin: 10px 0;
    padding: 10px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s;
}

#toggleAdminBtn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

/* Hidden section styling */
#adminHiddenSection {
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 15px;
    margin-top: 5px;
    background: #f9f9f9;
}

.password-field {
    position: relative;
}

.show-password-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    user-select: none;
}

.remember-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 15px;
    font-size: 13px;
    color: #666;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#password {
    width: 100%;
    padding-right: 40px; /* Make room so the text doesn't go under the eye */
}

#showPasswordIcon {
    position: absolute;
    right: 10px;
    cursor: pointer;
    z-index: 10; /* Ensure it sits ON TOP of the input field */
    padding: 5px;
}


/* Territory Type Badge */
#territoryTypeBadge {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    pointer-events: none;
    display: none;
    text-align: center;
}

/* Business badge style */
#territoryTypeBadge[data-type="business"] {
    background: #f59e0b; /* Orange */
}

/* Residential badge style */
#territoryTypeBadge[data-type="residential"] {
    background: #3b82f6; /* Blue */
}
/* Remove the problematic white bar styles */
@media (max-width: 600px) {

    
    /* Keep only the positioning fixes without the visual bar */
    #menuBtn {
        top: calc(env(safe-area-inset-top, 15px) + 5px) !important;
    }
    
    #toggleIndex {
        top: calc(env(safe-area-inset-top, 15px) + 5px) !important;
    }
    
    #territoryTypeBadge {
        top: calc(env(safe-area-inset-top, 15px) + 5px) !important;
    }
    

}



/* Create a bottom control cluster for mobile */
@media (max-width: 600px) {
    #gpsButton {
        bottom: 40px !important;
        right: 20px !important;
        width: 60px !important;
        height: 60px !important;
        z-index: 1001;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3); /* More prominent shadow */
    }
    
    /* Optional: Add a small label for clarity */
    #gpsButton::after {
        content: 'GPS';
        position: absolute;
        bottom: -18px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 10px;
        color: #333;
        font-weight: bold;
        white-space: nowrap;
        background: rgba(255,255,255,0.9);
        padding: 2px 6px;
        border-radius: 3px;
        opacity: 0;
        transition: opacity 0.3s;
    }
    
    #gpsButton:hover::after,
    #gpsButton:active::after {
        opacity: 1;
    }
    
    /* Adjust map scale to be higher up */
    .leaflet-control-scale {
        margin-bottom: 110px !important;
        margin-left: 16px !important;
        background: rgba(255, 255, 255, 0.8);
        border-radius: 4px;
        padding: 4px 8px;
    }
}

.show-password-icon {
    position: absolute;
    right: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: #333; /* Ensure this isn't white-on-white */
    user-select: none;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#password {
    padding-right: 60px; /* Make space so text doesn't overlap the button */
}



