/* =========================
   CE Locations – Submission Modal
========================= */

/* Modal backdrop */
.ce-location-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.ce-location-modal[aria-hidden="false"] {
  display: flex;
}

.ce-location-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

/* Dialog */
.ce-location-modal__dialog {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 32px;
}

/* Close button */
.ce-location-modal__close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #6c757d;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.ce-location-modal__close:hover {
  color: #212529;
  background: #f1f3f5;
}

/* Heading */
.ce-location-modal__heading {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.3;
  color: #212529;
}

.ce-location-modal__intro {
  margin: 0 0 20px;
  font-size: 14px;
  color: #6c757d;
}

/* Form fields */
.ce-location-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ce-location-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ce-location-field--row {
  flex-direction: row;
  gap: 12px;
}

.ce-location-field--row > .ce-location-field {
  flex: 1;
}

.ce-location-field label {
  font-size: 13px;
  font-weight: 600;
  color: #343a40;
}

.ce-location-field label abbr {
  color: #d63638;
  text-decoration: none;
  margin-left: 2px;
}

.ce-location-field select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  color: #212529;
  background: #fff;
  box-sizing: border-box;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236c757d' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ce-location-field select:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.ce-location-field input[type="text"],
.ce-location-field input[type="email"],
.ce-location-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  color: #212529;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ce-location-field input[type="text"]:focus,
.ce-location-field input[type="email"]:focus,
.ce-location-field textarea:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.ce-location-help {
  margin: 0;
  font-size: 12px;
  color: #6c757d;
}

/* Geocode autocomplete */
.ce-geocode-wrap {
  position: relative;
}

.ce-geocode-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
}

.ce-geocode-results:empty {
  display: none;
}

.ce-geocode-result {
  padding: 10px 12px;
  font-size: 13px;
  color: #212529;
  cursor: pointer;
  border-bottom: 1px solid #f1f3f5;
  transition: background 0.1s ease;
}

.ce-geocode-result:last-child {
  border-bottom: none;
}

.ce-geocode-result:hover,
.ce-geocode-result[aria-selected="true"] {
  background: #e9ecef;
}

/* Selected location display */
.ce-selected-location {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 6px;
  font-size: 13px;
  color: #2e7d32;
  margin-top: 4px;
}

.ce-selected-location::before {
  content: "✓";
  font-weight: 700;
  flex-shrink: 0;
}

/* Feedback */
.ce-submit-feedback {
  font-size: 14px;
  border-radius: 6px;
  min-height: 0;
  transition: all 0.2s ease;
}

.ce-submit-feedback:not(:empty) {
  padding: 10px 14px;
}

.ce-submit-feedback.is-error {
  background: #fdecea;
  border: 1px solid #f5c6cb;
  color: #b32d2e;
}

.ce-submit-feedback.is-success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #2e7d32;
}

/* File inputs */
.ce-location-field input[type="file"] {
  width: 100%;
  padding: 6px 0;
  font-size: 13px;
  color: #495057;
  cursor: pointer;
}

/* Image preview thumbnails */
.ce-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.ce-image-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  display: block;
}

/* Suggested category — hidden by default, revealed via jQuery slideDown */
.ce-suggested-cat-wrap {
  display: none;
}

/* Submit button */
.ce-location-form__actions {
  padding-top: 4px;
}

.ce-location-form__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: #d63638;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.ce-location-form__submit:hover {
  background: #b32d2e;
}

.ce-location-form__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Body lock when modal is open */
body.ce-modal-open {
  overflow: hidden;
}

/* Responsive */
@media (max-width: 520px) {
  .ce-location-modal__dialog {
    padding: 20px;
  }

  .ce-location-field--row {
    flex-direction: column;
  }
}
