:root {
  --brand: #6d5efc;
  --brand-dark: #5a4bd6;
  --surface: #ffffff;
  --page-bg: #f4f5fb;
  font-size: 14px;
}

body {
  background-color: var(--page-bg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.navbar {
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
  box-shadow: 0 2px 12px rgba(93, 76, 214, 0.25);
}

.navbar-brand {
  color: #fff !important;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.navbar .btn-outline-secondary {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}

.navbar .btn-outline-secondary:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: #fff;
}

.navbar .btn-group .btn-outline-secondary {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}

.card {
  border: none;
  background-color: var(--surface);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card.shadow-sm {
  box-shadow: 0 2px 10px rgba(20, 20, 43, 0.06) !important;
}

a.card-link-hover,
.col-md-6 .card:has(a):hover {
  box-shadow: 0 6px 20px rgba(20, 20, 43, 0.1) !important;
  transform: translateY(-2px);
}

.btn-primary {
  background-color: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn-outline-primary {
  color: var(--brand);
  border-color: var(--brand);
}

.btn-outline-primary:hover {
  background-color: var(--brand);
  border-color: var(--brand);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(109, 94, 252, 0.2);
}

.option-row {
  background-color: #f9f9fd;
  border: 1px solid #e6e6f2;
  border-radius: 0.5rem;
  padding: 0.4rem 0.6rem;
  cursor: grab;
}

.option-row:active {
  cursor: grabbing;
}

.list-group-item {
  border-color: #eceefa;
}

.bar-chart-track {
  background-color: #eceefa;
  border-radius: 0.5rem;
  height: 0.6rem;
  overflow: hidden;
}

.bar-chart-fill {
  background-color: var(--brand);
  height: 100%;
  border-radius: 0.5rem;
  transition: width 0.2s ease;
}

.js-response-row {
  cursor: pointer;
}

.js-response-row:hover {
  background-color: #f4f4fd;
}

.polls-table-wrap {
  border-radius: 0.75rem 0.75rem 0 0;
  overflow: hidden;
}

.polls-table thead th {
  background-color: var(--brand-dark);
  color: #fff;
  border-color: var(--brand-dark);
}

.polls-table tbody tr {
  cursor: pointer;
}

.lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 18px;
  border-radius: 0.2rem;
  opacity: 0.55;
  filter: grayscale(40%);
  outline-offset: 2px;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.lang-flag:hover {
  opacity: 0.85;
  filter: grayscale(0%);
}

.lang-flag.active {
  opacity: 1;
  filter: grayscale(0%);
  box-shadow: 0 2px 0 0 #fff;
}

/* Faster modal open/close than Bootstrap's default 0.3s dialog / 0.15s
   backdrop fade -- the confirm/error/info modals fire often enough (every
   delete, every form error) that the default speed reads as sluggish. */
.modal.fade .modal-dialog {
  transition-duration: 0.12s;
}

.modal-backdrop.fade {
  transition-duration: 0.08s;
}

/* Date poll calendar grid, shared by the admin date-calendar-picker and the
   guest date-answer-picker (see calendar-utils.js). */
.date-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}

.date-calendar-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
}

.date-calendar-day-number {
  font-size: 0.75rem;
  font-weight: 600;
}

/* Days in the guest calendar span that aren't poll options: muted, inert. */
.date-cell-excluded {
  background-color: #e4e5f0;
  color: #a3a5b8;
}

/* Guest answer cells (both calendar grid and flat list), see
   date-answer-picker.js. Unset = white with a muted question mark; the 4
   answered states get a filled color + matching icon. */
.date-cell {
  border: 1px solid #eceefa;
  padding: 0.25rem;
}

.date-cell-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.date-cell-icon-spacer {
  visibility: hidden;
}

.date-cell-unset {
  background-color: #fff;
  color: #b7b9c9;
}

.date-cell-yes {
  background-color: var(--bs-success);
  border-color: var(--bs-success);
  color: #fff;
}

.date-cell-no {
  background-color: var(--bs-danger);
  border-color: var(--bs-danger);
  color: #fff;
}

.date-cell-not_sure {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
}

.date-cell-prefer_not {
  background-color: var(--bs-warning);
  border-color: var(--bs-warning);
  color: #212529;
}

/* Hover should signal "clickable", not look like the click was undone --
   bootstrap's base .btn:hover rule (higher specificity than a single class)
   otherwise resets background-color to transparent. Re-declare the same
   background per state and only change the border on hover instead. */
.date-cell-unset:hover {
  background-color: #fff;
  border-color: var(--brand);
}

.date-cell-yes:hover {
  background-color: var(--bs-success);
  border-color: var(--brand-dark);
}

.date-cell-no:hover {
  background-color: var(--bs-danger);
  border-color: var(--brand-dark);
}

.date-cell-not_sure:hover {
  background-color: var(--bs-primary);
  border-color: var(--brand-dark);
}

.date-cell-prefer_not:hover {
  background-color: var(--bs-warning);
  border-color: var(--brand-dark);
}

/* Flat-list guest date rows (see date-answer-picker.js renderList):
   full-width, tinted per current state so the whole row signals its answer
   at a glance, not just the small active choice button inside it. */
.date-list-row {
  width: 100%;
}

.date-list-choice {
  border: 1px solid #c7c9de;
  border-radius: 0.5rem;
}

/* Admin responses-tab spreadsheet grid for date polls: one row per
   responder, one column per date option, small colored squares (reusing
   .date-cell) for each answer, column headers rotated 90deg so many dates
   fit without the table growing too wide. */
.date-response-grid-header {
  white-space: nowrap;
  vertical-align: bottom;
  text-align: center;
  padding-bottom: 0.5rem;
}

.date-response-grid-header > span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: inline-block;
  margin: 0 auto;
}

.date-response-grid .date-cell {
  width: 1.75rem;
  height: 1.75rem;
  margin: 0 auto;
}

/* Results-tab suggested-dates list: one square per response, reusing
   .date-cell's colors at a smaller size to fit many per row. */
.date-suggestion-square {
  width: 1.25rem;
  height: 1.25rem;
}

.date-suggestion-square .date-cell-icon {
  font-size: 0.65rem;
}

/* Unfilled dates read as neutral, not "answered white" -- unlike the guest
   picker's .date-cell-unset (white, awaiting input), a square here means the
   respondent never answered at all. */
.date-suggestion-square.date-cell-unset {
  background-color: #e9ecef;
  border-color: #e9ecef;
  color: #6c757d;
}

/* Name + submitted columns stay put while date columns scroll horizontally
   inside .table-responsive. nth-child(1)/(2) pin both header and body cells;
   background-color is required so scrolled-under columns don't show through. */
.date-response-grid th:nth-child(1),
.date-response-grid td:nth-child(1),
.date-response-grid th:nth-child(2),
.date-response-grid td:nth-child(2) {
  position: sticky;
  background-color: var(--bs-body-bg);
  z-index: 1;
}

.date-response-grid th:nth-child(1),
.date-response-grid td:nth-child(1),
.date-response-grid th:nth-child(2),
.date-response-grid td:nth-child(2) {
  white-space: nowrap;
}

.date-response-grid th:nth-child(1),
.date-response-grid td:nth-child(1) {
  left: 0;
}

/* Left offset for column 2 is the actual rendered width of column 1, which
   varies with the longest name -- set as a CSS var by syncDateGridOffsets()
   in detail.html since sticky offsets can't reference another column's
   auto-sized width in pure CSS. */
.date-response-grid th:nth-child(2),
.date-response-grid td:nth-child(2) {
  left: var(--name-col-width, 9rem);
  border-right: 1px solid var(--bs-border-color);
}

/* Response-details modal: date-poll "choice" shown as a 3-column grid of
   date label + colored square (see buildDateAnswerItem in detail.html)
   instead of the plain comma-separated text used for other poll types. */
.date-answer-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem 1rem;
}

.date-answer-modal-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.date-answer-modal-item .date-cell {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

/* Legend above the guest date-answer picker explaining cell colors/icons. */
.date-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.date-legend-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.35rem;
  font-size: 0.75rem;
}

/* Admin date-calendar-picker day cells, see date-calendar-picker.js. */
.admin-cal-cell {
  border: 1px solid #eceefa;
  background-color: #fff;
  cursor: pointer;
}

.admin-cal-cell:hover {
  border-color: var(--brand);
}

.admin-cal-cell.selected:hover {
  background-color: var(--brand);
  border-color: var(--brand-dark);
}

.admin-cal-cell.today {
  border: 2px solid var(--brand-dark);
  font-weight: 600;
}

.admin-cal-cell.past {
  color: #a3a5b8;
}

.admin-cal-cell.selected {
  background-color: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* Selected-dates chip list beside/below the admin date-calendar-picker. */
.selected-date-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background-color: #f9f9fd;
  border: 1px solid #e6e6f2;
  border-radius: 999px;
  padding: 0.25rem 0.4rem 0.25rem 0.75rem;
}

/* Custom right-click context menu for the guest date-answer-picker, replaces
   the browser's native menu -- see date-answer-picker.js. */
.date-context-menu {
  position: fixed;
  z-index: 1080;
  background-color: #fff;
  border: 1px solid #eceefa;
  border-radius: 0.5rem;
  box-shadow: 0 6px 20px rgba(20, 20, 43, 0.15);
  padding: 0.25rem;
  min-width: 10rem;
}

.date-context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: none;
  background: none;
  padding: 0.4rem 0.6rem;
  border-radius: 0.4rem;
  text-align: left;
  font-size: 0.85rem;
}

.date-context-menu-item:hover {
  background-color: #f4f4fd;
}

/* Picture-poll guest picker: 3-wide grid of option images (picture-picker.js).
   Selected options stay in the grid, greyed out, instead of being removed. */
.picture-tile {
  border: none;
  background: none;
  width: 240px;
}

.js-picture-grid {
  max-width: 752px; /* 3 * 240px tile + 2 * 16px column-gap, forces a real 3-wide grid */
  margin-left: auto;
  margin-right: auto;
  column-gap: 1rem;
  row-gap: 2rem;
}

.js-picture-picker .js-rank-slots {
  column-gap: 0.5rem;
  row-gap: 1.5rem;
}

.picture-tile-img {
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.picture-tile-selected .picture-tile-img {
  opacity: 0.35;
  filter: grayscale(80%);
}

.picture-tile-label {
  font-size: 1.05rem;
}

/* .d-flex is `display: flex !important`, which otherwise beats the browser's
   native `[hidden] { display: none; }` rule (picture-picker.js's toggling of
   the empty-state via el.hidden would silently no-op without this). */
.js-rank-slot-empty[hidden] {
  display: none !important;
}

.picture-slot-rank-badge {
  background-color: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.picture-tile-overlay {
  pointer-events: none;
  display: none;
}

.picture-tile-selected .picture-tile-overlay {
  display: flex;
}

.js-picture-slot {
  width: 256px;
  min-height: 210px;
  border: 2px dashed transparent;
}

.js-picture-slot-drag-target {
  border-color: #0d6efd;
}
