/* Form layout improvements for vote admin screen */
.tbmc-vote-form-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #1a1a1a;
  padding: 20px;
  border-radius: 8px;
  max-width: 600px;
  font-size: 15px;
}

.tbmc-vote-form-shell label {
  font-weight: bold;
  margin-bottom: 4px;
  color: #d2a679; /* matches western-style brown */
}

.tbmc-vote-form-shell input[type="text"],
.tbmc-vote-form-shell input[type="url"],
.tbmc-vote-form-shell input[type="file"],
.tbmc-vote-form-shell input[type="number"],
.tbmc-vote-form-shell select,
.tbmc-vote-form-shell textarea,
.tbmc-vote-form-shell input[type="datetime-local"] {
  width: 100%;
  padding: 8px;
  background: #333;
  border: 1px solid #555;
  color: #fff;
  border-radius: 4px;
}

.tbmc-vote-form-shell textarea {
  min-height: 80px;
}

.tbmc-vote-document-field {
  display: grid;
  gap: 7px;
}

.tbmc-vote-document-field small {
  color: #bbb;
}

.tbmc-current-document {
  background: #222;
  border: 1px solid #4b4035;
  border-radius: 4px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.tbmc-current-document a {
  color: #ffcc66;
  overflow-wrap: anywhere;
}

.tbmc-current-document .tbmc-remove-document {
  align-items: center;
  color: #f3d0c4;
  display: flex;
  gap: 7px;
  margin: 0;
}

.tbmc-current-document .tbmc-remove-document input {
  margin: 0;
  width: auto;
}

.tbmc-vote-document {
  align-items: center;
  background: #1b1b1b;
  border: 1px solid #8b5a2b;
  border-radius: 6px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 16px 0;
  padding: 14px 16px;
}

.tbmc-vote-document > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tbmc-vote-document strong {
  color: #d2a679;
  font-size: 17px;
}

.tbmc-vote-document span {
  color: #fff;
  overflow-wrap: anywhere;
}

.tbmc-vote-document small {
  color: #cfcfcf;
}

.tbmc-vote-document-button {
  background: #d2a679;
  border: 1px solid #d2a679;
  border-radius: 4px;
  color: #1a1a1a !important;
  flex: 0 0 auto;
  font-weight: 700;
  padding: 9px 14px;
  text-decoration: none !important;
}

.tbmc-vote-document-button:hover,
.tbmc-vote-document-button:focus {
  background: #222;
  color: #d2a679 !important;
}

.tbmc-vote-form-shell button[type="submit"] {
  background: #d2a679;
  color: #1a1a1a;
  font-weight: bold;
  border: none;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
}

.tbmc-vote-form-shell .options-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tbmc-vote-form-shell .options-container input {
  width: 100%;
}

.tbmc-vote-form-shell .tbmc-vote-option-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr);
}

.tbmc-vote-form-shell .options-container button {
  width: fit-content;
  margin-top: 6px;
}

.tbmc-upcoming-votes {
  margin-bottom: 24px;
  max-width: 600px;
}

.tbmc-upcoming-vote {
  background: #1a1a1a;
  border: 1px solid #4b4035;
  border-radius: 6px;
  margin: 10px 0;
}

.tbmc-upcoming-vote summary {
  align-items: center;
  color: #f3e7d2;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  gap: 16px;
  justify-content: space-between;
  padding: 13px 16px;
}

.tbmc-upcoming-vote summary span:last-child {
  color: #d2a679;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.tbmc-upcoming-vote .tbmc-vote-editor {
  border-radius: 0 0 6px 6px;
  border-top: 1px solid #4b4035;
  box-sizing: border-box;
  max-width: 600px;
  width: 100%;
}

.tbmc-vote-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tbmc-vote-editor-actions .tbmc-delete-vote {
  background: #3a1515;
  border-color: #b35a45;
  color: #f3d0c4;
}

.tbmc-vote-editor-actions .tbmc-delete-vote:hover,
.tbmc-vote-editor-actions .tbmc-delete-vote:focus {
  background: #b35a45;
  color: #160b08;
}

.tbmc-upcoming-vote .tbmc-vote-option-row {
  background: #222;
  border: 1px solid #4b4035;
  border-radius: 4px;
  padding: 10px;
}

.tbmc-option-edit-image {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tbmc-option-edit-image span {
  color: #aaa;
  font-size: 12px;
}

.tbmc-vote-form-shell .tbmc-option-edit-thumbnail {
  background: #111;
  border: 1px solid #4b4035;
  border-radius: 4px;
  box-sizing: border-box;
  display: block;
  height: 90px !important;
  max-height: 90px !important;
  max-width: 140px !important;
  object-fit: contain;
  width: 140px !important;
}

.tbmc-remove-option {
  background: #3a1717;
  border: 1px solid #a7463f;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  padding: 7px 12px;
}

.tbmc-vote-edit-result {
  color: #d2a679;
  font-weight: 700;
  min-height: 20px;
}

@media (max-width: 600px) {
  .tbmc-vote-document {
    align-items: stretch;
    flex-direction: column;
  }

  .tbmc-vote-document-button {
    text-align: center;
  }

  .tbmc-upcoming-vote summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .tbmc-upcoming-vote summary span:last-child {
    text-align: left;
  }
}

.app-vote-card .tbmc-ranked-ballot,
.vote-card .tbmc-ranked-ballot {
  align-items: flex-start;
  display: flex !important;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
  width: 100%;
}

.app-vote-card .tbmc-ranked-fields,
.vote-card .tbmc-ranked-fields {
  display: grid !important;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
  max-width: 520px;
  width: 100%;
}

.app-vote-card .tbmc-graphic-options,
.vote-card .tbmc-graphic-options {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  margin: 14px 0 4px;
  max-width: 760px;
  width: 100%;
}

.app-vote-card .tbmc-graphic-option,
.vote-card .tbmc-graphic-option {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #8b5a2b;
  border-radius: 4px;
  margin: 0;
  padding: 8px;
}

.app-vote-card .tbmc-graphic-preview,
.vote-card .tbmc-graphic-preview {
  background: transparent;
  border: 0;
  cursor: zoom-in;
  display: block;
  margin: 0;
  padding: 0;
  width: 100%;
}

.app-vote-card .tbmc-graphic-option img,
.vote-card .tbmc-graphic-option img,
.app-vote-card .tbmc-graphic-choice img,
.vote-card .tbmc-graphic-choice img {
  background: #111;
  border: 1px solid #3c3127;
  border-radius: 4px;
  box-sizing: border-box;
  display: block;
  height: auto;
  max-height: 118px;
  object-fit: contain;
  width: 100%;
}

.app-vote-card .tbmc-graphic-option figcaption,
.vote-card .tbmc-graphic-option figcaption {
  align-items: flex-start;
  color: #f3e7d2;
  display: flex;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
  line-height: 1.25;
  margin-top: 7px;
}

.app-vote-card .tbmc-ranked-option-reference,
.vote-card .tbmc-ranked-option-reference {
  display: grid;
  gap: 8px;
  max-width: 760px;
  width: 100%;
}

.app-vote-card .tbmc-ranked-option-reference__item,
.vote-card .tbmc-ranked-option-reference__item {
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #8b5a2b;
  border-radius: 4px;
  color: #f3e7d2;
  display: grid;
  gap: 10px;
  grid-template-columns: 30px minmax(0, 1fr);
  line-height: 1.4;
  padding: 10px 12px;
  overflow-wrap: anywhere;
}

.app-vote-card .tbmc-ranked-option-key,
.vote-card .tbmc-ranked-option-key {
  align-items: center;
  background: #d2a679;
  border-radius: 3px;
  color: #1a1a1a;
  display: inline-flex;
  flex: 0 0 28px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  line-height: 1;
  width: 28px;
}

.app-vote-card .tbmc-graphic-choice,
.vote-card .tbmc-graphic-choice {
  align-items: center;
  display: grid !important;
  gap: 10px;
  grid-template-columns: 28px minmax(96px, 160px) minmax(0, 1fr);
  margin: 10px 0;
  max-width: 720px;
}

.tbmc-graphic-modal {
  align-items: center;
  background: rgba(0, 0, 0, 0.82);
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  padding: 24px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 99999;
}

.tbmc-graphic-modal.is-open {
  display: flex;
}

.tbmc-graphic-modal__content {
  background: #1a1a1a;
  border: 1px solid #8b5a2b;
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  max-height: 92vh;
  max-width: min(92vw, 920px);
  padding: 14px;
  position: relative;
}

.tbmc-graphic-modal__close {
  background: #d2a679;
  border: 1px solid #d2a679;
  border-radius: 4px;
  color: #1a1a1a;
  cursor: pointer;
  font-size: 22px;
  font-weight: 700;
  height: 36px;
  line-height: 1;
  position: absolute;
  right: 10px;
  top: 10px;
  width: 36px;
}

.tbmc-graphic-modal__image {
  background: #111;
  border: 1px solid #3c3127;
  border-radius: 4px;
  display: block;
  max-height: calc(92vh - 96px);
  max-width: 100%;
  object-fit: contain;
}

.tbmc-graphic-modal__caption {
  color: #f3e7d2;
  font-weight: 700;
  margin: 10px 46px 0 0;
}

.app-vote-card .tbmc-ranked-field,
.vote-card .tbmc-ranked-field {
  align-items: stretch;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #8b5a2b;
  border-radius: 4px;
  display: grid !important;
  gap: 8px;
  grid-template-columns: 1fr;
  margin: 0 !important;
  padding: 12px;
}

.app-vote-card .tbmc-ranked-field span,
.vote-card .tbmc-ranked-field span {
  color: #f3e7d2;
  display: block;
  font-weight: 700;
  line-height: 1.2;
}

.app-vote-card .phumc-vote-form select,
.vote-card .phumc-vote-form select {
  background: #f7f4ee !important;
  border: 1px solid #6a5943 !important;
  border-radius: 4px !important;
  box-sizing: border-box;
  color: #111 !important;
  font-size: 16px;
  max-width: 100%;
  min-height: 38px;
  padding: 7px 9px !important;
  width: 100%;
}

.app-vote-card .phumc-vote-form button[type="submit"],
.vote-card .phumc-vote-form button[type="submit"] {
  background: #d2a679 !important;
  border: 1px solid #d2a679 !important;
  border-radius: 4px;
  color: #1a1a1a !important;
  cursor: pointer;
  font-weight: 700;
  padding: 9px 18px;
}

.app-vote-card .phumc-vote-form button[type="submit"]:hover,
.app-vote-card .phumc-vote-form button[type="submit"]:focus,
.vote-card .phumc-vote-form button[type="submit"]:hover,
.vote-card .phumc-vote-form button[type="submit"]:focus {
  background: #1a1a1a !important;
  color: #d2a679 !important;
}

.tbmc-plugin-version {
  color: #a8a8a8;
  font-size: 12px;
  margin-top: 18px;
}

.tbmc-member-vote-countdown {
  color: #f3e7d2;
  display: inline-flex;
  font-family: Arial, sans-serif;
  font-size: 13px;
  gap: 5px;
  margin-left: 10px;
  white-space: nowrap;
}

.tbmc-member-vote-countdown strong {
  color: #ffcc66;
  font-variant-numeric: tabular-nums;
}

.tbmc-ballot-preview-notice {
  background: rgba(210, 166, 121, 0.1);
  border: 1px solid #d2a679;
  border-radius: 4px;
  color: #f3e7d2;
  line-height: 1.4;
  margin: 12px 0;
  max-width: 760px;
  padding: 10px 12px;
}

.tbmc-ballot-preview-notice strong {
  color: #ffcc66;
  display: block;
}

.tbmc-ballot-preview-footer {
  border-top: 1px solid #4b4035;
  color: #d2a679;
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
  padding-top: 10px;
  width: 100%;
}

.tbmc-participation-page {
  color: #f3e7d2;
  display: grid;
  gap: 18px;
  margin: 10px 0 18px;
}

.tbmc-participation-vote {
  background: #1f1f1f;
  border: 1px solid #4b4035;
  border-radius: 6px;
  overflow: hidden;
}

.tbmc-participation-header {
  align-items: flex-start;
  cursor: pointer;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  list-style: none;
  padding: 14px;
}

.tbmc-participation-vote[open] .tbmc-participation-header {
  border-bottom: 1px solid #3a332b;
}

.tbmc-participation-header::-webkit-details-marker {
  display: none;
}

.tbmc-participation-header::before {
  color: #d2a679;
  content: "+";
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  margin-top: 2px;
}

.tbmc-participation-vote[open] .tbmc-participation-header::before {
  content: "-";
}

.tbmc-participation-header h2 {
  color: #d2a679;
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 6px;
}

.tbmc-participation-header p {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.tbmc-participation-header > strong {
  color: #ffcc66;
  font-size: 16px;
  white-space: nowrap;
}

.tbmc-participation-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
}

.tbmc-participation-list {
  min-width: 0;
}

.tbmc-participation-list h3 {
  align-items: center;
  color: #f3e7d2;
  display: flex;
  font-size: 18px;
  gap: 8px;
  justify-content: space-between;
  margin: 0 0 8px;
}

.tbmc-participation-list h3 span {
  color: #ffcc66;
}

.tbmc-participation-table-wrap {
  border: 1px solid #3a332b;
  border-radius: 4px;
  max-height: 540px;
  overflow: auto;
}

.tbmc-participation-table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

.tbmc-participation-table th,
.tbmc-participation-table td {
  border-bottom: 1px solid #333;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.tbmc-participation-table th {
  background: #2a241e;
  color: #d2a679;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.tbmc-participation-table td {
  color: #f3e7d2;
}

.tbmc-ranked-explanation {
  border: 1px solid #444;
  border-radius: 6px;
  margin: 14px 0;
  padding: 12px;
}

.tbmc-ranked-round {
  border-top: 1px solid #333;
  padding-top: 10px;
}

.tbmc-ranked-position-counts {
  border-top: 1px solid #333;
  margin-top: 10px;
  padding-top: 10px;
}

@media (max-width: 600px) {
  .tbmc-member-vote-countdown {
    display: flex;
    margin: 5px 0 0;
    width: fit-content;
  }

  .app-vote-card .tbmc-ranked-ballot,
  .vote-card .tbmc-ranked-ballot {
    gap: 12px;
  }

  .app-vote-card .tbmc-ranked-option-reference,
  .vote-card .tbmc-ranked-option-reference,
  .app-vote-card .tbmc-ranked-fields,
  .vote-card .tbmc-ranked-fields {
    max-width: 100%;
  }

  .app-vote-card .tbmc-ranked-option-reference__item,
  .vote-card .tbmc-ranked-option-reference__item {
    font-size: 14px;
    padding: 9px;
  }

  .app-vote-card .tbmc-ranked-field,
  .vote-card .tbmc-ranked-field {
    padding: 10px;
  }

  .app-vote-card .phumc-vote-form select,
  .vote-card .phumc-vote-form select {
    font-size: 16px;
    min-width: 0;
    width: 100%;
  }

  .tbmc-participation-header {
    flex-direction: column;
  }

  .tbmc-participation-header > strong {
    white-space: normal;
  }

  .tbmc-participation-grid {
    grid-template-columns: 1fr;
  }
}
