/* Player Sidebar Container */
.player-sidebar-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  overflow: hidden;
}

/* Tab Navigation */
.player-sidebar .tab-navigation {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.storyframe.player-sidebar .tab-btn {
  flex: 1;
  padding: 12px 8px;
  background: transparent !important;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--sf-text-secondary);
  font-size: 12px;
  font-weight: 600;
  position: relative;
  box-shadow: none !important;
  outline: none !important;
}

.storyframe.player-sidebar .tab-btn:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--sf-text-primary);
  box-shadow: none !important;
  outline: none !important;
}

.storyframe.player-sidebar .tab-btn.active {
  background: transparent !important;
  border-bottom-color: var(--sf-accent-primary);
  color: var(--sf-text-primary);
  box-shadow: none !important;
  outline: none !important;
}

.storyframe.player-sidebar .tab-btn:focus {
  outline: none !important;
  box-shadow: none !important;
}

.storyframe.player-sidebar .tab-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none !important;
  outline: none !important;
}

.player-sidebar .tab-btn i {
  font-size: 14px;
}

/* Notification Badge - Challenges (blue like GM) */
.player-sidebar .notification-badge-challenges {
  background: var(--sf-accent-primary);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  animation: pulse-badge 2s ease-in-out infinite;
  margin-left: 4px;
}

/* Notification Badge - Rolls (warning color) */
.player-sidebar .notification-badge-rolls {
  background: var(--sf-accent-warning);
  color: #2e3440;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  animation: pulse-badge 2s ease-in-out infinite;
  margin-left: 4px;
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Tab Content */
.player-sidebar .tab-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.player-sidebar .tab-content > section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.player-sidebar .tab-content > section.hidden {
  display: none;
}

.player-sidebar .tab-scroll-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sf-space-md);
}

/* Empty State */
.player-sidebar .empty-state-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: var(--sf-space-xl);
  text-align: center;
  gap: var(--sf-space-md);
}

.player-sidebar .empty-state-sidebar i {
  font-size: 48px;
  color: var(--sf-text-muted);
  opacity: 0.3;
  animation: hourglass-spin 2s ease-in-out infinite;
}

@keyframes hourglass-spin {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
}

.player-sidebar .empty-message {
  display: flex;
  flex-direction: column;
  gap: var(--sf-space-xs);
}

.player-sidebar .empty-message p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--sf-text-secondary);
}

.player-sidebar .empty-hint {
  font-size: 11px;
  color: var(--sf-text-muted);
  opacity: 0.8;
}

/* Challenge Tab */
.player-sidebar .challenge-tab {
  background: linear-gradient(135deg, rgba(94, 129, 172, 0.06), rgba(94, 129, 172, 0.02));
}

.player-sidebar .challenge-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sf-space-sm);
  margin-bottom: var(--sf-space-md);
  padding-bottom: var(--sf-space-md);
  border-bottom: 1px solid rgba(94, 129, 172, 0.2);
}

.player-sidebar .challenge-image-header {
  width: 64px;
  height: 64px;
  border-radius: var(--sf-radius-lg);
  object-fit: cover;
  border: 2px solid rgba(94, 129, 172, 0.4);
  box-shadow: var(--sf-shadow-md);
}

.player-sidebar .challenge-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--sf-accent-primary);
  text-align: center;
}

/* Multi-Challenge Cards */
.player-sidebar .player-challenge-card {
  background: rgba(94, 129, 172, 0.08);
  border: 1px solid rgba(94, 129, 172, 0.3);
  border-radius: var(--sf-radius-lg);
  margin-bottom: var(--sf-space-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.player-sidebar .player-challenge-card:last-child {
  margin-bottom: 0;
}

.player-sidebar .player-challenge-card.collapsed {
  background: rgba(94, 129, 172, 0.04);
  border-color: rgba(94, 129, 172, 0.2);
}

.player-sidebar .player-challenge-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  background: rgba(94, 129, 172, 0.1);
  border-bottom: 1px solid rgba(94, 129, 172, 0.2);
  transition: all 0.2s ease;
  user-select: none;
}

.player-sidebar .player-challenge-header:hover {
  background: rgba(94, 129, 172, 0.15);
}

.player-sidebar .player-challenge-card.collapsed .player-challenge-header {
  background: rgba(94, 129, 172, 0.05);
  border-bottom: none;
}

.player-sidebar .player-challenge-header .collapse-icon {
  font-size: 12px;
  color: var(--sf-text-secondary);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.player-sidebar .player-challenge-card.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.player-sidebar .challenge-image-small {
  width: 40px;
  height: 40px;
  border-radius: var(--sf-radius-md);
  object-fit: cover;
  border: 2px solid rgba(94, 129, 172, 0.4);
  box-shadow: var(--sf-shadow-sm);
  flex-shrink: 0;
}

.player-sidebar .challenge-title-compact {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--sf-accent-primary);
  flex: 1;
  line-height: 1.3;
}

.player-sidebar .player-challenge-content {
  padding: var(--sf-space-md);
  animation: slideDown 0.2s ease;
}

.player-sidebar .player-challenge-card.collapsed .player-challenge-content {
  display: none;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
  }
}

.player-sidebar .challenge-options-list {
  display: flex;
  flex-direction: column;
  gap: var(--sf-space-md);
}

.player-sidebar .challenge-option-group {
  background: rgba(94, 129, 172, 0.08);
  border: 1px solid rgba(94, 129, 172, 0.2);
  border-radius: var(--sf-radius-md);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-sidebar .challenge-option-group .option-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sf-accent-primary);
  opacity: 0.8;
}

.player-sidebar .challenge-option-group .option-description {
  font-size: 11px;
  font-weight: 600;
  color: var(--sf-text-primary);
  line-height: 1.2;
  margin-bottom: 4px;
}

.player-sidebar .option-skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 4px;
}

.player-sidebar .challenge-btn-grid {
  padding: 5px;
  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: var(--sf-radius-md);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  color: var(--sf-text-primary);
  position: relative;
}

.player-sidebar .challenge-btn-grid:hover {
  background: linear-gradient(135deg, rgba(94, 129, 172, 0.4), rgba(94, 129, 172, 0.3));
  border-color: var(--sf-accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(94, 129, 172, 0.4);
}

.player-sidebar .challenge-btn-grid i {
  font-size: 16px;
  color: var(--sf-accent-primary);
}

.player-sidebar .challenge-btn-grid .skill-name-short {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  word-break: break-word;
  hyphens: auto;
}

/* Save Buttons - Orange Accent */
.player-sidebar .challenge-btn-grid[data-check-type="save"] {
  background: linear-gradient(135deg, rgba(220, 118, 51, 0.25), rgba(220, 118, 51, 0.15));
  border-color: rgba(220, 118, 51, 0.4);
}

.player-sidebar .challenge-btn-grid[data-check-type="save"]:hover {
  background: linear-gradient(135deg, rgba(220, 118, 51, 0.4), rgba(220, 118, 51, 0.3));
  border-color: #dc7633;
  box-shadow: 0 3px 8px rgba(220, 118, 51, 0.4);
}

.player-sidebar .challenge-btn-grid[data-check-type="save"] i {
  color: #dc7633;
}

/* Proficiency Locked State */
.player-sidebar .challenge-btn-grid.proficiency-locked {
  background: linear-gradient(135deg, rgba(76, 86, 106, 0.15), rgba(76, 86, 106, 0.08));
  border-color: rgba(76, 86, 106, 0.3);
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(50%);
}

.player-sidebar .challenge-btn-grid.proficiency-locked:hover {
  background: linear-gradient(135deg, rgba(76, 86, 106, 0.15), rgba(76, 86, 106, 0.08));
  border-color: rgba(76, 86, 106, 0.3);
  transform: none;
  box-shadow: none;
}

.player-sidebar .challenge-btn-grid.proficiency-locked i {
  color: var(--sf-text-muted);
  opacity: 0.4;
}

.player-sidebar .challenge-btn-grid.proficiency-locked .skill-name-short {
  color: var(--sf-text-muted);
  opacity: 0.6;
}

.player-sidebar .proficiency-lock-icon {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 12px !important;
  color: rgba(191, 97, 106, 0.8) !important;
  opacity: 1 !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

/* Rolls Tab */
.player-sidebar .rolls-tab {
  background: linear-gradient(135deg, rgba(235, 203, 139, 0.1), rgba(235, 203, 139, 0.05));
}

/* Actor Roll Group */
.player-sidebar .actor-roll-group {
  background: var(--sf-surface-primary);
  border-radius: var(--sf-radius-lg);
  border: 1px solid rgba(235, 203, 139, 0.25);
  padding: 8px;
  margin-bottom: 8px;
  box-shadow: 0 2px 4px rgba(235, 203, 139, 0.1);
}

.player-sidebar .actor-roll-group:last-child {
  margin-bottom: 0;
}

.player-sidebar .actor-header-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(235, 203, 139, 0.2);
}

.player-sidebar .actor-avatar-small {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(235, 203, 139, 0.4);
  flex-shrink: 0;
}

.player-sidebar .actor-name {
  font-weight: 700;
  font-size: 11px;
  color: var(--sf-text-primary);
}

/* Allow Only One Badge */
.player-sidebar .allow-only-one-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, rgba(163, 190, 140, 0.3), rgba(163, 190, 140, 0.2));
  border: 1px solid rgba(163, 190, 140, 0.5);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  color: #a3be8c;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: auto;
  animation: badge-pulse 2s ease-in-out infinite;
}

.player-sidebar .allow-only-one-badge i {
  font-size: 9px;
  color: #a3be8c;
}

@keyframes badge-pulse {
  0%, 100% {
    box-shadow: 0 0 6px rgba(163, 190, 140, 0.3);
  }
  50% {
    box-shadow: 0 0 12px rgba(163, 190, 140, 0.6);
  }
}

/* Allow Only One Group Styling */
.player-sidebar .actor-roll-group.allow-only-one-group {
  border-color: rgba(163, 190, 140, 0.5);
  background: linear-gradient(135deg, rgba(163, 190, 140, 0.12), rgba(163, 190, 140, 0.08));
  box-shadow: 0 2px 8px rgba(163, 190, 140, 0.2);
}

.player-sidebar .actor-roll-group.allow-only-one-group .actor-header-compact {
  border-bottom-color: rgba(163, 190, 140, 0.4);
}

.player-sidebar .rolls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 4px;
}

.player-sidebar .roll-btn-grid {
  padding: 5px;
  background: linear-gradient(135deg, rgba(235, 203, 139, 0.25), rgba(235, 203, 139, 0.15));
  border: 2px solid rgba(235, 203, 139, 0.4);
  border-radius: var(--sf-radius-md);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  color: var(--sf-text-primary);
  animation: pending-glow 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(235, 203, 139, 0.3);
  position: relative;
}

@keyframes pending-glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(235, 203, 139, 0.4);
    border-color: rgba(235, 203, 139, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(235, 203, 139, 0.7);
    border-color: rgba(235, 203, 139, 0.8);
  }
}

.player-sidebar .roll-btn-grid:hover {
  background: linear-gradient(135deg, rgba(235, 203, 139, 0.4), rgba(235, 203, 139, 0.3));
  border-color: rgba(235, 203, 139, 0.9);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 16px rgba(235, 203, 139, 0.6);
  animation: none;
}

.player-sidebar .roll-btn-grid i {
  font-size: 18px;
  color: var(--sf-accent-primary);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.player-sidebar .roll-btn-grid .skill-name-short {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  word-break: break-word;
  hyphens: auto;
}

/* Save Roll Buttons - Orange Accent */
.player-sidebar .roll-btn-grid[data-check-type="save"] {
  background: linear-gradient(135deg, rgba(220, 118, 51, 0.25), rgba(220, 118, 51, 0.15));
  border-color: rgba(220, 118, 51, 0.4);
}

.player-sidebar .roll-btn-grid[data-check-type="save"]:hover {
  background: linear-gradient(135deg, rgba(220, 118, 51, 0.4), rgba(220, 118, 51, 0.3));
  border-color: rgba(220, 118, 51, 0.9);
  box-shadow: 0 4px 16px rgba(220, 118, 51, 0.6);
}

.player-sidebar .roll-btn-grid[data-check-type="save"] i {
  color: #dc7633;
}

.player-sidebar .action-name-micro {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.85;
}

.player-sidebar .dc-badge-grid {
  padding: 3px 7px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* DC color coding by difficulty */
.player-sidebar .dc-badge-grid[data-difficulty="trivial"] {
  background: rgba(163, 190, 140, 0.8);
  border-color: rgba(163, 190, 140, 0.4);
}

.player-sidebar .dc-badge-grid[data-difficulty="low"] {
  background: rgba(235, 203, 139, 0.8);
  border-color: rgba(235, 203, 139, 0.4);
}

.player-sidebar .dc-badge-grid[data-difficulty="moderate"] {
  background: rgba(208, 135, 112, 0.8);
  border-color: rgba(208, 135, 112, 0.4);
}

.player-sidebar .dc-badge-grid[data-difficulty="high"] {
  background: rgba(191, 97, 106, 0.9);
  border-color: rgba(191, 97, 106, 0.4);
}

.player-sidebar .dc-badge-grid[data-difficulty="extreme"] {
  background: rgba(180, 142, 173, 0.9);
  border-color: rgba(180, 142, 173, 0.4);
}

/* Inline DC badge for compact layouts */
.player-sidebar .dc-badge-inline {
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--sf-accent-primary);
  flex-shrink: 0;
}

/* Roll success animation */
.player-sidebar .roll-btn-grid.rolling {
  animation: roll-execute 0.4s ease-out;
  pointer-events: none;
}

@keyframes roll-execute {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1) rotate(5deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(0.8);
    opacity: 0;
  }
}

.player-sidebar .roll-btn-grid.success {
  background: linear-gradient(135deg, rgba(163, 190, 140, 0.4), rgba(163, 190, 140, 0.3));
  border-color: rgba(163, 190, 140, 0.8);
}

.player-sidebar .roll-btn-grid.success i::before {
  color: rgba(163, 190, 140, 1);
}

/* Player Volume Control */
.player-sidebar .player-volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
}

.player-sidebar .player-volume-slider {
  flex: 1;
  height: 4px;
  cursor: pointer;
  accent-color: var(--sf-accent-primary);
}
