/**
 * BM Events Calendar - Public Submission Form
 * Namespaced, minimal styling that inherits the theme's typography.
 */

.bm-submission-form {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* The kind-switching JS hides sections via the hidden attribute, which
   any authored display value would otherwise override */
.bm-submission-form [hidden] {
  display: none !important;
}

.bm-submission-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
}

.bm-submission-form label em {
  color: #b32d2e;
  font-style: normal;
}

.bm-submission-form input[type="text"],
.bm-submission-form input[type="email"],
.bm-submission-form input[type="url"],
.bm-submission-form input[type="date"],
.bm-submission-form input[type="time"],
.bm-submission-form select,
.bm-submission-form textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  font: inherit;
  font-weight: 400;
  width: 100%;
  box-sizing: border-box;
}

.bm-submission-form small {
  font-weight: 400;
  color: #666;
}

.bm-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Date/time row: as many fields as fit on one line (hidden fields
   don't take a column, so repeating events show 3 across, the other
   kinds 4), wrapping naturally on narrow screens */
.bm-sub-when {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 600px) {
  .bm-sub-row,
  .bm-sub-when {
    grid-template-columns: 1fr;
  }
}

/* Agreement */
.bm-sub-agreement {
  background: #f6f7f7;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  padding: 1.5rem 1.75rem;
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.95em;
  line-height: 1.6;
}

/* wpautop paragraph margins would double up against the box padding */
.bm-sub-agreement p:first-child {
  margin-top: 0;
}

.bm-sub-agreement p:last-child {
  margin-bottom: 0;
}

.bm-sub-agree-check {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.6rem !important;
}

.bm-sub-agree-check input {
  margin-top: 0.25rem;
}

/* Categories */
.bm-sub-categories {
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bm-sub-categories legend {
  font-weight: 600;
  padding: 0 0.4rem;
}

.bm-sub-category {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.6rem !important;
  font-weight: 400 !important;
}

.bm-sub-category input {
  margin-top: 0.3rem;
}

.bm-sub-category small {
  display: block;
  color: #666;
}

/* Repeating schedule (shown for the repeating-event choice) */
.bm-sub-repeat {
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.bm-sub-repeat-days {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: center;
}

.bm-sub-repeat-days-label {
  width: 100%;
  font-weight: 600;
}

.bm-sub-repeat .bm-sub-repeat-day {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35em;
  font-weight: 400;
}

.bm-sub-repeat-note {
  margin: 0;
  font-size: 0.9em;
  color: #50575e;
}

/* Event kind selector */
.bm-sub-kind {
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bm-sub-kind legend {
  font-weight: 600;
  padding: 0 0.4rem;
}

.bm-sub-kind legend em {
  color: #b32d2e;
  font-style: normal;
}

.bm-sub-kind-option {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.6rem !important;
  font-weight: 400 !important;
}

.bm-sub-kind-option input {
  margin-top: 0.3rem;
}

.bm-sub-kind-option small {
  display: block;
  color: #666;
}

/* Additional dates (Several separate dates) */
.bm-sub-extra-dates {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bm-sub-extra-help {
  margin: 0;
  color: #666;
  font-size: 0.95em;
}

.bm-sub-extra-row {
  grid-template-columns: 1fr 1fr 1fr auto !important;
  align-items: end;
}

@media (max-width: 600px) {
  .bm-sub-extra-row {
    grid-template-columns: 1fr !important;
  }

  /* Boxed sections hug their content on phones */
  .bm-sub-agreement,
  .bm-sub-categories,
  .bm-sub-kind,
  .bm-sub-repeat {
    padding: 1rem;
  }
}

.bm-sub-remove-date {
  background: none;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  color: #b32d2e;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  /* Match the height of the date/time inputs beside it and center the x */
  align-self: end;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bm-sub-remove-date:hover {
  border-color: #b32d2e;
}

/* High specificity + appearance reset so theme button styles
   (borders, icons, gradients) don't bleed in */
.bm-submission-form button.bm-sub-add-date {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  align-self: flex-start;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px dashed #8c8f94;
  border-radius: 4px;
  box-shadow: none;
  padding: 0.55rem 1.2rem;
  margin: 0;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  color: inherit;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
}

/* The plus is drawn here, not a text character, so it always
   renders consistently regardless of theme typography */
.bm-submission-form button.bm-sub-add-date::before {
  content: "+";
  font-weight: 700;
  font-size: 1.15em;
  line-height: 1;
}

.bm-submission-form button.bm-sub-add-date.is-max::before {
  content: none;
}

.bm-submission-form button.bm-sub-add-date:hover:not(:disabled) {
  border-color: #2271b1;
  color: #2271b1;
  background: transparent;
}

.bm-submission-form button.bm-sub-add-date:disabled {
  opacity: 0.65;
  cursor: default;
}

/* Honeypot - visually removed, still in the DOM for bots */
.bm-sub-hp {
  position: absolute !important;
  left: -9999px !important;
  height: 1px;
  overflow: hidden;
}

/* Time picker - mirrors the admin meta box picker's styling */
.bm-timepicker {
  position: relative;
}

.bm-timepicker-display {
  padding: 0.6rem 0.75rem;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  background: #fff;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}

.bm-timepicker-display.bm-tp-empty {
  color: #a0a5aa;
}

/* Keyboard focus ring on the picker parts. currentColor keeps it
   theme-agnostic (it inherits whatever text color the site uses). */
.bm-timepicker-display:focus-visible,
.bm-tp-col:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.bm-tp-dropdown {
  max-width: calc(100vw - 2rem);
  position: absolute;
  z-index: 100;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 230px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bm-tp-columns {
  display: flex;
  border-bottom: 1px solid #eee;
}

.bm-tp-col {
  flex: 1;
  max-height: 240px;
  overflow-y: auto;
  border-right: 1px solid #eee;
  text-align: center;
  scrollbar-width: thin;
}

.bm-tp-col::-webkit-scrollbar {
  width: 6px;
}

.bm-tp-col::-webkit-scrollbar-thumb {
  background: #c3c4c7;
  border-radius: 3px;
}

.bm-tp-col:last-child {
  border-right: none;
}

/* Same size and type as the form's date inputs */
.bm-tp-option {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  font-size: 1em;
  font-weight: 400;
  color: #50575e;
  white-space: nowrap;
}

.bm-tp-option:hover {
  background: #f0f0f1;
}

.bm-tp-option.bm-tp-selected {
  background: #2271b1;
  color: #fff;
  font-weight: 600;
}

.bm-tp-custom-row {
  display: flex;
  gap: 6px;
  padding: 8px;
  /* stretch so the input and the Set/Clear buttons are equal height */
  align-items: stretch;
}

.bm-tp-custom-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  font-size: 1em;
  font-weight: 400;
}

.bm-tp-custom-input.bm-tp-bad {
  border-color: #b32d2e;
}

/* Explicit colors and sizing: themes often style bare <button> for
   colored backgrounds (e.g. white text), which rendered these as
   blank boxes */
.bm-submission-form .bm-tp-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid #c3c4c7;
  background: #f6f7f7;
  color: #2c3338;
  border-radius: 4px;
  padding: 0.6rem 1rem;
  font-size: 0.95em;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  box-shadow: none;
  text-transform: none;
}

.bm-submission-form .bm-tp-btn:hover {
  background: #f0f0f1;
  color: #1d2327;
}

/* Inline field validation */
.bm-submission-form .bm-sub-invalid {
  border-color: #b32d2e !important;
}

/* Checkboxes have no usable border — flag them with a ring instead */
.bm-submission-form input[type="checkbox"].bm-sub-invalid {
  outline: 2px solid #b32d2e;
  outline-offset: 2px;
}

.bm-sub-field-error {
  color: #b32d2e;
  font-weight: 600;
}

/* Messages */
.bm-sub-error {
  background: #fcf0f1;
  border: 1px solid #b32d2e;
  border-left-width: 6px;
  padding: 1rem 1.25rem;
  color: #3c434a;
  font-weight: 600;
}

.bm-sub-warn {
  background: #fcf9e8;
  border-left: 4px solid #dba617;
  padding: 0.75rem 1rem;
  color: #3c434a;
}

.bm-sub-limit-note {
  margin: 0;
  color: #666;
  font-size: 0.9em;
}

.bm-submission-thanks {
  background: #edfaef;
  border-left: 4px solid #00a32a;
  padding: 1.25rem 1.5rem;
}

/* Standalone below the thank-you box, aligned with it */
.bm-sub-again-wrap {
  max-width: 720px;
  margin: 1.5rem auto 0;
}

.bm-sub-again {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  text-decoration: none;
}

/* Submit button fallback styling (themes may override .bm-button) */
.bm-sub-submit {
  align-self: flex-start;
  padding: 0.7rem 1.6rem;
  cursor: pointer;
}
