/* Define a consistent color palette */
:root {
  /* Severity colors - more consistent and accessible */
  --critical-color: #d9534f;
  --high-color: #f0ad4e;
  --medium-color: #f7e359;
  --low-color: #5bc0de;
  --info-color: #5bc0de;
  --optimization-color: #28a745;

  /* Category colors - more harmonized */
  --security-color: #e74c3c;
  --gas-color: #f39c12;
  --best-practice-color: #3498db;
  --style-color: #9b59b6;
  --misc-color: #7f8c8d;

  --animation-speed: 0.2s;

  /* Category section headers */
  --category-header-bg: rgba(0, 0, 0, 0.05);
  --category-header-border: 1px solid rgba(0, 0, 0, 0.1);
}

body.vscode-light {
  --background-color: #f5f5f5;
  --card-background: #ffffff;
  --text-color: #333333;
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --button-hover: #e0e0e0;
}

body.vscode-dark {
  --background-color: #1e1e1e;
  --card-background: #2d2d2d;
  --text-color: #d4d4d4;
  --border-color: #3e3e3e;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --button-hover: #3e3e3e;
  --category-header-bg: rgba(255, 255, 255, 0.05);
  --category-header-border: 1px solid rgba(255, 255, 255, 0.1);
}

body {
  padding: 0;
  margin: 0;
  font-family: var(--vscode-font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  font-size: var(--vscode-font-size);
  line-height: 1.5;
}

.container {
  max-width: 100%;
  padding: 16px;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: 1.5em;
  display: flex;
  align-items: center;
}

#vulnerability-count {
  font-size: 0.7em;
  background: var(--vscode-badge-background);
  color: var(--vscode-badge-foreground);
  border-radius: 10px;
  padding: 2px 8px;
  margin-left: 10px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-container {
  display: flex;
  gap: 8px;
}

select {
  background: var(--card-background);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.9em;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Center content horizontally */
  gap: 6px;
  background: var(--vscode-button-background);
  color: var(--vscode-button-foreground);
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color var(--animation-speed) ease;
  min-width: 140px;
  /* Add minimum width for better appearance */
  text-align: center;
  /* Ensure text is centered */
}

.button:hover {
  background: var(--vscode-button-hoverBackground);
}

.vulnerability-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.vulnerability-item,
.linter-item {
  margin-bottom: 6px;
  border-radius: 4px;
  overflow: hidden;
  background-color: var(--card-background);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
  box-shadow: 0 1px 2px var(--shadow-color);
  transition: transform var(--animation-speed) ease, box-shadow var(--animation-speed) ease;
}

.vulnerability-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-color);
}

.vulnerability-header {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  justify-content: space-between;
  user-select: none;
}

.vulnerability-title {
  font-weight: bold;
  flex-grow: 1;
  margin: 0;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  /* Allow wrapping if needed */
}

.severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8em;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: normal;
}

.severity-badge.critical {
  background-color: var(--critical-color);
  color: white;
}

.severity-badge.high {
  background-color: var(--high-color);
  color: black;
}

.severity-badge.medium {
  background-color: var(--medium-color);
  color: black;
}

.severity-badge.low,
.severity-badge.informational {
  background-color: var(--low-color);
  color: black;
}

.severity-badge.optimization {
  background-color: var(--optimization-color);
  color: white;
}

.arrow {
  transition: transform var(--animation-speed) ease;
}

.arrow.expanded {
  transform: rotate(90deg);
}

.vulnerability-details {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.vulnerability-details.expanded {
  padding: 12px 16px;
  max-height: 800px;
  /* adjust as needed */
}

.detail-row {
  margin-bottom: 10px;
}

.detail-label {
  font-weight: bold;
  display: block;
  margin-bottom: 4px;
}

.detail-value {
  margin: 0;
  white-space: pre-wrap;
}

.clickable {
  cursor: pointer;
  text-decoration: underline;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 8px;
}

.message-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--vscode-disabledForeground);
}

.message-container .codicon {
  font-size: 2em;
  margin-bottom: 16px;
}

.filters-container {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label {
  font-weight: bold;
  font-size: 0.9em;
}

.toggle-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-button {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Add this to center the content horizontally */
  gap: 6px;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.85em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--animation-speed) ease;
  user-select: none;
  min-width: 100px;
  /* Add minimum width for more consistent button sizes */
  text-align: center;
  /* Ensure text is centered */
}

.toggle-button .toggle-icon {
  font-size: 0.9em;
}

.toggle-button.critical {
  background-color: var(--critical-color);
  color: white;
}

.toggle-button.high {
  background-color: var(--high-color);
  color: black;
}

.toggle-button.medium {
  background-color: var(--medium-color);
  color: black;
}

.toggle-button.low,
.toggle-button.informational {
  background-color: var(--low-color);
  color: black;
}

.toggle-button.optimization {
  background-color: var(--optimization-color);
  color: white;
}

.toggle-button.security {
  background-color: var(--security-color);
  color: white;
}

.toggle-button.gas {
  background-color: var(--gas-color);
  color: black;
}

.toggle-button.best-practice {
  background-color: var(--best-practice-color);
  color: white;
}

.toggle-button.style {
  background-color: var(--style-color);
  color: white;
}

.toggle-button.misc {
  background-color: var(--misc-color);
  color: white;
}

.toggle-button.disabled {
  opacity: 0.4;
  text-decoration: line-through;
}

.toggle-button.disabled .toggle-icon {
  visibility: hidden;
}

.toggle-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px var(--shadow-color);
}

.category-security {
  border-left-color: var(--security-color);
}

.category-gas {
  border-left-color: var(--gas-color);
}

.category-best-practice {
  border-left-color: var(--best-practice-color);
}

.category-style {
  border-left-color: var(--style-color);
}

.category-misc {
  border-left-color: var(--misc-color);
}

.impact-critical {
  border-left-color: var(--critical-color);
}

.impact-high {
  border-left-color: var(--high-color);
}

.impact-medium {
  border-left-color: var(--medium-color);
}

.impact-low {
  border-left-color: var(--low-color);
}

.impact-informational {
  border-left-color: var(--info-color);
}

.impact-optimization {
  border-left-color: var(--optimization-color);
}

.linter-category {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  margin-right: 8px;
  font-weight: 500;
}

.linter-category.security {
  background-color: var(--security-color);
  color: white;
}

.linter-category.gas {
  background-color: var(--gas-color);
  color: black;
}

.linter-category.best-practice {
  background-color: var(--best-practice-color);
  color: white;
}

.linter-category.style {
  background-color: var(--style-color);
  color: white;
}

.linter-category.misc {
  background-color: var(--misc-color);
  color: white;
}

.action-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
  background-color: var(--vscode-button-background);
  color: var(--vscode-button-foreground);
  border: none;
}

.action-button:hover {
  background-color: var(--vscode-button-hoverBackground);
  transform: translateY(-1px);
  box-shadow: 0 2px 3px var(--shadow-color);
}

.action-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px var(--shadow-color);
}

.focus-button {
  position: relative;
  overflow: hidden;
}

.focus-button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
}

.focus-button:focus::after {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }

  100% {
    transform: scale(30, 30);
    opacity: 0;
  }
}

.action-button .codicon {
  font-size: 12px;
}

.category-group-header {
  padding: 6px 12px;
  margin: 10px 0 5px 0;
  font-weight: 600;
  background-color: var(--category-header-bg);
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--category-header-border);
  user-select: none;
  cursor: pointer;
}

.category-group-header .count {
  background-color: var(--vscode-badge-background);
  color: var(--vscode-badge-foreground);
  border-radius: 10px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: normal;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 10px;
}

.detail-table td {
  padding: 4px 0;
}

.detail-table td:first-child {
  font-weight: 600;
  width: 100px;
  vertical-align: top;
  padding-right: 12px;
}

/* Adjust severity badge in details table */
.detail-table .severity-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}

/* Make sure the vulnerability-meta has proper spacing */
.vulnerability-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.detail-table td:first-child {
  font-weight: 600;
  width: 100px;
  vertical-align: top;
}

/* Tab styles - these already exist in the inline styles, but we'll enhance them */
.tab {
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Style the badge on tabs */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--vscode-badge-background);
  color: var(--vscode-badge-foreground);
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 4px;
  line-height: 1;
}

/* Active tab badge can have a different styling if desired */
.tab.active .tab-badge {
  background-color: var(--vscode-badge-background);
}

/* Update the vulnerability-actions class to position buttons properly */
.vulnerability-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: space-between;
  /* Space between the buttons */
}

/* Style the ignore button to be more visible but still distinct from focus */
.ignore-button {
  background-color: var(--vscode-button-secondaryBackground, rgba(100, 100, 100, 0.2));
  color: var(--vscode-button-secondaryForeground, var(--text-color));
  border: 1px solid var(--vscode-button-secondaryBorder, transparent);
}

.ignore-button:hover {
  background-color: var(--vscode-button-secondaryHoverBackground, rgba(100, 100, 100, 0.3));
}

/* Recommendation Styles */
.recommendation-box {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 5px;
  background-color: rgba(71, 184, 129, 0.1);
  border-left: 4px solid var(--optimization-color);
  position: relative;
}

.recommendation-heading {
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95em;
  color: var(--optimization-color);
}

.recommendation-box .codicon {
  font-size: 16px;
}

.explanation-box {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 5px;
  background-color: rgba(84, 174, 255, 0.08);
  border-left: 4px solid var(--info-color);
}

.explanation-box .recommendation-heading {
  color: var(--info-color);
}

body.vscode-dark .recommendation-box {
  background-color: rgba(71, 184, 129, 0.1);
}

body.vscode-dark .explanation-box {
  background-color: rgba(84, 174, 255, 0.08);
}

/* Make sure the action buttons stay at the bottom */
.vulnerability-details {
  display: flex;
  flex-direction: column;
}

.vulnerability-actions {
  margin-top: auto;
  padding-top: 12px;
}