/* Roll Request Dialog */
.storyframe.roll-request-dialog-app {
  background: var(--sf-surface-primary);
  border: 2px solid var(--sf-border-primary);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  height: auto;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.storyframe.roll-request-dialog-app .window-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  min-height: 0;
}

.roll-request-dialog {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
}

/* Content */
.roll-request-dialog .dialog-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sf-space-md);
  display: flex;
  flex-direction: column;
  gap: var(--sf-space-lg);
  min-height: 0;
}

/* Checks Summary */
.roll-request-dialog .checks-summary h3 {
  margin: 0 0 var(--sf-space-xs) 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--sf-text-primary);
}

.roll-request-dialog .drag-hint {
  margin: 0 0 var(--sf-space-sm) 0;
  font-size: 11px;
  color: var(--sf-text-secondary);
  opacity: 0.7;
}

.roll-request-dialog .checks-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sf-space-xs);
  max-height: calc(10 * 38px);
  overflow-y: auto;
}

.roll-request-dialog .check-item {
  background: var(--sf-surface-secondary);
  border: 1px solid var(--sf-border-secondary);
  border-radius: 6px;
  padding: var(--sf-space-sm) var(--sf-space-md);
  cursor: grab;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.roll-request-dialog .check-item.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.roll-request-dialog .check-item.has-links {
  border-color: var(--sf-accent-primary);
}

.roll-request-dialog .check-info {
  display: flex;
  align-items: center;
  gap: var(--sf-space-sm);
}

.roll-request-dialog .check-info i {
  font-size: 14px;
  color: var(--sf-accent-primary);
  width: 16px;
  text-align: center;
}

.roll-request-dialog .check-skill {
  font-weight: 600;
  color: var(--sf-text-primary);
  flex: 1;
}

.roll-request-dialog .check-action-name {
  font-weight: 400;
  opacity: 0.75;
  font-size: 0.9em;
}

.roll-request-dialog .check-dc {
  background: var(--sf-accent-warning);
  color: #2e3440;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.roll-request-dialog .check-secret-badge {
  background: rgba(191, 97, 106, 0.2);
  color: var(--sf-accent-danger);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(191, 97, 106, 0.3);
}

.roll-request-dialog .check-secret-badge i {
  font-size: 10px;
  width: auto;
}

/* Per-row remove button */
.roll-request-dialog .check-remove-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.roll-request-dialog .check-remove-btn:hover {
  color: var(--sf-accent-danger);
  background: rgba(191, 97, 106, 0.15);
}

.roll-request-dialog .check-remove-btn i {
  width: auto;
  font-size: 11px;
  color: inherit;
}

/* Linked PC avatars on check rows */
.roll-request-dialog .check-linked-pcs {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.roll-request-dialog .check-linked-pc {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--sf-accent-primary);
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.roll-request-dialog .check-linked-pc:hover {
  transform: scale(1.2);
  border-color: var(--sf-accent-danger);
}

/* Participants Selection */
.roll-request-dialog .participants-selection {
  display: flex;
  flex-direction: column;
}

.roll-request-dialog .participants-selection h3 {
  margin: 0 0 var(--sf-space-sm) 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--sf-text-primary);
  flex-shrink: 0;
}

.roll-request-dialog .participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  align-content: start;
  gap: var(--sf-space-sm);
  min-height: 200px;
  padding: 2px;
}

.roll-request-dialog .participant-card {
  position: relative;
  cursor: pointer;
  margin: 0;
  display: block;
}

.roll-request-dialog .participant-card input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.roll-request-dialog .participant-content {
  background: var(--sf-surface-secondary);
  border: 2px solid var(--sf-border-secondary);
  border-radius: 6px;
  padding: var(--sf-space-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sf-space-xs);
  transition: all 0.2s ease;
  position: relative;
}

.roll-request-dialog .participant-card:hover .participant-content {
  border-color: var(--sf-accent-primary);
  background: var(--sf-surface-hover);
}

.roll-request-dialog .participant-card input:checked ~ .participant-content {
  background: rgba(94, 129, 172, 0.15);
  border-color: var(--sf-accent-primary);
  box-shadow: 0 0 0 2px rgba(94, 129, 172, 0.2);
}

.roll-request-dialog .participant-content img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--sf-border-primary);
  object-fit: contain;
}

.roll-request-dialog .participant-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--sf-text-primary);
  text-align: center;
  line-height: 1.2;
}

.roll-request-dialog .check-icon {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 16px;
  color: var(--sf-accent-success);
  opacity: 0;
  transition: opacity 0.2s ease;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.roll-request-dialog .participant-card input:checked ~ .participant-content .check-icon {
  opacity: 1;
}

/* Drag-active state: hint all PC cards are droppable; disable checkbox cursor */
.roll-request-dialog .participants-grid.drag-active .participant-content {
  border-color: rgba(94, 129, 172, 0.4);
}

.roll-request-dialog .participants-grid.drag-active .participant-card {
  cursor: copy;
}

/* PC card highlighted as a valid drop target */
.roll-request-dialog .participant-content.drop-target {
  border-color: var(--sf-accent-primary) !important;
  background: rgba(94, 129, 172, 0.25) !important;
  box-shadow: 0 0 0 2px rgba(94, 129, 172, 0.35) !important;
}

/* PC card shown as an invalid drop target (PC doesn't have the required skill) */
.roll-request-dialog .participant-content.drop-ineligible {
  border-color: rgba(220, 80, 80, 0.7) !important;
  background: rgba(220, 80, 80, 0.12) !important;
  box-shadow: 0 0 0 2px rgba(220, 80, 80, 0.3) !important;
  cursor: not-allowed;
}

/* Badge showing how many checks are drag-linked to this PC */
.roll-request-dialog .pc-link-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--sf-accent-primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Allow Only One Section */
.roll-request-dialog .allow-only-one-section {
  padding: var(--sf-space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(163, 190, 140, 0.08);
}

.roll-request-dialog .allow-only-one-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(163, 190, 140, 0.15);
  border: 1px solid rgba(163, 190, 140, 0.3);
  border-radius: 6px;
  font-size: 12px;
  color: var(--sf-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  margin: 0;
}

.roll-request-dialog .allow-only-one-toggle:hover {
  background: rgba(163, 190, 140, 0.25);
  border-color: rgba(163, 190, 140, 0.5);
}

.roll-request-dialog .allow-only-one-toggle input[type='checkbox'] {
  cursor: pointer;
  margin: 0;
}

.roll-request-dialog .allow-only-one-toggle input[type='checkbox']:checked ~ span {
  color: #a3be8c;
  font-weight: 600;
}

.roll-request-dialog .allow-only-one-toggle i {
  font-size: 11px;
  color: rgba(163, 190, 140, 0.7);
  margin-left: auto;
}

/* Footer */
.roll-request-dialog .dialog-footer {
  display: flex;
  gap: var(--sf-space-sm);
  padding: var(--sf-space-md);
  background: var(--sf-surface-secondary);
  border-top: 1px solid var(--sf-border-secondary);
  border-radius: 0 0 6px 6px;
}

.roll-request-dialog .dialog-footer button {
  flex: 1;
  padding: var(--sf-space-sm) var(--sf-space-md);
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sf-space-xs);
  transition: all 0.2s ease;
}

.roll-request-dialog .cancel-btn {
  background: var(--sf-surface-primary);
  color: var(--sf-text-primary);
  border: 1px solid var(--sf-border-primary);
}

.roll-request-dialog .cancel-btn:hover {
  background: var(--sf-surface-hover);
  border-color: var(--sf-accent-danger);
  color: var(--sf-accent-danger);
}

.roll-request-dialog .submit-btn {
  background: linear-gradient(135deg, var(--sf-accent-primary) 0%, rgba(94, 129, 172, 0.9) 100%);
  color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.roll-request-dialog .submit-btn:hover {
  background: linear-gradient(135deg, rgba(94, 129, 172, 0.9) 0%, var(--sf-accent-primary) 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.roll-request-dialog .submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.roll-request-dialog .submit-btn:disabled {
  background: rgba(94, 129, 172, 0.2);
  border-color: rgba(94, 129, 172, 0.2);
  color: rgba(255, 255, 255, 0.3);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* Scrollbar styling */
.roll-request-dialog .checks-list::-webkit-scrollbar,
.roll-request-dialog .participants-grid::-webkit-scrollbar,
.roll-request-dialog .dialog-content::-webkit-scrollbar {
  width: 8px;
}

.roll-request-dialog .checks-list::-webkit-scrollbar-track,
.roll-request-dialog .participants-grid::-webkit-scrollbar-track,
.roll-request-dialog .dialog-content::-webkit-scrollbar-track {
  background: var(--sf-surface-secondary);
  border-radius: 4px;
}

.roll-request-dialog .checks-list::-webkit-scrollbar-thumb,
.roll-request-dialog .participants-grid::-webkit-scrollbar-thumb,
.roll-request-dialog .dialog-content::-webkit-scrollbar-thumb {
  background: var(--sf-border-primary);
  border-radius: 4px;
}

.roll-request-dialog .checks-list::-webkit-scrollbar-thumb:hover,
.roll-request-dialog .participants-grid::-webkit-scrollbar-thumb:hover,
.roll-request-dialog .dialog-content::-webkit-scrollbar-thumb:hover {
  background: var(--sf-accent-primary);
}
