/* Request Forge Module Styles */

/* Layout */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 220px;
  min-height: calc(100vh - 60px);
}

.main-layout.compare-mode {
  grid-template-columns: 1fr 1fr 1fr 220px;
}

/* Panels */
.request-panel,
.response-panel,
.compare-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  max-height: calc(100vh - 60px);
  overflow: hidden;
}

.compare-panel {
  background: var(--bg-secondary);
}

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

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Endpoint Tabs */
.endpoint-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-tertiary);
  padding: 0.25rem;
  border-radius: var(--radius-md);
}

.endpoint-tabs .tab {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* Form Styles */
.endpoint-form {
  margin-bottom: 1.5rem;
}

.form-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.method-badge {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.method-get {
  background: var(--info-bg);
  color: var(--info);
}

.method-post {
  background: var(--success-bg);
  color: var(--success);
}

.endpoint-path {
  font-family: monospace;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.form-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

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

.form-hint {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.form-hint svg {
  flex-shrink: 0;
  color: var(--warning);
}

.form-hint code {
  cursor: pointer;
}

.form-hint code:hover {
  color: var(--accent-primary);
}

/* Security Analysis */
.security-analysis {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.security-analysis h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.analysis-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.analysis-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.analysis-error {
  background: var(--error-bg);
  color: var(--error);
}

.analysis-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.analysis-info {
  background: var(--info-bg);
  color: var(--info);
}

.analysis-success {
  background: var(--success-bg);
  color: var(--success);
}

/* Form Actions */
.form-actions {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Response Panel */
.response-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}

.status-success {
  background: var(--success-bg);
  color: var(--success);
}

.status-error {
  background: var(--error-bg);
  color: var(--error);
}

.response-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Empty State */
.response-panel .empty-state,
.compare-panel .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem;
  height: 100%;
}

.empty-icon {
  width: 60px;
  height: 60px;
  color: var(--text-muted);
  opacity: 0.4;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Response Content */
.response-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.response-section h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.response-json {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.8125rem;
  overflow-x: auto;
  max-height: 300px;
}

/* JWT Section */
.jwt-section h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.jwt-decoded {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.jwt-part {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.jwt-label {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.jwt-content {
  padding: 0.75rem;
  margin: 0;
  font-size: 0.75rem;
  overflow-x: auto;
}

/* Token Analysis */
.token-analysis {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.token-analysis h5 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.token-claims {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.claim-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 0.75rem;
  font-size: 0.75rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--border-color);
}

.claim-row:last-child {
  border-bottom: none;
}

.claim-key {
  font-weight: 600;
  color: var(--accent-primary);
}

.claim-value {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.claim-info {
  cursor: help;
}

/* Blocked Indicator */
.blocked-indicator {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius-md);
}

.blocked-indicator svg {
  flex-shrink: 0;
  color: var(--success);
}

.blocked-indicator strong {
  display: block;
  margin-bottom: 0.25rem;
}

.blocked-indicator p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Compare Info */
.compare-info {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

/* Config Sidebar */
.config-sidebar {
  background: var(--bg-secondary);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}

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

.sidebar-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
}

.preset-buttons {
  display: flex;
  gap: 0.25rem;
}

.preset-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.preset-dot-red { background: var(--error); }
.preset-dot-yellow { background: var(--warning); }
.preset-dot-green { background: var(--success); }

.config-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.config-controls .toggle {
  font-size: 0.8125rem;
}

.config-controls .toggle-switch {
  width: 36px;
  height: 20px;
}

.config-controls .toggle-switch::after {
  width: 14px;
  height: 14px;
}

.config-controls .toggle-input:checked + .toggle-switch::after {
  transform: translateX(16px);
}

/* Token Copy Box */
.token-copy-box {
  background: var(--bg-secondary);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.token-copy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.token-copy-header h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}

.token-preview {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
  background: var(--bg-input);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

/* Score Section */
.score-section {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: auto;
}

.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.score-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.score-badge {
  font-size: 0.625rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.score-display {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.score-display .score-value {
  position: static;
  transform: none;
  font-size: 2rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-display .score-max {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.score-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition-normal);
}

.score-bar-success {
  background: var(--success);
}

.score-bar-warning {
  background: var(--warning);
}

.score-bar-error {
  background: var(--error);
}

.score-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin: 0;
}

/* Compare Toggle in Nav */
.compare-toggle {
  margin-right: 1rem;
}

.compare-toggle .toggle-switch {
  width: 36px;
  height: 20px;
}

.compare-toggle .toggle-switch::after {
  width: 14px;
  height: 14px;
}

.compare-toggle .toggle-input:checked + .toggle-switch::after {
  transform: translateX(16px);
}

/* Back button */
.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.back-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

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

  .main-layout.compare-mode {
    grid-template-columns: 1fr 1fr;
  }

  .config-sidebar {
    display: none;
  }

  .compare-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .request-panel,
  .response-panel,
  .compare-panel {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
}

/* Security Evaluation Matrix */
.security-analysis h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.matrix-summary {
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
}

.evaluation-matrix {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.matrix-row {
  display: grid;
  grid-template-columns: 20px 110px 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  transition: background var(--transition-fast);
}

.matrix-row:hover {
  background: var(--bg-tertiary);
}

.matrix-status {
  display: flex;
  align-items: center;
  justify-content: center;
}

.matrix-fail {
  background: var(--error-bg);
}

.matrix-fail .matrix-status {
  color: var(--error);
}

.matrix-fail .matrix-label {
  color: var(--error);
  font-weight: 600;
}

.matrix-pass .matrix-status {
  color: var(--success);
}

.matrix-pass .matrix-label {
  color: var(--success);
}

.matrix-disabled {
  opacity: 0.6;
}

.matrix-disabled .matrix-status {
  color: var(--text-muted);
}

.matrix-label {
  font-weight: 500;
  white-space: nowrap;
}

.matrix-message {
  color: var(--text-muted);
  font-size: 0.6875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Evaluation Results in Response Panel */
.evaluation-results {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.evaluation-results h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.eval-summary {
  font-size: 0.6875rem;
  font-weight: 400;
  text-transform: none;
  padding: 0.125rem 0.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.eval-section {
  margin-bottom: 1rem;
}

.eval-section:last-child {
  margin-bottom: 0;
}

.eval-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.eval-fail-title {
  color: var(--error);
}

.eval-pass-title {
  color: var(--success);
}

.eval-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.75rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.eval-item-fail {
  background: var(--error-bg);
  border-left: 3px solid var(--error);
}

.eval-item-fail .eval-label {
  color: var(--error);
  font-weight: 600;
}

.eval-item-pass {
  background: var(--success-bg);
  border-left: 3px solid var(--success);
}

.eval-item-pass .eval-label {
  color: var(--success);
}

.eval-item-disabled {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--text-muted);
  opacity: 0.7;
}

.eval-item-disabled .eval-label {
  color: var(--text-muted);
}

.eval-label {
  font-weight: 500;
  white-space: nowrap;
}

.eval-message {
  color: var(--text-secondary);
}
