/**
 * PlaygroundPage Styles
 * 
 * Resizable two-column layout for Chat Playground.
 * Uses existing Nyla CSS variables and design patterns.
 */

/* Main container */
.playgroundContainer {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 1rem;
  gap: 1rem;
}

/* Page header */
.pageHeader {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.pageTitle {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.pageSubtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 0 0;
}

.headerControls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Main content area with resizable columns */
.mainContent {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}

/* Left panel - Chat/Messages */
.leftPanel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 300px;
}

/* Resizable divider between panels */
.resizeDivider {
  width: 8px;
  cursor: col-resize;
  background-color: transparent;
  position: relative;
  flex-shrink: 0;
  z-index: 10;
  transition: background-color 0.15s ease;
}

.resizeDivider:hover,
.resizeDivider.dragging {
  background-color: var(--border-color);
}

.dividerHandle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 40px;
  border-radius: 2px;
  background-color: var(--text-secondary);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.resizeDivider:hover .dividerHandle,
.resizeDivider.dragging .dividerHandle {
  opacity: 0.5;
}

/* Right panel - Dashboard */
.rightPanel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 200px;
  background: var(--surface-color);
  border-left: 1px solid var(--border-color);
  border-radius: 0 8px 8px 0;
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.panelTitle {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.panelContent {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Content section */
.contentSection {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.contentHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.contentArea {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Messages container */
.messagesContainer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Empty state */
.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-secondary);
  text-align: center;
}

.emptyIcon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.emptyTitle {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}

.emptyDescription {
  margin: 0;
  max-width: 400px;
}

/* Footer / Input area */
.inputFooter {
  flex-shrink: 0;
  padding: 1rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.inputRow {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.selectors {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.inputWrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.textareaWrapper {
  position: relative;
}

.inputTextarea {
  width: 100%;
  min-height: 80px;
  max-height: 200px;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  resize: vertical;
  transition: border-color 0.2s;
}

.inputTextarea:focus {
  outline: none;
  border-color: var(--primary-color, #f25843);
}

.inputTextarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.inputControls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fileButtons {
  display: flex;
  gap: 0.5rem;
}

.actionButtons {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.iconButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.iconButton:hover:not(:disabled) {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.iconButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primaryButton {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--primary-color, #f25843);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.primaryButton:hover:not(:disabled) {
  background: var(--primary-dark, #d94d3a);
}

.primaryButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.stopButton {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--danger-color, #e53e3e);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.stopButton:hover:not(:disabled) {
  background: #c53030;
}

.secondaryButton {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.secondaryButton:hover:not(:disabled) {
  background: var(--bg-secondary);
}

/* Select/Dropdown */
.selector {
  min-width: 150px;
}

.selectDropdown {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  min-width: 150px;
}

.selectDropdown:focus {
  outline: none;
  border-color: var(--primary-color, #f25843);
}

/* Statistics bar */
.statsBar {
  display: flex;
  gap: 1.5rem;
  padding: 0.5rem 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.statItem {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.statLabel {
  color: var(--text-tertiary);
}

.statValue {
  font-weight: 500;
  color: var(--text-secondary);
}

/* Pending files */
.pendingFiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.pendingFile {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.75rem;
}

.pendingFileName {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.removeFileButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
}

.removeFileButton:hover {
  background: var(--danger-color, #e53e3e);
  color: white;
}

/* Dragging state - prevent text selection */
.mainContent.dragging {
  user-select: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mainContent {
    flex-direction: column;
  }
  
  .leftPanel,
  .rightPanel {
    width: 100% !important;
  }
  
  .resizeDivider {
    display: none;
  }
  
  .rightPanel {
    border-left: none;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    max-height: 300px;
  }
}

/* Loading spinner */
.loadingSpinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-color, #f25843);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Drag & Drop Styles */
.dragOver {
  position: relative;
}

.dragOverlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(var(--primary-rgb, 242, 88, 67), 0.1);
  border: 2px dashed var(--primary-color, #f25843);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}

.dragOverlayContent {
  text-align: center;
  color: var(--primary-color, #f25843);
  font-size: 1rem;
  font-weight: 500;
}

.dragOverFooter {
  border-color: var(--primary-color, #f25843);
  background: rgba(var(--primary-rgb, 242, 88, 67), 0.05);
}

/* Prompts Row */
.promptsRow {
  display: flex;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}

.promptsSelect {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 400px;
}

.promptDropdown {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
}

.promptDropdown:focus {
  outline: none;
  border-color: var(--primary-color, #f25843);
}

.promptDropdown:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Voice Recording Button */
.iconButton.recording {
  background: var(--danger-color, #e53e3e);
  border-color: var(--danger-color, #e53e3e);
  color: white;
  animation: pulse 1.5s infinite;
}

.iconButton.recording:hover {
  background: #c53030;
  border-color: #c53030;
  color: white;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(229, 62, 62, 0);
  }
}
