/* PharmAchieve Live Q&A + Live Polls + Broadcast Styles */
html {
  overflow-y: scroll;
}

body {
  font-family: 'Roboto', 'Open Sans', sans-serif;
  font-size: 1.9em;
  font-weight: 400;
}

/* --- SUBTLE RECONNECTING SPINNER --- */
.reconnect-banner {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 9999;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.92);
  color: #85929e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e8e8;
  transition: opacity 0.25s ease;
}

.reconnect-spinner {
  font-size: 15px;
  line-height: 1;
  color: #7f8c8d;
}

body.broadcast-mode .reconnect-banner {
  display: none !important;
}

.directions {
  margin-top: 3px;
  margin-bottom: 10px;
  color: grey;
  margin-left: auto;
  margin-right: auto;
  width: 91%;
  border-radius: 20px;
  border: silver 1px solid;
  padding: 5px 27px;
  background: whitesmoke;
}

.sunken {
  background-color: hsl(0, 0%, 79%) !important;
  background-repeat: repeat-x;
  background-image: linear-gradient(#e0e0e0, #c9c9c9);
  border-color: #c9c9c9 #c9c9c9 hsl(0, 0%, 68.5%);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.69);
  -webkit-font-smoothing: antialiased;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.18);
}

.highlight {
  background: lightyellow !important;
}

textarea#question {
  font-size: 1.1em;
}

.answered_now {
  font-weight: 600;
}

.time {
  float: left;
  padding-left: 5px;
  color: #666;
}

.submitter {
  float: left;
  color: #555;
}

.row {
  border-bottom: 1px solid lightgray;
}

.rowContainer {
  padding-top: 3px;
  padding-bottom: 3px;
  will-change: transform, opacity;
}

/* Remove ugly black browser/Bootstrap focus outline on Ask Question and all buttons after click */
.btn:focus,
.btn:active:focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn.active.focus,
.btn:focus-visible,
button:focus,
button:focus-visible,
input[type="submit"]:focus,
input[type="submit"]:focus-visible,
input[type="button"]:focus,
input[type="button"]:focus-visible,
a.btn:focus,
a.btn:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
}

.sunken:focus,
.sunken:active:focus {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.18) !important;
}

/* --- QUESTION INSERTION & VOTE MOVEMENT ANIMATIONS --- */
@keyframes questionRowEnter {
  0% {
    opacity: 0;
    transform: translateY(-28px) scale(0.95);
  }
  50% {
    opacity: 1;
    transform: translateY(4px) scale(1.014);
  }
  75% {
    opacity: 1;
    transform: translateY(-1px) scale(0.998);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes questionCardHighlightGlow {
  0% {
    background-color: #d1f2eb;
    box-shadow: 0 10px 26px rgba(46, 134, 193, 0.34), 0 0 0 2px rgba(46, 204, 113, 0.45);
  }
  45% {
    background-color: #d6eaf8;
    box-shadow: 0 6px 18px rgba(46, 134, 193, 0.22), 0 0 0 1px rgba(52, 152, 219, 0.35);
  }
  100% {
    background-color: #fbfafb;
    box-shadow: none;
  }
}

.question-row-enter {
  animation: questionRowEnter 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  position: relative;
  z-index: 12;
}

.question-row-enter > .row:not(.highlight) {
  animation: questionCardHighlightGlow 1.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes voteCountBumpUp {
  0% {
    transform: scale(1);
    color: inherit;
  }
  35% {
    transform: scale(1.45);
    color: #1e8449;
  }
  100% {
    transform: scale(1);
    color: inherit;
  }
}

@keyframes voteCountBumpDown {
  0% {
    transform: scale(1);
    color: inherit;
  }
  35% {
    transform: scale(0.75);
    color: #d35400;
  }
  100% {
    transform: scale(1);
    color: inherit;
  }
}

.vote-bump-up {
  display: inline-block;
  animation: voteCountBumpUp 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.vote-bump-down {
  display: inline-block;
  animation: voteCountBumpDown 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.editable-qtext {
  cursor: pointer;
  overflow-wrap: break-word;
  word-break: break-word;
}
.editable-qtext:hover {
  background-color: rgba(255, 255, 200, 0.4);
  border-radius: 3px;
}
.qtext-display {
  overflow-wrap: break-word;
  word-break: break-word;
}
.inline-edit-box {
  width: 100%;
  font-size: 0.95em;
  margin-bottom: 4px;
}
.admin-panel-box {
  margin-top: 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 15px;
  font-size: 0.82em;
}

/* --- LIVE POLLS STYLES --- */
.poll-card {
  background: #ffffff;
  border: 2px solid #2980b9;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 28px;
  box-shadow: 0 3px 10px rgba(41, 128, 185, 0.12);
}

.poll-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #eaeaea;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.poll-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.poll-badge-open {
  background-color: #27ae60;
  color: #fff;
  font-size: 0.72em;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.poll-badge-closed {
  background-color: #7f8c8d;
  color: #fff;
  font-size: 0.72em;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.poll-votes-badge {
  background-color: #ebf5fb;
  color: #1f618d;
  border: 1px solid #aed6f1;
  font-size: 0.78em;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
}

.poll-options-grid {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.poll-opt-btn {
  position: relative;
  flex: 1 1 60px;
  min-width: 58px;
  padding: 10px 8px;
  font-size: 1.15em;
  font-weight: 700;
  border-radius: 7px;
  border: 2px solid #bdc3c7;
  background: #f8f9f9;
  color: #2c3e50;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  text-align: center;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  outline: none;
}

/* Unselected hover state: crisp dark blue text on light blue tint */
.poll-opt-btn:not(.selected):hover:not(:disabled) {
  border-color: #2980b9;
  background: #d6eaf8;
  color: #154360 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(41, 128, 185, 0.2);
}

/* Selected state AND selected hover state: high-contrast white text on rich emerald gradient */
.poll-opt-btn.selected,
.poll-opt-btn.selected:hover:not(:disabled),
.poll-opt-btn.selected:focus {
  border-color: #1e8449 !important;
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  box-shadow: 0 3px 10px rgba(39, 174, 96, 0.4);
}

.poll-opt-btn.selected:hover:not(:disabled) {
  background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(39, 174, 96, 0.5);
}

/* Pleasing Vote Animation (Spring Pop + Expanding Ring + Checkmark Stroke Draw) */
@keyframes pollBtnSpringPop {
  0% {
    transform: scale(0.92);
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.75);
  }
  45% {
    transform: scale(1.06);
  }
  75% {
    transform: scale(0.98);
    box-shadow: 0 0 0 12px rgba(46, 204, 113, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 3px 10px rgba(39, 174, 96, 0.4);
  }
}

@keyframes pollCheckStroke {
  0% {
    stroke-dashoffset: 24;
    transform: scale(0.5);
    opacity: 0.4;
  }
  60% {
    transform: scale(1.18);
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    transform: scale(1);
    opacity: 1;
  }
}

.poll-opt-btn.just-voted {
  animation: pollBtnSpringPop 0.48s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.poll-check-svg {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  flex-shrink: 0;
}

.poll-opt-btn.just-voted .poll-check-path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transform-origin: center;
  animation: pollCheckStroke 0.42s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}

.poll-opt-btn:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.poll-graph-container {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #e0e0e0;
}

.poll-bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}

.poll-bar-row.admin-clickable {
  cursor: pointer;
}

.poll-bar-label {
  width: 38px;
  height: 32px;
  line-height: 30px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95em;
  border-radius: 5px;
  background: #ecf0f1;
  color: #2c3e50;
  border: 1px solid #d0d3d4;
  flex-shrink: 0;
}

.poll-bar-row.is-correct .poll-bar-label {
  background: #27ae60;
  color: #fff;
  border-color: #1e8449;
}

.poll-bar-track {
  flex-grow: 1;
  height: 30px;
  background: #f2f4f4;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  border: 1px solid #e5e7e9;
}

.poll-bar-fill {
  height: 100%;
  border-radius: 5px 0 0 5px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.poll-bar-stats {
  width: 115px;
  text-align: right;
  font-size: 0.85em;
  font-weight: 600;
  color: #34495e;
  flex-shrink: 0;
}

.poll-status-note {
  font-size: 0.8em;
  color: #666;
  margin-top: 4px;
}

.poll-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

/* --- OBS BROADCAST VIEW STYLES --- */
body.broadcast-mode {
  background: transparent;
}
.broadcast-poll-banner {
  background: linear-gradient(135deg, #1f618d 0%, #2980b9 100%);
  color: #ffffff;
  border-radius: 8px;
  padding: 16px 22px;
  margin-top: 8px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.broadcast-poll-banner .pulse-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: #2ecc71;
  border-radius: 50%;
  margin-right: 10px;
  box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.35);
}
.broadcast-poll-title {
  font-size: 1.2em;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.broadcast-poll-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 14px;
  border-radius: 16px;
  font-size: 0.9em;
  font-weight: 600;
}
