/* -------------------------------------------------- */
/* Base */
/* -------------------------------------------------- */

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

/* -------------------------------------------------- */
/* Page Layout */
/* -------------------------------------------------- */

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 5.5rem 2.5rem 3rem;
}

/* -------------------------------------------------- */
/* Header */
/* -------------------------------------------------- */

.page-header {
  margin-bottom: 2.5rem;
}

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-description {
  margin: 0;
  color: var(--text-light);
  font-size: 1rem;
  line-height: 1.5;
}

/* -------------------------------------------------- */
/* Selection Section */
/* -------------------------------------------------- */

.selection-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}

.selection-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.search-input {
  padding: 0.6rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.88rem;
  width: 240px;
  box-sizing: border-box;
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(106,90,205,0.1);
}

/* -------------------------------------------------- */
/* Category Grid */
/* -------------------------------------------------- */

.category-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}

.category-col {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  min-height: 80px;
  transition: box-shadow 0.15s;
}

.category-col:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.cat-label {
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-light);
}

.cat-tools {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cat-empty {
  font-size: 0.78rem;
  color: var(--text-light);
  font-style: italic;
}

/* -------------------------------------------------- */
/* Tool Chips */
/* -------------------------------------------------- */

.tool-chip {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.3;
  font-family: var(--font);
  font-weight: 500;
  transition: all 0.15s;
}

.tool-chip:hover {
  background: var(--pastel-lavender);
  border-color: #c4b5fd;
  transform: translateY(-1px);
}

.tool-chip.selected {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* -------------------------------------------------- */
/* Suggest a Tool */
/* -------------------------------------------------- */

.suggest-tool {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.suggest-prompt {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-light);
}

.suggest-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
  transition: opacity 0.15s;
}

.suggest-link:hover {
  opacity: 0.7;
}

.suggest-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.suggest-input {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  width: 180px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.suggest-email {
  width: 200px;
}

.suggest-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(106,90,205,0.1);
}

.suggest-select {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.15s;
}

.suggest-select:focus {
  outline: none;
  border-color: var(--accent);
}

.suggest-btn {
  padding: 0.5rem 1.1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.suggest-btn:hover {
  background: var(--accent-hover);
}

.suggest-thanks {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: #16a34a;
  font-weight: 600;
}

/* -------------------------------------------------- */
/* Selected Tools Bar */
/* -------------------------------------------------- */

.selected-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.selected-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
}

.sel-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  background: var(--accent-light);
  border: 1px solid #c4b5fd;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}

.sel-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  font-family: var(--font);
  opacity: 0.5;
  display: flex;
  align-items: center;
  transition: opacity 0.15s;
}

.sel-chip-remove:hover {
  opacity: 1;
}

.clear-btn {
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.82rem;
  white-space: nowrap;
  font-family: var(--font);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.clear-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* -------------------------------------------------- */
/* Section Divider */
/* -------------------------------------------------- */

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* -------------------------------------------------- */
/* Compatibility Definitions */
/* -------------------------------------------------- */

.compat-definitions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.compat-definitions p {
  margin: 0.35rem 0;
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.5;
}

.compat-def-title {
  margin: 0 0 0.8rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* -------------------------------------------------- */
/* Results Row (definitions + matrix side by side) */
/* -------------------------------------------------- */

.results-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.results-row .compat-definitions {
  flex-shrink: 0;
  width: 260px;
  position: sticky;
  top: 5rem;
}

.results-row .results-container {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

@media (max-width: 800px) {
  .results-row {
    flex-direction: column;
  }
  .results-row .compat-definitions {
    width: 100%;
    position: static;
  }
}

/* -------------------------------------------------- */
/* Compatibility Matrix */
/* -------------------------------------------------- */

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

.results-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.matrix-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.compat-matrix {
  border-collapse: collapse;
  font-size: 0.82rem;
}

.matrix-corner {
  min-width: 130px;
}

.matrix-col-header {
  padding: 0;
  vertical-align: bottom;
  text-align: center;
}

.matrix-col-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 0.6rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  max-height: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matrix-row-header {
  text-align: left;
  padding: 0.45rem 0.8rem 0.45rem 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  border-right: 2px solid var(--border);
}

.matrix-cell {
  text-align: center;
  padding: 0.4rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: default;
  border: 1px solid var(--border);
  min-width: 64px;
  transition: transform 0.1s;
}

.matrix-cell:hover:not(.matrix-diag) {
  transform: scale(1.05);
  z-index: 1;
}

.matrix-diag        { background: var(--surface-alt); }
.matrix-full        { background: #e6f9ee; color: #0d9a4e; }
.matrix-limited     { background: #fef9e1; color: #b8860b; }
.matrix-embed       { background: #f0ecff; color: #6d28d9; }
.matrix-iframe-only { background: #e8f2ff; color: #1d6fc0; }
.matrix-incompatible{ background: #fde8e8; color: #d32f2f; }
.matrix-unknown     { background: var(--surface-alt); color: var(--text-light); }

/* Legend */
.matrix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.legend-item {
  padding: 0.22rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
}

.legend-item.matrix-full        { background: #e6f9ee; color: #0d9a4e; }
.legend-item.matrix-limited     { background: #fef9e1; color: #b8860b; }
.legend-item.matrix-embed       { background: #f0ecff; color: #6d28d9; }
.legend-item.matrix-iframe-only { background: #e8f2ff; color: #1d6fc0; }
.legend-item.matrix-incompatible{ background: #fde8e8; color: #d32f2f; }
.legend-item.matrix-unknown     { background: var(--surface-alt); color: var(--text-light); }

/* Status labels used in definitions section */
.compat-full        { color: #0d9a4e; font-weight: 600; }
.compat-limited     { color: #b8860b; font-weight: 600; }
.compat-embed       { color: #6d28d9; font-weight: 600; }
.compat-iframe-only { color: #1d6fc0; font-weight: 600; }
.compat-incompatible{ color: #d32f2f; font-weight: 600; }
.compat-unknown     { color: #7c7e8e; font-weight: 600; }

/* -------------------------------------------------- */
/* Strategy Assessment */
/* -------------------------------------------------- */

.strategy-section {
  margin-bottom: 2rem;
}

.strategy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.strategy-header {
  padding: 1.5rem 1.75rem 0;
}

.strategy-title {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Pattern badge inside header */
.strategy-pattern {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.pattern-badge {
  display: inline-block;
  padding: 0.28rem 0.8rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.pattern-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* ---- Health Summary ---- */

.health-summary {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.health-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.1rem 0.5rem;
  border-right: 1px solid var(--border);
}

.health-stat:last-child {
  border-right: none;
}

.hs-count {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.hs-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.3rem;
}

.hs-clean    .hs-count { color: #0d9a4e; }
.hs-clean    .hs-label { color: #0d9a4e; }
.hs-attention .hs-count { color: #d97706; }
.hs-attention .hs-label { color: #d97706; }
.hs-unknown  .hs-count { color: #7c7e8e; }
.hs-unknown  .hs-label { color: #7c7e8e; }

/* ---- Strategy Blocks ---- */

.strategy-block {
  padding: 1.3rem 1.75rem;
  border-bottom: 1px solid var(--border);
}

.strategy-block:last-of-type {
  border-bottom: none;
}

.strategy-block-title {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.strategy-none {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
}

/* ---- Flagged Issues ---- */

.flag-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.flag-item {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  background: var(--surface-alt);
}

.flag-item.flag-limited     { border-left-color: #fbbf24; background: var(--pastel-yellow); }
.flag-item.flag-embed       { border-left-color: #a78bfa; background: var(--pastel-lavender); }
.flag-item.flag-iframe-only { border-left-color: #60a5fa; background: var(--pastel-blue); }
.flag-item.flag-incompatible{ border-left-color: #f87171; background: var(--pastel-pink); }
.flag-item.flag-unknown     { border-left-color: #d1d5db; }

.flag-pair {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.flag-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-pill);
}

.flag-badge-limited      { background: #fef9e1; color: #b8860b; }
.flag-badge-embed        { background: #f0ecff; color: #6d28d9; }
.flag-badge-iframe-only  { background: #e8f2ff; color: #1d6fc0; }
.flag-badge-incompatible { background: #fde8e8; color: #d32f2f; }
.flag-badge-unknown      { background: var(--surface-alt); color: var(--text-light); }

.flag-detail {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.55;
}

.flag-rec {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 0.3rem;
  font-weight: 500;
}

/* ---- Gap Analysis ---- */

.gap-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.gap-item {
  padding: 0.85rem 1.1rem;
  background: var(--pastel-peach);
  border: 1px solid #fddcb5;
  border-radius: var(--radius-sm);
}

.gap-cat {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c2410c;
}

.gap-msg {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  color: #7c3d12;
  line-height: 1.55;
}

/* ---- Recommendation ---- */

.recommendation-text {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.7;
}

/* ---- Report CTA ---- */

.report-cta {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.5rem 1.75rem;
  background: var(--pastel-lavender);
  border-top: 1px solid #e0d9ff;
  flex-wrap: wrap;
}

.report-cta-text {
  flex: 1;
  min-width: 200px;
}

.report-cta-text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.report-cta-text p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-light);
  line-height: 1.55;
}

.report-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

.report-email {
  padding: 0.6rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid #c4b5fd;
  background: white;
  font-size: 0.88rem;
  font-family: var(--font);
  width: 220px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.report-email:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(106,90,205,0.12);
}

.report-btn {
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.report-btn:hover {
  background: var(--accent-hover);
}

.report-btn:active {
  transform: scale(0.97);
}

/* -------------------------------------------------- */
/* Cost Assessment */
/* -------------------------------------------------- */

.cost-section {
  margin-top: 2rem;
}

.cost-summary {
  background: var(--pastel-lavender);
  border: 1px solid #e0d9f9;
  border-radius: var(--radius);
  padding: 1.4rem 1.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.cost-total-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.cost-total-range {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.cost-total-note {
  font-size: 0.82rem;
  color: var(--text-light);
}

.cost-table {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 1rem;
  flex-wrap: wrap;
  transition: box-shadow 0.15s;
}

.cost-row:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.cost-tool-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.cost-cat {
  font-weight: 400;
  font-size: 0.76rem;
  color: var(--text-light);
  margin-left: 0.4rem;
}

.cost-tool-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.cost-note {
  font-size: 0.76rem;
  color: var(--text-light);
  font-style: italic;
}

.cost-free  { color: #0d9a4e; font-weight: 700; font-size: 0.88rem; }
.cost-range { color: var(--text); font-weight: 600; font-size: 0.88rem; }
.cost-tx    { color: #d97706; font-weight: 600; font-size: 0.88rem; }

.cost-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.cost-badge-free { background: #e6f9ee; color: #0d9a4e; }
.cost-badge-paid { background: #fef9e1; color: #92400e; }

.cost-insights {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cost-insight-item {
  padding: 0.7rem 1rem;
  background: var(--pastel-peach);
  border-left: 3px solid #f59e0b;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.85rem;
  color: #5c3d14;
  line-height: 1.55;
}

/* -------------------------------------------------- */
/* Misc */
/* -------------------------------------------------- */

.placeholder-text {
  color: var(--text-light);
  font-size: 0.9rem;
  padding: 0.75rem 0;
}

/* -------------------------------------------------- */
/* Responsive */
/* -------------------------------------------------- */

@media (max-width: 1200px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .page {
    padding: 5.5rem 1.25rem 1.5rem;
  }
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .page {
    padding: 5.5rem 1rem 1rem;
  }
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .search-input {
    width: 100%;
  }
  .selection-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .report-cta {
    flex-direction: column;
  }
  .report-form {
    width: 100%;
  }
  .report-email {
    flex: 1;
    min-width: 0;
  }
}
