/* Fix Cards, Tabs, and Prioritized Fix Plan Styles */

/* ===== Prioritized Fix Plan ===== */
.fix-plan {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 32px;
}

.fix-plan__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.fix-plan__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.fix-plan__subtitle {
  font-size: 13px;
  opacity: 0.7;
  color: var(--color-text);
  margin-top: 4px;
}

.fix-plan__list {
  display: grid;
  gap: 12px;
}

.fix-plan__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.fix-plan__item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--color-accent);
}

.fix-plan__item-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  display: grid;
  place-content: center;
  font-size: 14px;
  font-weight: 700;
}

.fix-plan__item-content {
  flex: 1;
  min-width: 0;
}

.fix-plan__item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.fix-plan__item-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.fix-plan__item-link {
  font-size: 12px;
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.fix-plan__item-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ===== Fix Cards Tabs ===== */
.fix-cards-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--color-border);
  flex-wrap: wrap;
}

.fix-cards-tab {
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  bottom: -2px;
}

.fix-cards-tab:hover {
  opacity: 0.8;
}

.fix-cards-tab.active {
  border-bottom-color: var(--color-accent);
  color: var(--color-accent);
}

.fix-cards-tab-count {
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.7;
  font-weight: normal;
}

.fix-cards-content {
  display: grid;
  gap: 20px;
}

.fix-cards-tab-pane {
  display: none;
}

.fix-cards-tab-pane.active {
  display: block;
}

/* ===== Search Filter ===== */
.fix-cards-search {
  margin-bottom: 20px;
}

.fix-cards-search input {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 14px;
}

.fix-cards-search input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.fix-cards-search input::placeholder {
  opacity: 0.5;
}

/* ===== Fix Card ===== */
.fix-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.fix-card.highlight {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(76, 170, 255, 0.2);
}

.fix-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.fix-card__title-row {
  flex: 1;
  min-width: 0;
}

.fix-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
  line-height: 1.3;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.fix-card__status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fix-card__status.opportunity {
  background: rgba(255, 200, 60, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(255, 200, 60, 0.3);
}

.fix-card__status.diagnostics {
  background: rgba(76, 170, 255, 0.15);
  color: #4caaff;
  border: 1px solid rgba(76, 170, 255, 0.3);
}

.fix-card__status.passed {
  background: rgba(80, 210, 140, 0.15);
  color: #50d28c;
  border: 1px solid rgba(80, 210, 140, 0.3);
}

.fix-card__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.fix-card__badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}

.fix-card__badge--impact-high {
  background: rgba(255, 90, 90, 0.1);
  color: #ff5a5a;
  border-color: rgba(255, 90, 90, 0.3);
}

.fix-card__badge--impact-medium {
  background: rgba(255, 200, 60, 0.1);
  color: #fbc83d;
  border-color: rgba(255, 200, 60, 0.3);
}

.fix-card__badge--impact-low {
  background: rgba(180, 180, 180, 0.1);
  color: #b4b4b4;
  border-color: rgba(180, 180, 180, 0.3);
}

.fix-card__badge--effort-easy {
  background: rgba(80, 210, 140, 0.1);
  color: #50d28c;
  border-color: rgba(80, 210, 140, 0.3);
}

.fix-card__badge--effort-medium {
  background: rgba(255, 200, 60, 0.1);
  color: #fbc83d;
  border-color: rgba(255, 200, 60, 0.3);
}

.fix-card__badge--effort-hard {
  background: rgba(255, 120, 90, 0.1);
  color: #ff785a;
  border-color: rgba(255, 120, 90, 0.3);
}

.fix-card__badge--owner-dev {
  background: rgba(76, 170, 255, 0.1);
  color: #4caaff;
  border-color: rgba(76, 170, 255, 0.3);
}

.fix-card__badge--owner-designer {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.3);
}

.fix-card__badge--owner-sysadmin {
  background: rgba(236, 72, 153, 0.1);
  color: #ec4899;
  border-color: rgba(236, 72, 153, 0.3);
}

.fix-card__badge--owner-content {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.fix-card__badge--affects-mobile {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.fix-card__badge--affects-desktop {
  background: rgba(76, 170, 255, 0.1);
  color: #4caaff;
  border-color: rgba(76, 170, 255, 0.3);
}

.fix-card__badge--affects-both {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.3);
}

.fix-card__body {
  margin-top: 16px;
}

.fix-card__section {
  margin-bottom: 16px;
}

.fix-card__section:last-child {
  margin-bottom: 0;
}

.fix-card__section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  opacity: 0.9;
}

.fix-card__section-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  opacity: 0.85;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.fix-card__fixes-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fix-card__fixes-list li {
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.fix-card__fixes-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: 700;
}

.fix-card__steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step-counter;
}

.fix-card__steps-list li {
  padding: 8px 0;
  padding-left: 28px;
  position: relative;
  counter-increment: step-counter;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.fix-card__steps-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  display: grid;
  place-content: center;
  font-size: 11px;
  font-weight: 700;
}

.fix-card__verify-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fix-card__verify-list li {
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.fix-card__verify-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #50d28c;
  font-weight: 700;
}

.fix-card__snippets {
  margin-top: 12px;
}

.fix-card__snippet {
  margin-bottom: 12px;
}

.fix-card__snippet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.fix-card__snippet-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  opacity: 0.8;
}

.fix-card__snippet-copy {
  padding: 4px 10px;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s;
}

.fix-card__snippet-copy:hover {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.fix-card__snippet-copy.copied {
  background: #50d28c;
  color: white;
  border-color: #50d28c;
}

.fix-card__snippet-code {
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text);
}

.fix-card__snippet-code code {
  background: transparent;
  padding: 0;
  border: none;
}

.fix-card__toggles {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.fix-card__toggle {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.fix-card__toggle:hover {
  background: var(--color-soft);
}

.fix-card__toggle.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.fix-card__explanation {
  display: block;
}

.fix-card__explanation.hidden {
  display: none;
}

.fix-card__details {
  display: none;
}

.fix-card__details.visible {
  display: block;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  opacity: 0.7;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.fix-card__details.visible a {
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  display: inline-block;
}

/* No fix available message */
.fix-card__no-fix {
  padding: 16px;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-align: center;
  color: var(--color-text);
  opacity: 0.7;
  font-size: 13px;
  line-height: 1.6;
}

/* Expand/Collapse All Controls */
.fix-cards-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.fix-cards-controls button {
  padding: 8px 14px;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.fix-cards-controls button:hover {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

/* Passed audits collapsed section */
.fix-cards-passed {
  margin-top: 24px;
}

.fix-cards-passed-toggle {
  padding: 10px 14px;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.fix-cards-passed-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

.fix-cards-passed-content {
  display: none;
  margin-top: 16px;
}

.fix-cards-passed-content.visible {
  display: block;
}

/* Light theme adjustments */
html[data-theme="light"] .fix-card {
  background: white;
  border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .fix-plan__item {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .fix-plan__item:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Prevent horizontal overflow on all containers */
.fix-card,
.fix-plan,
.fix-cards-content,
.fix-cards-tab-pane,
.fix-cards-wrapper {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Ensure all text content wraps */
.fix-card *,
.fix-plan *,
.fix-card__section-content *,
.fix-card__details * {
  word-wrap: break-word !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  max-width: 100% !important;
}

/* Ensure parent containers don't allow horizontal scroll */
.result-section:has(.fix-card),
.result-section:has(.fix-plan) {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

/* Fix specific overflow issues with URLs */
.fix-card__section-content a,
.fix-card__details a,
.fix-card a {
  word-break: break-all !important;
  overflow-wrap: anywhere !important;
  display: inline-block;
  max-width: 100% !important;
}

/* Responsive */
@media (max-width: 980px) {
  .fix-cards-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .fix-card__header {
    flex-direction: column;
  }
  
  .fix-card__badges {
    width: 100%;
  }
  
  /* Additional mobile overflow protection */
  .result-section,
  .fix-plan,
  .fix-card {
    padding-left: 16px;
    padding-right: 16px;
  }
}
