/* jch-noise-map-events.css - Enhanced with Plugin #1 Form Styling */

/* =================================================================
   FORM STYLING FROM PLUGIN #1 - Query Interface
   ================================================================= */

/* NEW */

.layer-permanentnoisemonitors .layer-color-square {
    background-color: #B91C1C !important;
}

[class*="school"] .layer-color-square {
    background-color: #1E3A8A !important;
}

[class*="boundary"] .layer-color-square {
    background-color: #808080 !important;
}

[class*="1991"] .layer-color-square {
    background-color: #FFFF00 !important;
}

[class*="2018"] .layer-color-square {
    background-color: #00FFAA !important;
}

[class*="2032"] .layer-color-square {
    background-color: #00FF00 !important;
}



/* Form container styling */
.jch-noise {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Report options row layout */
.report_options_row { 
    display: flex; 
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.report_options_row > div { 
    display: block; 
    flex: 1; 
    min-width: 200px;
}

.report_options_row.report_and_graph {
    border: solid 1px #ccc;
    border-radius: 4px;
    padding: 15px;
    background: white;
    max-width: 300px;
    justify-content: center;
}

.report_options_row > .monitor_id { 
    min-width: 350px;
    flex: 2;
}

/* Form input styling */
.jch-noise input[type="text"],
.jch-noise select {
    width: 100%;
    margin-bottom: 1em;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.jch-noise input[type="text"]:focus,
.jch-noise select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Checkbox styling */
.jch-noise input[type="checkbox"] + label {
    font-weight: 500;
    cursor: pointer;
}

.jch-noise input[type="checkbox"] {
    margin-bottom: 1em;
    margin-right: 7px;
    margin-left: 20px;
    transform: scale(1.1);
}    

.jch-noise input.penalty + span {
	color: orange;
}
.jch-noise input.penalty.fq  +  span {
	color: red;
}
.jch-noise input.fq  +  span {
	color: yellow;
}


.jch-noise .checkbox_all {
    margin-left: 0;
    font-weight: bold;
}

.jch-noise .checkbox_subtotal {
    margin-left: 0;
}

/* Submit button styling */
.jch-noise input[type="submit"] {
    display: block;
    margin: 0 0 2em 1em;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.jch-noise input[type="submit"]:hover {
}

.jch-noise input[type="submit"]:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Checkbox wrapper styling */
.checkbox_wrapper {
    height: 200px;
    margin: 0 0 2rem;
    border: solid 1px #aaa;
    border-radius: 5px;
    padding-bottom: 8px;    
    background: white;
}

.checkbox_select {
    border: none;
    height: calc(100% - 1rem);
    overflow: auto;
    margin-top: 12px;
    margin-left: 6px;
    font-size: 12px;
    padding-right: 10px;
}

.checkbox_wrapper.monitor_id {
    /* Specific styling for monitor selection */
}

/* Date selection wrapper */
.date_selections_wrapper {
    max-width: 45%;
    margin-right: 10px;
}

.flight_type_selections_wrapper,
.date_selections_wrapper {
    max-width: 50%;
}

.flight_type_selections,
.noise_level_selections {
    min-width: 20%;    
    max-width: 50%;
}

/* Label styling */
.jch-noise label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.jch-noise label a {
    font-weight: normal;
    text-decoration: none;
}

.jch-noise label a:hover {
    text-decoration: underline;
}

.jch-noise label a:before { 
    content: "(";
}

.jch-noise label a:after { 
    content: ")";
}

.jch-noise label span.subtext {
    display: block;
    font-weight: normal;
    font-size: smaller;
    color: #666;
    margin-top: 2px;
}

/* =================================================================
   LABEL STYLING CONSTANTS - Customize these for different layers
   ================================================================= */

/* Default Point Labels */
.point-label {
    background: white !important;
    color: black !important;
    border: 1px solid black !important;
    border-radius: 3px !important;
    padding: 2px 6px !important;
    font-size: 11px !important;
    font-weight: normal !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important;
}

/* Permanent Noise Monitor Labels */
.point-label-monitor {
    background: rgba(255,255,200,.8) !important;
    color: rgba(255,0,0,.5) !important;
    border: 1px solid red !important;
    border-radius: 4px !important;
    padding: 3px 8px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5) !important;
}

/* School Labels */
.point-label-school {
    background: rgba(200,255,255,.5) !important;
    color: darkblue !important;
    border: 1px solid darkblue !important;
    border-radius: 2px !important;
    padding: 2px 5px !important;
    font-size: 10px !important;
    font-weight: normal !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

/* =================================================================
   MAP CONTAINER STYLING
   ================================================================= */

.jch-noise-map-events-container {
  
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.fullscreen .jch-noise-map-events-container { height: 100vh !important;}


.fullscreen .jch-qgis-controls {}

.jch--controls {
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.control-group label {
    font-weight: 500;
    color: #333;
    margin: 0;
    white-space: nowrap;
}

.opacity-slider {
    width: 100px;
    height: 4px;
    border-radius: 2px;
    background: #ddd;
    outline: none;
    cursor: pointer;
}

.opacity-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.opacity-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0073aa;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.opacity-value {
    min-width: 35px;
    font-weight: 500;
    color: #0073aa;
}

select.city-filter {
    width: 100%;
}


.layers-group {
    flex-direction: column;
    align-items: flex-start;
    min-width: 200px;
}

.layers-header {
    margin-bottom: 8px;
}

.layers-header label {
    font-weight: 500;
    color: #333;
    margin: 0;
}

.layer-controls {
	  float: left;
    width: 100%;
    padding: 0 2em 1em 2em;
    font-size: 85%;
}

.custom-layer-controls,
.layer-controls .layer-year-group,
.layer-controls .layer-misc-group {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 0;
}


.layer-controls .layer-year-group {
    margin-bottom: 2em;
		padding-bottom: 1em;
		border-bottom: solid 1px #ccc;
}

.layer-controls .layer-year-misc {
	
}


.layer-controls-loading {
    text-align: center;
    padding: 20px;
    font-size: 1.2em;
}

.layer-controls-loading {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.7); /* semi-transparent overlay */
  z-index: 9999;
  text-align: center;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  font-family: sans-serif;
  font-size: 1rem;
  color: #333;
}

.layer-controls-loading
 {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 2s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}



.layer-control {
    align-items: center;
}

.layer-control label {

    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    color: #555;
}

.layer-color-square {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid #ccc;
    display: inline-block;
}

.layer-control .count {
    color: black;
}

.layer-control .count::before {
    content: "(";
}

.layer-control .count::after {
    content: ")";
}

.layer-control input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
    accent-color: #0073aa;
}

.jch-map-legend { margin: 2em 0; width: 100%; }


.jch-map-legend .inner {
	width: 70%;
	margin: 0 0;
	padding: 15px 15px 15px 2em;
	background: #f8f9fa;
	border: 1px solid #ddd;
	border-radius: 6px;
	display: none;
}

.jch-map-legend.active .inner {
	display: block;
}

.jch-map-legend.fullscreen .inner {
	width: 70%;
	margin-top: 2em;
	margin-right: 1em;
}

.jch-legend-btn,
.jch-fullscreen-btn {
  	margin: 2em 2em 2em 0;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.jch-legend-btn {
	margin: 2em 0em 2em 0;
	float: right;
}

.jch-fullscreen-btn {
    position: absolute;
    top: 1em;
    left: 2em;
    transition: background-color 0.2s ease;
}

.jch-map-legend.fullscreen .jch-legend-btn {
	float: right;
	margin: calc(2em + 6px) 2em 0;
}



.jch-legend-btn:hover,
.jch-fullscreen-btn:hover {
    background: #005a87;
}

.jch-fullscreen-btn:active {
    transform: translateY(1px);
}

.jch-noise-map-events-map {
    background: black;
    position: relative;
    z-index: 1;
}

/* =================================================================
   QUERY SUMMARY STYLING
   ================================================================= */

#jch-query-summary {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    border: 1px solid #2196f3;
    border-left: 4px solid #0073aa;
    border-radius: 6px;
    padding: 15px 20px;
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#jch-query-summary strong {
    color: #0d47a1;
    font-weight: 600;
}

#jch-query-summary small {
    color: #666;
    font-size: 12px;
}

/* =================================================================
   FULLSCREEN MODE
   ================================================================= */

.jch-noise-map-events-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    margin: 0;
    border-radius: 0;
    border: none;
    height: 100vh;
}

.jch-map-legend.fullscreen {
    position: fixed;
    top: 0;
    right: 0;
		width: 50%;
    z-index: 10000;
}




.jch-noise-map-events-container.fullscreen .jch-noise-map-events-map { height: 100vh !important; top: 0; position: fixed;}

.jch-noise-map-events-container.fullscreen .jch-fullscreen-btn {
    position: fixed;
    z-index: 10000;
    top: 32px;
    left: 72px;
}

.jch-qgis-controls {
    padding: 15px;
}

.control-group {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    margin: 0 0 2em 7em;
    padding: 1em 1.4em;
    background: rgba(200,220,255,.1);
}


.jch-noise-map-events-container.fullscreen .jch-controls,
.jch-noise-map-events-container.fullscreen .layer-controls
 {
	display:none;
}

/* =================================================================
   ERROR STATES
   ================================================================= */

.jch-noise-map-error {
    padding: 40px 20px;
    text-align: center;
    background: #f8f9fa;
    color: #666;
    border: 2px dashed #ddd;
    margin: 20px;
    border-radius: 8px;
}

.jch-qgis-error {
    padding: 40px 20px;
    text-align: center;
    background: #f8f9fa;
    color: #666;
    border: 2px dashed #ddd;
    margin: 20px;
    border-radius: 8px;
}

.jch-qgis-error h3 {
    color: #d63638;
    margin: 0 0 15px 0;
}

.jch-qgis-error p {
    margin: 10px 0;
    line-height: 1.5;
}

/* =================================================================
   LOADING STATE
   ================================================================= */

.jch-qgis-loading {
    position: relative;
}

.jch-qgis-loading::after {
    content: "Loading QGIS map data...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.95);
    padding: 15px 25px;
    border-radius: 6px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* =================================================================
   RESPONSIVE DESIGN
   ================================================================= */

@media (max-width: 768px) {
    .report_options_row {
        flex-direction: column;
        gap: 15px;
    }
    
    .report_options_row > div {
        min-width: auto;
        flex: none;
    }
    
    .report_options_row > .monitor_id {
        min-width: auto;
    }
    
    .date_selections_wrapper {
        max-width: 100%;
        margin-right: 0;
    }
    
    .jch-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .control-group {
        justify-content: space-between;
        min-width: auto;
    }
    
    .layer-controls {
        max-width: none;
        justify-content: space-between;
    }
    
    .layer-control {
        flex: 1;
        min-width: 120px;
    }
    
    .jch-fullscreen-btn {
        flex: 1;
        margin: 2px;
    }
    
    .checkbox_wrapper {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .jch-noise {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .report_options_row {
        gap: 10px;
    }
    
    .jch-noise-map-events-container {
        margin: 10px 0;
        border-radius: 4px;
    }
    
    .jch--controls {
        padding: 12px;
    }
    
    .layer-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .layer-control {
        min-width: auto;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .control-group label {
        text-align: center;
    }
    
    .checkbox_wrapper {
        height: 120px;
    }
    
    .checkbox_select {
        font-size: 11px;
    }
    
    #jch-query-summary {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* =================================================================
   LEAFLET CUSTOMIZATIONS
   ================================================================= */

/* Custom Leaflet popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.leaflet-popup-content {
    margin: 12px 16px;
    line-height: 1.4;
}

.leaflet-popup-content strong {
    color: #333;
}

/* Enhanced popup for noise monitors */
.leaflet-popup-content h4 {
    color: #1e40af;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

/* =================================================================
   PRINT STYLES
   ================================================================= */

@media print {
    .jch-noise,
    .jch--controls,
    #jch-query-summary {
        display: none !important;
    }
    
    .jch-noise-map-events-container {
        border: none;
        box-shadow: none;
        margin: 0;
    }
    
    .jch-noise-map-events-map {
        height: 80vh !important;
        width: 100% !important;
    }
}