/***********************************************************
    Combined project-edit + surveys + question-unit styling
************************************************************/

/* --- Base Reset / Box-Sizing --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Body & Global Styles ---
body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: url('/css/img/Trail-in-Fairfax-on-the-way-1024x768-1024x585.jpg') no-repeat center center fixed;
  background-size: cover;
  color: #111;
} */

/* Container for main content (Project Edit + general pages) */
.container {
  width: 90%;
  max-width: 1000px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-radius: 8px;
}

/* --- Header & Button Group --- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.button-group {
  display: flex;
  gap: 0.75rem;
}

/* --- Buttons (save, close, etc.) --- */
.save-button,
.close-button {
  background-color: #007bff;
  color: #fff;
  border: none;
  margin-right: 10px;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.save-button:hover,
.close-button:hover {
  background-color: #0056b3;
}
/* "Close" as red button (if wanted) */
.close-button {
  font-size: 1.2rem;
  background: #dc3545;
}
.close-button:hover {
  background-color: #c82333;
}

/* Basic form spacing */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: inline-block;
  margin-bottom: 0.3rem;
  font-weight: 600;
}

/* --- Inputs, Textareas, Selects --- */
input[type="text"],
textarea,
select {
  width: 100%;
  padding: 0.65rem;
  margin-bottom: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  background: #fff;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Hidden utility class */
.hidden {
  display: none !important;
}

/* Category display order hidden by default */
#cat-display-order {
  display: none;
}

/* --- Modal + Overlay --- */
.modal {
  display: none; /* hidden by default */
  position: fixed;
  z-index: 999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  /* For centering modals: */
  display: flex; 
  align-items: center;
  justify-content: center;
}
.modal.hidden {
  display: none !important;
}
.modal-content {
  background-color: #fff;
  margin: 5% auto; 
  padding: 1.5rem;
  border: 1px solid #888;
  border-radius: 6px;
  width: 90%;
  max-width: 600px;
  position: relative;
}
.modal-content .close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  color: #333;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
}
.modal-content .close:hover,
.modal-content .close:focus {
  color: #dc3545;
  text-decoration: none;
  outline: none;
}

.modal-content.form-modal-content {
     width: 90%;           /* So it uses most space on mobile */
     max-width: 420px;     /* Desired max width on desktop */
     margin: 5% auto;      /* Center it horizontally */
     padding: 1.25rem;     /* Provide comfortable spacing */
     background-color: #fff;
     border-radius: 8px;
     position: relative;
   }

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    width: 95%;
    margin: 1rem auto;
    padding: 1rem;
  }
  .header h2 {
    font-size: 1.25rem;
  }
  input[type="text"],
  textarea,
  select {
    font-size: 0.95rem;
  }
  .save-button,
  .close-button {
    font-size: 0.9rem;
    padding: 0.5rem 0.8rem;
  }
}

/* ADVANCED SECTION */
.advanced-section {
  margin: 1em 0;
  border: 1px solid #ccc;
  padding: 1em;
  border-radius: 6px;
  background-color: #f9f9f9;
}
#advanced-toggle {
  cursor: pointer;
  font-weight: 600;
  margin-top: 1em;
  color: #007bff;
}
#advanced-toggle:hover {
  text-decoration: underline;
}

/* SURVEY BUILDER / SURVEYS-SPECIFIC */

/* Surveys list */
#surveys-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1.2rem;
}
#surveys-list li {
  background: #f5f5f5;
  margin-bottom: 0.4rem;
  padding: 0.6rem 0.8rem;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#surveys-list li strong {
  margin-right: 1rem;
}
#surveys-list button {
  margin-left: 0.4rem;
}

/* Survey builder container */
#survey-builder {
  background: #fafafa;
  border: 1px solid #ddd;
  padding: 1rem;
  border-radius: 5px;
  margin-top: 1.2rem;
}
#survey-builder-title {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* For each question row in the builder (slight green) */
.survey-question-row {
  margin-bottom: 1rem;
  padding: 0.8rem;
  background-color: #EEEEEE;  
  border-bottom: 1px solid #ccc;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* The first row with type/label/required, smaller select width */
.survey-question-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}
.survey-question-header select {
  padding: 0.3rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100px;
}
.survey-question-header input[type="text"] {
  min-width: 240px;
  font-weight: bold; 
  font-size: 1.05rem;
}

.survey-question-row img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0.5rem 0;
  }

.question-options-panel {
  margin-left: 0.5rem;
  margin-top: 0.5rem;
  padding-left: 1rem;
  border-left: 2px dashed #ccc;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.question-options-panel ul {
  list-style-type: disc;
  margin-left: 1.5rem;
  margin-bottom: 0.5rem;
  padding-left: 0;
}
.question-options-panel li {
  margin-bottom: 0.4rem;
}
.question-options-panel button {
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  margin-right: 0.5rem;
  font-size: 0.8rem;
}
.question-options-panel button:hover {
  background: #ddd;
}

/* Move up/down/remove row controls */
.question-row-controls {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
  justify-content: flex-end;
}
.question-row-controls button {
  background: #ddd;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.question-row-controls button:hover {
  background: #ccc;
}

/* "Create New Survey" */
#create-survey-button {
  background: #28a745;
  border: none;
  color: #fff;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 1rem;
}
#create-survey-button:hover {
  background: #218838;
}

/* "Save Survey" / "Cancel" in builder */
/* --- Buttons (save, close, etc.) --- */
.save-button,
.close-button {
  background-color: #007bff; /* base color */
  color: #fff;
  border: none;
  margin-right: 10px;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.save-button:hover,
.close-button:hover {
  background-color: #0056b3;
}

/* "Close" as red button (if wanted) */
.close-button {
  font-size: 1.2rem;
  background: #dc3545;
}
.close-button:hover {
  background-color: #c82333;
}

/* Smaller screens */
@media (max-width: 768px) {
  .survey-question-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .question-options-panel ul {
    margin-left: 1rem;
  }
  #survey-builder,
  .survey-question-row {
    padding: 1rem;
    border-bottom: 1px solid #ddd;
  }
}

/* “View Survey” modal */
#view-survey-modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0; 
  top: 0;
  width: 100%; 
  height: 100%;
  background-color: rgba(0,0,0,0.5);
}
#view-survey-modal .modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 1em;
  width: 80%;
  max-width: 600px;
  position: relative;
  border-radius: 6px;
}
#view-survey-modal .modal-content .close {
  position: absolute;
  right: 1em;
  top: 0.5em;
  cursor: pointer;
  font-size: 1.2rem;
}

/* Quill or other rich-text images */
.ql-editor img {
  max-width: 100%;
  height: auto;
}
#view-survey-questions img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Lighter font for instructions or descriptions */
.survey-question-description {
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
  margin-bottom: 0.5rem;
}

/* Required field tag */
.survey-required-badge {
  color: red;
  margin-left: 3px;
  font-weight: normal;
}

/* Buttons in “Preview Survey” */
.preview-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: flex-end;
}
.preview-buttons button {
  background-color: #007bff;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
}
.preview-buttons button:hover {
  background-color: #0056b3;
}

/* Additional modal (if used for category tabs) */
.category-modal-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.5rem;
}
.category-modal-tabs button {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 1rem;
}
.category-modal-tabs button.active {
  border-bottom: 3px solid #007bff;
}
.cat-tab-content.hidden {
  display: none;
}
#category-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1em;
}
#category-table th,
#category-table td {
  border: 1px solid #ddd;
  padding: 0.5rem;
  text-align: left;
}
#category-table th {
  background: #f8f8f8;
}

/* Icon buttons */
.geom-icon {
  font-size: 1.2rem;
  cursor: default;
  margin-right: 6px;
}
.action-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  margin: 0 4px;
}
.action-btn i {
  font-size: 1rem;
  color: #555;
}
.action-btn i:hover {
  color: #000;
}

/* Nav buttons wrap on small screens */
.nav-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1em;
}

/* “Surveys” button (yellow) */
.surveys-button {
  background-color: #ffc107;
  color: #111;
  border: none;
  margin: 0 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 5px;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.surveys-button:hover {
  background-color: #e0a800;
}

/* “Go to Full Map” button => green */
.go-map-button {
  background-color: #28a745;
  color: #fff;
  border: none;
  margin-right: 10px;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.go-map-button:hover {
  background-color: #218838;
}



/* Example small icon styling */
.icon-button {
  background-color: #ddd;
  border: none;
  border-radius: 4px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-button:hover {
  background-color: #ccc;
}
.icon-button-yellow {
  background-color: #FFD700;
  color: #333;
}
.icon-button-yellow:hover {
  background-color: #FFC400;
}

/* The map area */
#initial-map {
  width: 100%;
  min-height: 400px;
  box-sizing: border-box;
}

/* =============== Toast Styling =============== */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
}
.toast-message {
  background: #333;
  color: #fff;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  opacity: 0.9;
  transition: opacity 0.5s;
}
.toast-message.success {
  background: #28a745;
}
.toast-message.error {
  background: #dc3545;
}

/***********************************************************
   Additional question-unit styling & photo-block
************************************************************/
/* If you want to unify “question-unit” usage for new forms: */

.question-unit {
  margin-bottom: 1rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 0.75rem;
  background-color: #fdfdfd; /* subtle background */
}

/* Label for question */
.question-label {
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #333;
}

/* Optional instructions in subdued text */
.question-instructions {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.6rem;
  line-height: 1.2;
}

/* Photo block ensuring no overflow */
.photo-block img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.5rem 0;
  border-radius: 4px;
}


.survey-input.error {
  border: 2px solid red;    /* highlight in red */
  background-color: #ffe6e6; /* optional subtle red background */
}

/* The modal content might already be styled. Add a scroll area for #comments-container: */
.comments-scroll {
  max-height: 200px; /* or something comfortable */
  overflow-y: auto;
  margin-bottom: 1rem;
}

/* Truncate .comment-text to 2 lines, until .expanded is toggled */
.comment-text {
  display: -webkit-box;
  -webkit-line-clamp: 2; 
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal; /* ensure wrapping */
  margin-bottom: 0.5rem;
}

/* When parent .comment has .expanded, remove line clamp. */
.comment.expanded .comment-text {
  -webkit-line-clamp: unset; 
}

/* Expand link: small style */
.comment-info a.expand-link {
  margin-left: 1rem;
  font-size: 0.85rem;
  text-decoration: underline;
  color: #007bff;
}
.comment-info a.expand-link:hover {
  color: #0056b3;
}

#feature-modal .modal-content {
  width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  max-width: 90vw;
  box-sizing: border-box;
}

/* Feature Comments Section */
#feature-modal-comments-list {
  max-height: 250px;        /* Adjust as you like (e.g. 300px) */
  overflow-y: auto;         /* Scroll if there's a long list of comments */
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  padding: 1rem;
  border-radius: 5px;
  margin-bottom: 1rem;
}

/* Each comment block */
.feature-comment-item {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #ccc;
}

/* Remove bottom border on the last item */
.feature-comment-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* Slight spacing for paragraphs */
.feature-comment-item p {
  margin: 0.3rem 0;
}

.feature-comment-item strong {
  font-weight: 600;
  margin-right: 0.3rem;
}

.gray-button {
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ccc;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s;
}
.gray-button:hover {
  background-color: #e6e6e6;
}

.close-button {
  background-color: #dc3545;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}
.close-button:hover {
  background-color: #c82333;
}

#about-surveys-btn {
  min-width: 44px;  /* or 48px, whichever looks good */
  text-align: center;
}

/* Hide Mapbox’s invisible “sizer” input so no phantom bar shows */
.mapboxgl-ctrl-geocoder .mapboxgl-ctrl-geocoder--input[style*="pointer-events:none"]{
  opacity:0 !important;
  height:0 !important;
  padding:0 !important;
  border:0 !important;
}

/* Collapse the suggestions wrapper when there are no suggestion rows */
.mapboxgl-ctrl-geocoder .suggestions-wrapper:not(:has(.mapboxgl-ctrl-geocoder--suggestion)){
  display:none !important;
  padding:0 !important;
  border:0 !important;
  height:0 !important;
}
/* Remove Mapbox Geocoder's bottom margin when the list is closed */
.mapboxgl-ctrl-geocoder:not(:has(.mapboxgl-ctrl-geocoder--suggestion)) {
  margin-bottom: 0 !important;
}

/* Remove Mapbox Geocoder container border / bg so only the input shows */
.mapboxgl-ctrl-geocoder{
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}


/* June 18 */
/* ── Survey-builder header row  ───────────────────────────────── */
.question-row-header{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:6px;          /* small breathing room */
}
.question-label-input{        /* ⇠ new utility class */
  flex:1 1 260px;             /* grow but keep min width */
  min-width:200px;
}
.question-type-select{        /* ⇠ new utility class */
  margin-left:auto;           /* push to far right */
  width:110px;
  padding:4px 6px;
}

/* Required + Present on one line */
.required-present-wrap{
  display:flex;
  align-items:center;
  gap:10px;
}

#survey-panel {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.survey-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.survey-panel-card {
  position: relative;
  margin: 5vh auto;
  max-width: 640px;
  background: white;
  border-radius: 8px;
  padding: 1rem;
  max-height: 90vh;
  overflow: auto;
}

.survey-header,
.survey-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.survey-footer {
  margin-top: 1rem;
}

/* Two-column checkbox/radio grid */
.wm-checkline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}