/* Scenarios Page Specific Styles */

/* Header Actions */
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: #8250df;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #9966e0;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: #8250df;
}

.btn-replay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #238636;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-replay:hover {
  background: #2ea043;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: rgba(218, 54, 51, 0.1);
  border-color: #da3633;
  color: #da3633;
}

.btn-text {
  background: none;
  border: none;
  color: #8250df;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-text:hover {
  background: rgba(130, 80, 223, 0.1);
}

.btn-cancel {
  padding: 10px 18px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  background: var(--bg-hover);
}

/* Main Layout (Three Column) */
.scenarios-layout {
  display: grid;
  grid-template-columns: 280px 1fr 400px;
  gap: 20px;
  margin-top: 20px;
  height: calc(100vh - 140px);
}

/* Scenarios Sidebar */
.scenarios-sidebar {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.count-badge {
  background: #8250df;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: #fff;
}

.sidebar-search {
  position: relative;
  margin-bottom: 12px;
}

.sidebar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
}

.sidebar-search input:focus {
  outline: none;
  border-color: #8250df;
}

.sidebar-search input::placeholder {
  color: var(--text-secondary);
}

.scenario-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scenario-item {
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.scenario-item:hover {
  border-color: #8250df;
  background: var(--bg-hover);
}

.scenario-item.active {
  border-color: #8250df;
  background: rgba(130, 80, 223, 0.1);
}

.scenario-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.scenario-item-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.scenario-item-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state svg {
  opacity: 0.5;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 4px;
}

.empty-state .hint {
  font-size: 12px;
  opacity: 0.7;
}

/* Editor Panel */
.editor-panel {
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
  padding: 40px;
}

.editor-placeholder svg {
  opacity: 0.3;
  margin-bottom: 16px;
  color: #8250df;
}

.editor-placeholder h2 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.editor-placeholder p {
  font-size: 14px;
}

.editor-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.editor-title-section {
  flex: 1;
  margin-right: 16px;
}

.scenario-name-input {
  width: 100%;
  padding: 8px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  transition: border-color 0.2s;
}

.scenario-name-input:focus {
  outline: none;
  border-bottom-color: #8250df;
}

.scenario-desc-input {
  width: 100%;
  padding: 6px 0;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  resize: none;
  height: 40px;
}

.scenario-desc-input:focus {
  outline: none;
  color: var(--text-primary);
}

.editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.requests-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.requests-header h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.request-count {
  font-size: 12px;
  color: var(--text-secondary);
}

.requests-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.no-requests {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  text-align: center;
}

.no-requests p {
  margin-bottom: 16px;
}

/* Request Card */
.request-card {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.request-card:hover {
  border-color: #8250df;
}

.request-card.active {
  border-color: #8250df;
  background: rgba(130, 80, 223, 0.1);
}

.request-card.dragging {
  opacity: 0.5;
  background: var(--bg-hover);
}

.request-card.drag-over {
  border-top: 2px solid #8250df;
}

.request-drag-handle {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 12px;
  cursor: grab;
  padding: 4px;
  color: var(--text-secondary);
}

.request-drag-handle:active {
  cursor: grabbing;
}

.drag-dot {
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
}

.request-order {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #8250df;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  margin-right: 12px;
}

.request-info {
  flex: 1;
  min-width: 0;
}

.request-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.request-path {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.request-delete-btn {
  padding: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.2s;
}

.request-card:hover .request-delete-btn {
  opacity: 1;
}

.request-delete-btn:hover {
  background: rgba(218, 54, 51, 0.1);
  color: #da3633;
}

/* Detail Panel */
.detail-panel-container {
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
}

.detail-panel-scenario {
  height: 100%;
  overflow-y: auto;
  padding: 20px;
}

.detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
}

.detail-header-scenario {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.detail-header-scenario h2 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-url-scenario {
  color: var(--text-secondary);
  font-size: 12px;
  word-break: break-all;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.detail-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.detail-tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.detail-tab:hover {
  color: var(--text-primary);
}

.detail-tab.active {
  color: #8250df;
  border-bottom-color: #8250df;
}

.detail-tab-content {
  display: none;
}

.detail-tab-content.active {
  display: block;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.detail-section pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  font-size: 12px;
  max-height: 300px;
}

.detail-section pre code {
  color: var(--text-primary);
}

/* Variables Section */
.variables-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.variable-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(130, 80, 223, 0.15);
  border: 1px solid #8250df;
  border-radius: 16px;
  font-size: 12px;
  color: #8250df;
  margin-right: 8px;
  margin-bottom: 8px;
}

.variable-tag .var-type {
  font-size: 10px;
  opacity: 0.7;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.2s ease;
}

.modal-content.modal-large {
  max-width: 700px;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  padding: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #8250df;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

/* HAR Selection Modal */
.har-upload-section {
  margin-bottom: 20px;
}

.har-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg-primary);
  border: 2px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.har-drop-zone:hover {
  border-color: #8250df;
  background: var(--bg-hover);
}

.har-drop-zone.drag-over {
  border-color: #8250df;
  background: rgba(130, 80, 223, 0.1);
}

.har-drop-zone svg {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.har-drop-zone p {
  color: var(--text-secondary);
  font-size: 14px;
}

.har-requests-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.har-requests-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

#selectedCount {
  font-size: 13px;
  color: var(--text-secondary);
}

.har-requests-list {
  max-height: 300px;
  overflow-y: auto;
}

.har-request-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.har-request-item:last-child {
  border-bottom: none;
}

.har-request-item:hover {
  background: var(--bg-hover);
}

.har-request-item.selected {
  background: rgba(130, 80, 223, 0.1);
}

.har-request-checkbox {
  width: 16px;
  height: 16px;
  margin-right: 12px;
  accent-color: #8250df;
}

.har-request-info {
  flex: 1;
  min-width: 0;
}

.har-request-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.har-request-path {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.har-request-status {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Replay Modal */
.replay-progress {
  margin-bottom: 20px;
}

.replay-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.replay-status {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.replay-status.success {
  color: #238636;
}

.replay-status.error {
  color: #da3633;
}

.replay-timing {
  font-size: 13px;
  color: var(--text-secondary);
}

.replay-progress-bar-container {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.replay-progress-bar {
  height: 100%;
  background: #8250df;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.replay-results {
  max-height: 400px;
  overflow-y: auto;
}

.replay-result-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
}

.replay-result-item.success {
  border-left: 3px solid #238636;
}

.replay-result-item.error {
  border-left: 3px solid #da3633;
}

.replay-result-order {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  margin-right: 12px;
}

.replay-result-info {
  flex: 1;
  min-width: 0;
}

.replay-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.replay-result-path {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replay-result-timing {
  font-size: 12px;
  color: var(--text-secondary);
}

.replay-result-error {
  font-size: 12px;
  color: #da3633;
  margin-top: 4px;
}

.replay-variables {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.replay-variables h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.variables-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Responsive */
@media (max-width: 1200px) {
  .scenarios-layout {
    grid-template-columns: 240px 1fr 350px;
  }
}

@media (max-width: 992px) {
  .scenarios-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .scenarios-sidebar,
  .editor-panel,
  .detail-panel-container {
    max-height: 500px;
  }
}

@media (max-width: 768px) {
  .editor-header {
    flex-direction: column;
    gap: 12px;
  }

  .editor-title-section {
    margin-right: 0;
  }

  .editor-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
