/* ========================================
   GM Sidebar - Popups & Menus
   ======================================== 
   Active Challenges popup, Pending Rolls popup, DC popup, Skill Actions menu
   ======================================== */

.storyframe-pending-rolls-popup {
  width: 320px;
  max-height: 400px;
}

/* Popup Header */
.storyframe-challenges-popup .popup-header,
.storyframe-pending-rolls-popup .popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.storyframe-challenges-popup .popup-title,
.storyframe-pending-rolls-popup .popup-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.storyframe-pending-rolls-popup .popup-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.storyframe-pending-rolls-popup .group-toggle-btn {
  background: rgba(94, 129, 172, 0.2);
  border: 1px solid rgba(94, 129, 172, 0.4);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
}

.storyframe-pending-rolls-popup .group-toggle-btn:hover {
  background: rgba(94, 129, 172, 0.3);
}

.storyframe-challenges-popup .popup-close,
.storyframe-pending-rolls-popup .popup-close {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.storyframe-challenges-popup .popup-close:hover,
.storyframe-pending-rolls-popup .popup-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Popup Body */
.storyframe-challenges-popup .popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.storyframe-pending-rolls-popup .popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Challenge Items */
.storyframe-challenges-popup .challenge-item {
  background: rgba(94, 129, 172, 0.12);
  border: 1px solid rgba(94, 129, 172, 0.3);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.15s;
}

.storyframe-challenges-popup .challenge-item:hover {
  background: rgba(94, 129, 172, 0.18);
  border-color: rgba(94, 129, 172, 0.4);
}

.storyframe-challenges-popup .challenge-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.storyframe-challenges-popup .challenge-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 2px solid rgba(94, 129, 172, 0.4);
  flex-shrink: 0;
}

.storyframe-challenges-popup .challenge-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: rgba(94, 129, 172, 0.6);
  flex-shrink: 0;
}

.storyframe-challenges-popup .challenge-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.storyframe-challenges-popup .challenge-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}

.storyframe-challenges-popup .challenge-meta {
  font-size: 11px;
  color: #aaa;
}

.storyframe-challenges-popup .clear-challenge-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #888;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 6px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.storyframe-challenges-popup .clear-challenge-btn:hover {
  background: rgba(191, 97, 106, 0.2);
  border-color: rgba(191, 97, 106, 0.4);
  color: #bf616a;
}

/* Pending Rolls Groups */
.storyframe-pending-rolls-popup .pending-roll-group {
  margin-bottom: 12px;
}

.storyframe-pending-rolls-popup .group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px 6px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.storyframe-pending-rolls-popup .group-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(94, 129, 172, 0.5);
  object-fit: cover;
}

.storyframe-pending-rolls-popup .group-header i {
  color: #5e81ac;
  font-size: 14px;
}

.storyframe-pending-rolls-popup .group-name {
  flex: 1;
  font-weight: 600;
  font-size: 12px;
  color: #ffffff;
}

.storyframe-pending-rolls-popup .group-count {
  background: rgba(94, 129, 172, 0.3);
  color: #5e81ac;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}

.storyframe-pending-rolls-popup .group-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 6px 6px;
}

.storyframe-pending-rolls-popup .pending-roll-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.storyframe-pending-rolls-popup .roll-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.storyframe-pending-rolls-popup .participant-avatar-small {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(94, 129, 172, 0.4);
  object-fit: cover;
}

.storyframe-pending-rolls-popup .skill-name,
.storyframe-pending-rolls-popup .participant-name {
  font-size: 12px;
  color: #ffffff;
  flex: 1;
}

.storyframe-pending-rolls-popup .dc-badge {
  font-size: 10px;
  font-weight: 700;
  color: #5e81ac;
  padding: 2px 6px;
  background: rgba(94, 129, 172, 0.2);
  border-radius: 4px;
}

.storyframe-pending-rolls-popup .secret-badge-popup {
  font-size: 10px;
  color: var(--sf-accent-danger, #bf616a);
  opacity: 0.8;
  display: inline-flex;
  align-items: center;
}

.storyframe-pending-rolls-popup .cancel-roll-btn {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.storyframe-pending-rolls-popup .cancel-roll-btn:hover {
  background: rgba(255, 100, 100, 0.2);
  color: #ff6b6b;
}

/* Allow Only One Indicator */
.storyframe-pending-rolls-popup .pending-roll-item.allow-only-one {
  border-color: rgba(163, 190, 140, 0.4);
  background: rgba(163, 190, 140, 0.08);
}

.storyframe-pending-rolls-popup .pending-roll-item.allow-only-one-group-item {
  border-color: rgba(163, 190, 140, 0.5);
  background: rgba(163, 190, 140, 0.12);
  font-weight: 600;
}

.storyframe-pending-rolls-popup .allow-only-one-icon {
  color: #a3be8c;
  font-size: 11px;
  flex-shrink: 0;
}

.storyframe-pending-rolls-popup .group-sub-items {
  padding-left: 24px;
  margin-top: 4px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.storyframe-pending-rolls-popup .sub-roll-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  border: 1px solid rgba(163, 190, 140, 0.2);
  font-size: 11px;
}

.storyframe-pending-rolls-popup .sub-skill-name {
  flex: 1;
  color: rgba(163, 190, 140, 0.9);
}

.storyframe-pending-rolls-popup .cancel-sub-roll-btn {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.15s;
  font-size: 10px;
}

.storyframe-pending-rolls-popup .cancel-sub-roll-btn:hover {
  background: rgba(255, 100, 100, 0.15);
  color: #ff6b6b;
}

.storyframe-pending-rolls-popup .cancel-group-btn {
  background: rgba(163, 190, 140, 0.2);
  border: 1px solid rgba(163, 190, 140, 0.3);
  color: #a3be8c;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.storyframe-pending-rolls-popup .cancel-group-btn:hover {
  background: rgba(163, 190, 140, 0.3);
  border-color: rgba(163, 190, 140, 0.5);
}

/* Popup Footer */
.storyframe-challenges-popup .popup-footer,
.storyframe-pending-rolls-popup .popup-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
}

.storyframe-challenges-popup .clear-all-btn {
  background: rgba(191, 97, 106, 0.2);
  border: 1px solid rgba(191, 97, 106, 0.3);
  color: #bf616a;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.storyframe-challenges-popup .clear-all-btn:hover {
  background: rgba(191, 97, 106, 0.3);
}

.storyframe-pending-rolls-popup .cancel-all-btn {
  background: rgba(255, 100, 100, 0.2);
  border: 1px solid rgba(255, 100, 100, 0.3);
  color: #ff6b6b;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.storyframe-pending-rolls-popup .cancel-all-btn:hover {
  background: rgba(255, 100, 100, 0.3);
}

/* ========================================
   DC Popup & Skill Actions Menu
   ======================================== */

.storyframe-dc-popup,
.storyframe-skill-actions-menu {
  position: fixed;
  z-index: 100002;
  background: #1a1a2e;
  border: 1px solid #3d3d5c;
  border-radius: 8px;
  padding: 0;
  min-width: 100px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* DC Popup Header */
.storyframe-dc-popup .dc-popup-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* DC Popup Items */
.storyframe-dc-popup .dc-popup-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 6px;
  padding: 8px;
}

.storyframe-dc-popup .dc-option {
  padding: 12px;
  background: linear-gradient(135deg, rgba(94, 129, 172, 0.25), rgba(94, 129, 172, 0.15));
  border: 1px solid rgba(94, 129, 172, 0.4);
  border-radius: 6px;
  color: var(--sf-accent-primary, #5e81ac);
  cursor: pointer;
  font-size: 1.4em;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  transition: all 0.15s ease;
}

.storyframe-dc-popup .dc-option.in-view {
  background: linear-gradient(135deg, rgba(94, 129, 172, 0.6), rgba(94, 129, 172, 0.45));
  border-color: rgba(235, 203, 139, 0.4);
  box-shadow:
    0 0 12px rgba(94, 129, 172, 0.6),
    inset 0 0 20px rgba(94, 129, 172, 0.2);
}

.storyframe-dc-popup .dc-option.selected {
  background: rgba(235, 203, 139, 0.8);
  border-color: rgba(235, 203, 139, 0.4);
  color: #2e3440;
  box-shadow:
    0 0 12px rgba(235, 203, 139, 0.6),
    inset 0 0 20px rgba(235, 203, 139, 0.2);
}

.storyframe-dc-popup .dc-option:hover {
  background: linear-gradient(135deg, rgba(94, 129, 172, 0.35), rgba(94, 129, 172, 0.25));
  transform: scale(1.05);
}

.storyframe-dc-popup .dc-option.selected:hover {
  background: linear-gradient(135deg, rgba(235, 203, 139, 0.6), rgba(235, 203, 139, 0.8));
}

/* DC Popup Footer */
.storyframe-dc-popup .dc-popup-footer {
  padding: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.storyframe-dc-popup .send-selected-btn {
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  background: rgba(235, 203, 139, 0.8);
  border-color: rgba(235, 203, 139, 0.4);
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.15s ease;
}

.storyframe-dc-popup .send-selected-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(235, 203, 139, 0.35), rgba(235, 203, 139, 0.25));
  transform: translateY(-1px);
}

.storyframe-dc-popup .send-selected-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, rgba(100, 100, 100, 0.15), rgba(100, 100, 100, 0.1));
  border-color: rgba(100, 100, 100, 0.3);
  color: #666;
}

/* Save Popup Styling (Orange Theme) */
.storyframe-dc-popup.save-popup .dc-option {
  background: linear-gradient(135deg, rgba(220, 118, 51, 0.25), rgba(220, 118, 51, 0.15));
  border: 1px solid rgba(220, 118, 51, 0.4);
  color: #e67e22;
}

.storyframe-dc-popup.save-popup .dc-option.in-view {
  background: linear-gradient(135deg, rgba(192, 86, 33, 0.6), rgba(192, 86, 33, 0.45));
  border-color: rgba(220, 118, 51, 0.6);
  color: #f39c12;
  box-shadow:
    0 0 12px rgba(220, 118, 51, 0.6),
    inset 0 0 20px rgba(220, 118, 51, 0.2);
}

.storyframe-dc-popup.save-popup .dc-option:hover {
  background: linear-gradient(135deg, rgba(220, 118, 51, 0.35), rgba(220, 118, 51, 0.25));
}

.storyframe-dc-popup.save-popup .dc-option.selected {
  background: rgba(235, 203, 139, 0.8);
  border-color: rgba(235, 203, 139, 0.4);
  color: #2e3440;
  box-shadow:
    0 0 12px rgba(235, 203, 139, 0.6),
    inset 0 0 20px rgba(235, 203, 139, 0.2);
}

.storyframe-dc-popup.save-popup .dc-option.selected:hover {
  background: linear-gradient(135deg, rgba(235, 203, 139, 0.6), rgba(235, 203, 139, 0.8));
}

/* Skill Actions Menu */
.storyframe-skill-actions-menu {
  min-width: 160px;
  overflow: hidden;
}

.storyframe-skill-actions-menu .menu-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.storyframe-skill-actions-menu .menu-actions {
  display: flex;
  flex-direction: column;
  padding: 4px;
}

.storyframe-skill-actions-menu .action-option {
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: #e0e0e0;
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.storyframe-skill-actions-menu .action-option:hover {
  background: rgba(94, 129, 172, 0.3);
  color: #ffffff;
}

.storyframe-skill-actions-menu .action-option.selected {
  background: rgba(235, 203, 139, 0.2);
  color: #ebcb8b;
  border-left: 3px solid rgba(235, 203, 139, 0.7);
  padding-left: 9px;
}

.storyframe-skill-actions-menu .action-option.selected:hover {
  background: rgba(235, 203, 139, 0.3);
  color: #f0d89e;
}

/* ========================================
   Speaker Scenes Popup
   ======================================== */

.storyframe-scenes-popup {
  position: fixed;
  z-index: 100002;
  width: 320px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(30, 35, 45, 0.98), rgba(20, 25, 35, 0.95));
  border: 2px solid rgba(163, 190, 140, 0.4);
  border-radius: 12px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
}

.storyframe-scenes-popup .popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.storyframe-scenes-popup .popup-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.storyframe-scenes-popup .popup-close {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.storyframe-scenes-popup .popup-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.storyframe-scenes-popup .popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Scene Items */
.storyframe-scenes-popup .scene-item {
  background: rgba(163, 190, 140, 0.12);
  border: 1px solid rgba(163, 190, 140, 0.3);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.15s;
  cursor: pointer;
}

.storyframe-scenes-popup .scene-item:hover {
  background: rgba(163, 190, 140, 0.18);
  border-color: rgba(163, 190, 140, 0.4);
}

.storyframe-scenes-popup .scene-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.storyframe-scenes-popup .scene-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(163, 190, 140, 0.3), rgba(163, 190, 140, 0.2));
  border: 2px solid rgba(163, 190, 140, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.storyframe-scenes-popup .scene-icon {
  font-size: 24px;
  color: rgba(163, 190, 140, 0.9);
}

.storyframe-scenes-popup .scene-info {
  flex: 1;
  min-width: 0;
}

.storyframe-scenes-popup .scene-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyframe-scenes-popup .scene-meta {
  font-size: 11px;
  color: #888;
}

.storyframe-scenes-popup .scene-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.storyframe-scenes-popup .edit-scene-btn,
.storyframe-scenes-popup .update-scene-btn,
.storyframe-scenes-popup .delete-scene-btn {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.storyframe-scenes-popup .edit-scene-btn:hover {
  background: rgba(94, 129, 172, 0.2);
  color: #5e81ac;
}

.storyframe-scenes-popup .update-scene-btn:hover {
  background: rgba(136, 192, 208, 0.2);
  color: #88c0d0;
}

.storyframe-scenes-popup .delete-scene-btn:hover {
  background: rgba(191, 97, 106, 0.2);
  color: #bf616a;
}

/* ========================================
   Action Variants Popup
   ======================================== */

.storyframe-action-variants-popup {
  position: fixed;
  z-index: 100002;
  background: linear-gradient(135deg, rgba(30, 35, 45, 0.98), rgba(20, 25, 35, 0.95));
  border: 2px solid rgba(94, 129, 172, 0.4);
  border-radius: 8px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  min-width: 140px;
  max-width: 220px;
  overflow: hidden;
}

.storyframe-action-variants-popup .variants-list {
  display: flex;
  flex-direction: column;
  padding: 4px;
}

.storyframe-action-variants-popup .variant-item {
  padding: 8px 12px;
  color: #e0e0e0;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  transition: all 0.15s ease;
  cursor: default;
  border-left: 3px solid transparent;
}

.storyframe-action-variants-popup .variant-item:hover {
  background: rgba(94, 129, 172, 0.2);
  border-left-color: rgba(94, 129, 172, 0.6);
  color: #ffffff;
}

.storyframe-action-variants-popup .variant-item.selected {
  background: rgba(235, 203, 139, 0.15);
  border-left-color: rgba(235, 203, 139, 0.7);
  color: #ebcb8b;
}

.storyframe-action-variants-popup .variant-item.selected:hover {
  background: rgba(235, 203, 139, 0.25);
  color: #f0d89e;
}
