/* Control Panel Module Styles */

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

/* Controls Panel (Left) */
.controls-panel {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}

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

.panel-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Score Display */
.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.score-circle-container {
  position: relative;
  width: 140px;
  height: 140px;
}

.score-circle {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-circle-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 8;
}

.score-circle-fill {
  fill: none;
  stroke: url(#score-gradient);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.score-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.score-label {
  font-size: 1rem;
  font-weight: 600;
}

.vulnerability-count {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--warning);
}

/* Preset Buttons */
.preset-buttons {
  display: flex;
  gap: 0.5rem;
}

.preset-buttons .btn {
  flex: 1;
  justify-content: center;
}

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

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

/* Control Groups */
.control-group {
  margin-bottom: 1rem;
}

.control-group:last-child {
  margin-bottom: 0;
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.control-impact {
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
}

.control-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  margin-left: 56px;
}

/* Results Panel (Right) */
.results-panel {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}

.results-header {
  margin-bottom: 2rem;
}

.results-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.results-subtitle {
  color: var(--text-muted);
}

.results-summary {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.summary-blocked {
  color: var(--success);
}

.summary-succeeded {
  color: var(--error);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-secondary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-xl);
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.empty-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.empty-description {
  color: var(--text-muted);
  max-width: 400px;
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.result-blocked {
  border-color: rgba(34, 197, 94, 0.3);
}

.result-blocked:hover {
  border-color: var(--success);
}

.result-succeeded {
  border-color: rgba(239, 68, 68, 0.3);
}

.result-succeeded:hover {
  border-color: var(--error);
}

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

.result-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

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

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

.result-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.result-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.result-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.blocked-by {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--success);
}

.blocked-by strong {
  color: var(--text-primary);
}

.attack-warning {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--error);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 700px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.modal-title {
  font-size: 1.25rem;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.detail-section {
  margin-bottom: 1.5rem;
}

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

.detail-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

/* Blocked/Success Explanation */
.blocked-explanation,
.success-explanation {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
}

.blocked-explanation {
  background: var(--success-bg);
}

.success-explanation {
  background: var(--error-bg);
}

.shield-badge,
.warning-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shield-badge {
  background: var(--success);
  color: white;
}

.warning-badge {
  background: var(--error);
  color: white;
}

.blocked-control,
.success-reason {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.blocked-reason,
.success-fix {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Attack Steps */
.attack-steps {
  list-style: none;
}

.attack-step {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.attack-step:last-child {
  border-bottom: none;
}

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.step-normal .step-number {
  background: var(--info-bg);
  color: var(--info);
}

.step-attack .step-number {
  background: var(--error-bg);
  color: var(--error);
}

.step-compromised .step-number {
  background: var(--warning-bg);
  color: var(--warning);
}

.step-title {
  font-weight: 500;
  margin-bottom: 0.125rem;
}

.step-description {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Mitigations */
.mitigations-list {
  list-style: none;
}

.mitigation-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.mitigation-effectiveness {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

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

.mitigation-title {
  font-weight: 500;
  margin-bottom: 0.125rem;
}

.mitigation-description {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Navigation 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: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

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

  .results-panel {
    max-height: none;
  }
}

/* Hidden by default for x-cloak */
[x-cloak] {
  display: none !important;
}
