/*
 * ELEVN — Dedicated Poll Composer
 * Presentation only.
 * Native Poll behavior remains owned by post.js / posts/post.php.
 */

#modal:has(#elevn-poll-composer) .modal-dialog {
  width: min(430px, calc(100vw - 32px));
  max-width: 430px;
  margin: 16px auto;
}

#modal:has(#elevn-poll-composer) .modal-content {
  display: flex;
  flex-direction: column;

  height: min(820px, calc(100vh - 32px));
  height: min(820px, calc(100dvh - 32px));

  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);

  overflow: hidden;

  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 24px;

  background: #ffffff;
  color: #111827;

  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

body.night-mode #modal:has(#elevn-poll-composer) .modal-content {
  border-color: rgba(255, 255, 255, 0.08);
  background: #101323;
  color: #fff;
}

#modal:has(#elevn-poll-composer) .elevn-poll-composer {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

/* =============================================================
   HEADER
   ============================================================= */

#modal:has(#elevn-poll-composer) .elevn-poll-composer-header {
  position: relative;

  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;

  flex: 0 0 auto;

  min-height: 58px;
  padding: 8px 12px;

  border-bottom: 1px solid rgba(17, 24, 39, 0.08);

  background: #fff;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-composer-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  background: #101323;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-composer-header
  .modal-title {
  min-width: 0;
  margin: 0;

  overflow: hidden;

  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#modal:has(#elevn-poll-composer) .elevn-poll-composer-close {
  justify-self: start;
  margin: 0;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-composer-close {
  filter: invert(1) grayscale(100%);
}

#modal:has(#elevn-poll-composer) .elevn-poll-header-balance {
  width: 40px;
  height: 40px;
}

/* =============================================================
   FLEX SHELL
   ============================================================= */

#modal:has(#elevn-poll-composer) .elevn-poll-composer-body,
#modal:has(#elevn-poll-composer) .elevn-poll-publisher-wrapper,
#modal:has(#elevn-poll-composer) .elevn-poll-publisher {
  display: flex;

  width: 100%;
  min-width: 0;
  min-height: 0;

  flex: 1 1 auto;
}

#modal:has(#elevn-poll-composer) .elevn-poll-publisher {
  position: relative;

  margin: 0 !important;
  padding: 0 !important;

  flex-direction: column;

  overflow: hidden;

  border: 0 !important;
  border-radius: 0 !important;

  background: transparent !important;

  box-shadow: none !important;
}

#modal:has(#elevn-poll-composer) .elevn-poll-scroll {
  width: 100%;
  min-height: 0;

  flex: 1 1 auto;

  overflow-x: hidden;
  overflow-y: auto;

  overscroll-behavior: contain;

  -webkit-overflow-scrolling: touch;

  padding: 16px 16px 24px;
}

/* =============================================================
   COMMON SECTIONS
   ============================================================= */

#modal:has(#elevn-poll-composer) .elevn-poll-section {
  margin: 0 0 20px;
}

#modal:has(#elevn-poll-composer) .elevn-poll-section-title {
  margin: 0 0 8px;

  color: #343b49;

  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-section-title {
  color: #fff;
}

/* =============================================================
   QUESTION
   ============================================================= */

#modal:has(#elevn-poll-composer) .elevn-poll-question-input {
  display: block;

  box-sizing: border-box;

  width: 100%;
  min-height: 72px !important;
  max-height: none !important;

  margin: 0;
  padding: 13px 14px !important;

  resize: none;

  overflow-y: auto;

  border: 1px solid rgba(17, 24, 39, 0.11) !important;
  border-radius: 13px !important;

  background: #f7f9fc !important;
  color: #111827 !important;

  font-size: 14px;
  line-height: 1.45 !important;

  outline: 0;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-question-input {
  border-color: rgba(255, 255, 255, 0.10) !important;
  background: #171b2e !important;
  color: #fff !important;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-question-input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

#modal:has(#elevn-poll-composer) .elevn-poll-question-input:focus {
  border-color: rgba(0, 122, 255, 0.58) !important;

  box-shadow:
    0
    0
    0
    3px
    rgba(0, 122, 255, 0.10)
    !important;
}

#modal:has(#elevn-poll-composer) .publisher-scraper:empty {
  display: none;
}

/* =============================================================
   OPTIONS
   ============================================================= */

#modal:has(#elevn-poll-composer)
  .publisher-meta[data-meta="poll"] {
  display: flex !important;

  box-sizing: border-box;

  width: 100%;
  min-height: 50px;

  align-items: center;
  gap: 10px;

  margin: 0 0 10px !important;
  padding: 0 12px !important;

  border: 1px solid rgba(17, 24, 39, 0.11) !important;
  border-radius: 13px !important;

  background: #f7f9fc !important;
  color: #111827;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .publisher-meta[data-meta="poll"] {
  border-color: rgba(255, 255, 255, 0.10) !important;
  background: #171b2e !important;
  color: #fff;
}

#modal:has(#elevn-poll-composer)
  .publisher-meta[data-meta="poll"]:focus-within {
  border-color: rgba(0, 122, 255, 0.58) !important;

  box-shadow:
    0
    0
    0
    3px
    rgba(0, 122, 255, 0.10);
}

/*
 * Generic Sngine .main-icon rules position icons for publisher rows.
 * Dedicated Poll uses normal flex flow instead.
 */
#modal:has(#elevn-poll-composer)
  .publisher-meta[data-meta="poll"]
  .main-icon {
  position: static !important;

  display: flex !important;

  width: 18px !important;
  height: 18px !important;

  min-width: 18px !important;

  flex: 0 0 18px !important;

  align-items: center;
  justify-content: center;

  margin: 0 !important;
  padding: 0 !important;

  opacity: 0.72;

  transform: none !important;
}

#modal:has(#elevn-poll-composer)
  .publisher-meta[data-meta="poll"]
  .main-icon
  svg {
  display: block;

  width: 16px !important;
  height: 16px !important;

  margin: 0 !important;
}

#modal:has(#elevn-poll-composer)
  .publisher-meta[data-meta="poll"]
  input {
  width: auto;
  min-width: 0;
  min-height: 48px;

  flex: 1 1 auto;

  margin: 0;
  padding: 0 !important;

  border: 0 !important;

  background: transparent !important;
  color: inherit !important;

  font-size: 14px;
  line-height: 1.4;

  outline: 0 !important;

  box-shadow: none !important;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .publisher-meta[data-meta="poll"]
  input::placeholder {
  color: rgba(255, 255, 255, 0.56);
}

/* =============================================================
   SETTINGS — VISUAL PARITY WITH PHOTO
   ============================================================= */

#modal:has(#elevn-poll-composer) .elevn-poll-settings {
  overflow: hidden;

  margin-top: 12px;

  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 14px;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-settings {
  border-color: rgba(255, 255, 255, 0.08);
}

#modal:has(#elevn-poll-composer) .elevn-poll-setting {
  display: flex;

  min-height: 64px;

  align-items: center;
  justify-content: space-between;

  gap: 14px;

  padding: 12px 14px;

  background: rgba(17, 24, 39, 0.02);
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-setting {
  background: rgba(255, 255, 255, 0.025);
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-setting
  + .elevn-poll-setting,
#modal:has(#elevn-poll-composer)
  .elevn-poll-schedule-panel {
  border-top: 1px solid rgba(17, 24, 39, 0.08);
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-setting
  + .elevn-poll-setting,
body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-schedule-panel {
  border-top-color: rgba(255, 255, 255, 0.07);
}

#modal:has(#elevn-poll-composer) .elevn-poll-setting-copy {
  display: flex;

  min-width: 0;

  flex: 1 1 auto;
  flex-direction: column;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-setting-copy
  strong {
  color: #111827;

  font-size: 13px;
  font-weight: 700;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-setting-copy
  strong {
  color: #fff;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-setting-copy
  span {
  margin-top: 3px;

  color: #8790a0;

  font-size: 11px;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-setting-copy
  span {
  color: rgba(255, 255, 255, 0.48);
}

/* Privacy keeps native js_publisher-privacy behaviour. */

#modal:has(#elevn-poll-composer) .elevn-poll-privacy {
  flex: 0 0 auto;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-privacy-control {
  min-height: 36px;
  max-width: 132px;

  padding: 8px 30px 8px 10px;

  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 10px;

  background: #f7f9fc;

  color: #111827;

  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;

  box-shadow: none !important;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-privacy-control {
  border-color: rgba(255, 255, 255, 0.10);

  background: #171b2e;

  color: #fff;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-privacy-control
  .btn-group-text {
  overflow: hidden;

  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Same compact 42x24 switch contract as Photo. */

#modal:has(#elevn-poll-composer) .elevn-poll-switch {
  position: relative;

  width: 42px;
  height: 24px;

  flex: 0 0 42px;

  margin: 0;
}

#modal:has(#elevn-poll-composer) .elevn-poll-switch input {
  position: absolute;

  width: 1px;
  height: 1px;

  opacity: 0;
}

#modal:has(#elevn-poll-composer) .elevn-poll-switch > span {
  position: absolute;
  inset: 0;

  border-radius: 999px;

  background: rgba(17, 24, 39, 0.20);

  cursor: pointer;

  transition: background 0.18s ease;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-switch
  > span {
  background: rgba(255, 255, 255, 0.15);
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-switch
  > span::after {
  position: absolute;

  top: 3px;
  left: 3px;

  width: 18px;
  height: 18px;

  border-radius: 50%;

  background: #fff;

  content: "";

  transition: transform 0.18s ease;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-switch
  input:checked
  + span {
  background: #4f6ef7;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-switch
  input:checked
  + span::after {
  transform: translateX(18px);
}

/* Schedule date panel remains the native Poll schedule hook. */

#modal:has(#elevn-poll-composer)
  .elevn-poll-schedule-panel {
  margin: 0;

  padding: 12px 14px 14px;

  background: rgba(17, 24, 39, 0.015);
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-schedule-panel {
  background: rgba(255, 255, 255, 0.018);
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-schedule-picker {
  display: flex;

  min-height: 42px;

  align-items: center;

  gap: 9px;

  margin: 0;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-schedule-picker-icon {
  color: #007aff;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-schedule-picker-label {
  flex: 0 0 auto;

  font-size: 12px;
  font-weight: 700;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-schedule-input {
  min-width: 0;

  flex: 1 1 auto;

  padding: 10px 11px;

  border: 1px solid rgba(17, 24, 39, 0.10);
  border-radius: 10px;

  background: #f7f9fc;
  color: #111827;

  font-size: 12px;

  outline: 0;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-schedule-input {
  border-color: rgba(255, 255, 255, 0.10);

  background: #171b2e;

  color: #fff;
}

/* =============================================================
   FOOTER — CTA ONLY, LIKE PHOTO
   ============================================================= */

#modal:has(#elevn-poll-composer) .elevn-poll-footer {
  flex: 0 0 auto;

  margin: 0;

  padding:
    14px
    16px
    calc(14px + env(safe-area-inset-bottom, 0px));

  border-top: 1px solid rgba(17, 24, 39, 0.08);

  background: #fff;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-footer {
  border-top-color: rgba(255, 255, 255, 0.08);

  background: #101323;
}

#modal:has(#elevn-poll-composer) .elevn-poll-submit-wrap {
  width: 100%;
}

#modal:has(#elevn-poll-composer) .elevn-poll-submit {
  width: 100%;
  min-height: 46px;

  margin: 0 !important;
  padding: 0 16px;

  border-radius: 13px;

  font-size: 14px;
  font-weight: 800;
}

#modal:has(#elevn-poll-composer)
  .elevn-poll-footer
  .alert-danger {
  margin: 0 0 10px !important;
  padding: 10px 12px;

  border: 1px solid rgba(220, 53, 69, 0.30);
  border-radius: 10px;

  background: rgba(220, 53, 69, 0.10);
  color: #dc3545;

  font-size: 12px;
  line-height: 1.4;
}

body.night-mode
  #modal:has(#elevn-poll-composer)
  .elevn-poll-footer
  .alert-danger {
  color: #ffb9c0;
}

/* =============================================================
   MOBILE — SAME FULLSCREEN PRINCIPLE AS ONE / PHOTO
   ============================================================= */

@media (max-width: 767.98px) {

  #modal:has(#elevn-poll-composer) {
    padding: 0 !important;
  }

  #modal:has(#elevn-poll-composer) .modal-dialog {
    width: 100vw;
    max-width: none;

    height: 100vh;
    height: 100dvh;

    margin: 0;
  }

  #modal:has(#elevn-poll-composer) .modal-content {
    width: 100vw;

    height: 100vh;
    height: 100dvh;

    max-height: 100vh;
    max-height: 100dvh;

    border: 0;
    border-radius: 0;
  }

  #modal:has(#elevn-poll-composer)
    .elevn-poll-composer-header {
    min-height: 56px;

    padding-top:
      calc(
        8px
        + env(safe-area-inset-top, 0px)
      );
  }

  #modal:has(#elevn-poll-composer) .elevn-poll-scroll {
    padding:
      14px
      14px
      24px;
  }

  /* Exact compact Photo settings rhythm. */
  #modal:has(#elevn-poll-composer) .elevn-poll-setting {
    min-height: 56px;

    padding: 9px 12px;
  }

  #modal:has(#elevn-poll-composer)
    .elevn-poll-schedule-panel {
    padding: 9px 12px 11px;
  }

  #modal:has(#elevn-poll-composer) .elevn-poll-footer {
    padding:
      10px
      14px
      calc(
        10px
        + env(safe-area-inset-bottom, 0px)
      );
  }

  #modal:has(#elevn-poll-composer) .elevn-poll-submit {
    min-height: 48px;
  }
}
