/* XAM polls — create modal + message card */

.xam-poll-create-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
  box-sizing: border-box;
}

.xam-poll-create-modal.hidden {
  display: none !important;
}

.xam-poll-create-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.xam-poll-create-sheet {
  position: relative;
  z-index: 1;
  width: min(392px, 100%);
  max-height: min(66vh, 560px);
  display: flex;
  flex-direction: column;
  border-radius: 30px;
  background: #1a1a1a;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.xam-poll-create-header {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 8px;
  flex: 0 0 auto;
}

.xam-poll-create-title {
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.xam-poll-create-icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.xam-poll-create-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.xam-poll-create-submit {
  border: none;
  background: transparent;
  color: var(--xam-ui-accent, #8774E1);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 8px 4px;
}

.xam-poll-create-submit:disabled {
  color: rgba(255, 255, 255, 0.28);
  cursor: default;
}

.xam-poll-create-scroll {
  overflow: auto;
  padding: 2px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.xam-poll-create-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.xam-poll-card {
  background: #242424;
  border-radius: 22px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.xam-poll-section-title {
  margin: 0 2px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--xam-ui-accent, #8774E1);
  letter-spacing: 0.01em;
}

.xam-poll-input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 14px;
  border-radius: 16px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.xam-poll-input:focus {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1.5px rgba(135, 116, 225, 0.4);
}

.xam-poll-input::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.xam-poll-desc-row {
  margin-top: 8px;
}

.xam-poll-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.xam-poll-option-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.xam-poll-option-row .xam-poll-input {
  flex: 1 1 auto;
  min-width: 0;
}

.xam-poll-option-remove,
.xam-poll-correct-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.xam-poll-correct-btn.is-on {
  color: #3DCF7A;
  background: rgba(61, 207, 122, 0.16);
}

.xam-poll-add-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
  padding: 8px 2px;
  border: none;
  background: transparent;
  color: var(--xam-ui-accent, #8774E1);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.xam-poll-add-plus {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(135, 116, 225, 0.22);
  font-size: 15px;
  line-height: 1;
}

.xam-poll-options-hint {
  margin: 4px 2px 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.32);
}

.xam-poll-setting-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.xam-poll-setting-row:first-child {
  border-top: none;
  padding-top: 2px;
}

.xam-poll-setting-ico {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: none;
}

.xam-poll-setting-ico svg {
  width: 16px;
  height: 16px;
  filter: none;
}

.xam-poll-setting-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.xam-poll-setting-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.xam-poll-setting-desc {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.38);
}

.xam-poll-switch {
  flex: 0 0 auto;
  width: 42px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  transition: background 0.15s ease;
}

.xam-poll-switch.is-on {
  background: var(--xam-ui-accent, #8774E1);
}

.xam-poll-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.xam-poll-switch.is-on .xam-poll-switch-knob {
  transform: translateX(16px);
}

.xam-poll-time-row {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.xam-poll-time-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

/* —— Message card —— */
.message.message--poll {
  max-width: min(420px, 92%) !important;
}

.message.message--poll .message-content--poll {
  min-width: min(240px, 68vw);
  max-width: min(340px, 82vw) !important;
  width: fit-content;
  padding: 10px 12px 8px !important;
}

.message.own.message--poll .message-content--poll {
  max-width: min(340px, 82vw) !important;
}

.xam-poll-q {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 4px;
  color: inherit;
}

.xam-poll-d {
  font-size: 12px;
  opacity: 0.65;
  margin-bottom: 8px;
  line-height: 1.35;
}

.xam-poll-opts {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.xam-poll-opt {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  padding: 9px 11px;
  cursor: pointer;
  overflow: hidden;
}

.message.own .xam-poll-opt {
  background: rgba(0, 0, 0, 0.16);
}

.xam-poll-opt:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.26);
}

.xam-poll-opt:disabled {
  cursor: default;
}

.xam-poll-opt-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
  transition: width 0.25s ease;
  border-radius: 14px;
}

.xam-poll-opt.is-selected .xam-poll-opt-bar,
.xam-poll-opt.is-results .xam-poll-opt-bar {
  background: rgba(255, 255, 255, 0.16);
}

.xam-poll-opt.is-correct .xam-poll-opt-bar {
  background: rgba(61, 207, 122, 0.28);
}

.xam-poll-opt.is-wrong .xam-poll-opt-bar {
  background: rgba(255, 90, 90, 0.25);
}

.xam-poll-opt-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.xam-poll-opt-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  flex: 0 0 16px;
  box-sizing: border-box;
}

.xam-poll-opt.is-selected .xam-poll-opt-check {
  border-color: #fff;
  background: #fff;
  box-shadow: inset 0 0 0 3px rgba(80, 60, 160, 0.55);
}

.xam-poll-opt-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}

.xam-poll-opt-pct {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.75;
}

.xam-poll-opt-voters {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 3px;
  padding-left: 24px;
  font-size: 11px;
  opacity: 0.55;
}

.xam-poll-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 8px;
  font-size: 11px;
  opacity: 0.65;
}

.xam-poll-add-opt-live,
.xam-poll-close-btn,
.xam-poll-retract-btn {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  opacity: 0.9;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.xam-poll-closed {
  opacity: 0.7;
}

body.theme-light .xam-poll-create-sheet {
  background: #f2f2f4;
  color: #1C1B22;
}

body.theme-light .xam-poll-card {
  background: #ffffff;
}

body.theme-light .xam-poll-input {
  color: #1C1B22;
  background: rgba(28, 27, 34, 0.05);
  border-color: rgba(28, 27, 34, 0.06);
}

body.theme-light .xam-poll-input::placeholder {
  color: rgba(28, 27, 34, 0.4);
}

body.theme-light .xam-poll-setting-title {
  color: #1C1B22;
}

body.theme-light .xam-poll-setting-desc,
body.theme-light .xam-poll-options-hint {
  color: rgba(28, 27, 34, 0.5);
}

body.theme-light .xam-poll-create-icon-btn {
  color: rgba(28, 27, 34, 0.7);
}

body.theme-light .xam-poll-option-remove {
  background: rgba(28, 27, 34, 0.06);
  color: rgba(28, 27, 34, 0.45);
}

@media (max-width: 768px) {
  .xam-poll-create-modal {
    padding: 0;
    align-items: flex-end;
  }

  .xam-poll-create-sheet {
    width: 100%;
    max-height: min(84vh, 640px);
    height: auto;
    border-radius: 28px 28px 0 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }
}
