/**
 * Cost Calculator — Phase 2
 * Styles for use-case cards, bar chart, assumptions panel.
 * Brand colours: sage #9dd4c0, graphite #6b7f82, solar flare #ffd447, sky blue #eaf6ff
 */

/* Brand colour variables (local to calculator) */
.cost-calc-section {
  --calc-sage: #9dd4c0;
  --calc-graphite: #6b7f82;
  --calc-solar-flare: #ffd447;
  --calc-sky-blue: #eaf6ff;
}

/* Section layout */
.cost-calc-section {
  padding: 3rem 0;
  min-height: calc(100vh - 76px - 120px);
}

/* Caveats: collapsed by default */
.cost-calc-caveats {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.02);
}

.cost-calc-caveats-summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ah-secondary);
  list-style: none;
}

.cost-calc-caveats-summary::-webkit-details-marker {
  display: none;
}

.cost-calc-caveats-summary::before {
  content: '▶ ';
  font-size: 0.7em;
  opacity: 0.6;
}

.cost-calc-caveats[open] .cost-calc-caveats-summary::before {
  content: '▼ ';
}

.cost-calc-caveats-body {
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Step headings: clear hierarchy */
.cost-calc-step-heading {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ah-dark);
  margin-bottom: 0.5rem;
}

/* Section dividers */
.cost-calc-divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin: 1rem 0;
}

/* Learn more / Why these numbers: compact expandables */
.cost-calc-learn-more {
  border: none;
  padding: 0;
  background: transparent;
}

.cost-calc-learn-more summary {
  cursor: pointer;
  color: var(--ah-secondary);
  font-size: 0.85rem;
}

.cost-calc-learn-more summary::-webkit-details-marker {
  display: none;
}

.cost-calc-learn-more summary::before {
  content: '▶ ';
  font-size: 0.65em;
  opacity: 0.6;
}

.cost-calc-learn-more[open] summary::before {
  content: '▼ ';
}

/* Form inputs */
.cost-calc-section .form-control,
.cost-calc-section .form-select {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
}

.cost-calc-section .form-row .col-form-label {
  font-weight: 500;
  color: var(--ah-dark);
}

.cost-calc-section .field-help {
  font-size: 0.9rem;
  color: var(--ah-secondary);
  margin-top: 0.35rem;
  line-height: 1.5;
}

/* Buttons */
.cost-calc-section .btn-primary {
  background-color: var(--ah-accent);
  border-color: var(--ah-accent);
  color: var(--ah-dark);
}

.cost-calc-section .btn-primary:hover {
  background-color: #ffde6b;
  border-color: #ffde6b;
  color: var(--ah-dark);
}

.cost-calc-section .btn,
.cost-calc-section .btn-sm {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1rem;
}

.cost-calc-section .btn-sm {
  padding: 0.5rem 0.75rem;
}

/* CTA card: bottom of page, stands out */
.cost-calc-cta-card {
  background: linear-gradient(135deg, rgba(157, 212, 192, 0.25) 0%, rgba(255, 212, 71, 0.15) 100%);
  border: 2px solid var(--calc-sage);
  border-radius: 12px;
  padding: 2rem;
}

.cost-calc-cta-inner {
  max-width: 600px;
}

.cost-calc-cta-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ah-dark, #333);
  margin-bottom: 0.5rem;
}

.cost-calc-cta-lead {
  font-size: 1.05rem;
  color: var(--ah-secondary, #555);
  margin-bottom: 0;
}

.cost-calc-cta-btn {
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
}

/* Pricing "recent" badge */
.cost-calc-badge-recent {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  margin-left: 0.5rem;
  border-radius: 4px;
  background-color: var(--calc-sage);
  color: var(--ah-dark, #333);
}

/* Cards */
.cost-calc-section .card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
}

/* Use-case cards: hover/selected states */
.cost-calc-section .use-case-card {
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  min-height: 44px;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.cost-calc-section .use-case-card:hover {
  border-color: rgba(157, 212, 192, 0.6) !important;
}

.cost-calc-section .use-case-card.selected {
  border-color: var(--calc-sage) !important;
  background-color: rgba(157, 212, 192, 0.2) !important;
}

.cost-calc-section .use-case-card .card-body {
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cost-calc-section .use-case-card .card-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.cost-calc-section .use-case-cards {
  position: relative;
  z-index: 1;
}

/* Smaller cards on mobile/tablet: compact layout */
@media (max-width: 767px) {
  .cost-calc-section .use-case-cards {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
  }
  .cost-calc-section .use-case-card .card-body {
    padding: 0.5rem 0.6rem !important;
    min-height: 44px;
  }
  .cost-calc-section .use-case-card .card-title {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
  }
  .cost-calc-section .use-case-card .card-text {
    font-size: 0.75rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .cost-calc-section .use-case-card .small.text-muted:last-child {
    font-size: 0.7rem;
  }
}

.cost-calc-section .cost-calc-hidden-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cost-calc-section .use-case-detail {
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 0.75rem 0;
}


/* Expandable customise panel */
.cost-calc-section .customise-panel {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: var(--ah-light);
}

.cost-calc-section .customise-summary {
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}

.cost-calc-section .customise-summary::-webkit-details-marker {
  display: none;
}

.cost-calc-section .customise-summary::before {
  content: '▶ ';
  font-size: 0.7em;
  opacity: 0.6;
}

.cost-calc-section .customise-panel[open] .customise-summary::before {
  content: '▼ ';
}

/* Price comparison: table (70%) and bar chart (30%) side by side */
.cost-compare-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.cost-compare-table-col {
  flex: 0 0 70%;
  max-width: 70%;
}

.cost-compare-bars-col {
  flex: 0 0 30%;
  max-width: 30%;
}

@media (max-width: 767px) {
  .cost-compare-row {
    flex-direction: column;
  }
  .cost-compare-table-col,
  .cost-compare-bars-col {
    flex: 1 1 auto;
    max-width: 100%;
  }
}

/* Bar chart: standalone block */
.cost-calc-section .cost-bars,
#cost-results-container .cost-bars {
  background: var(--calc-sky-blue);
  padding: 1rem;
  border-radius: 8px;
}

.cost-calc-section .cost-bar-row,
#cost-results-container .cost-bar-row {
  margin-bottom: 0.75rem;
}

.cost-calc-section .cost-bar-row:last-child,
#cost-results-container .cost-bar-row:last-child {
  margin-bottom: 0;
}

.cost-calc-section .cost-bar-label,
#cost-results-container .cost-bar-label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--ah-dark);
}

.cost-calc-section .cost-bar-track,
#cost-results-container .cost-bar-track {
  position: relative;
  height: 24px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  overflow: hidden;
}

.cost-calc-section .cost-bar-fill,
#cost-results-container .cost-bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  transition: width 0.3s ease;
}

.cost-calc-section .cost-bar-value,
#cost-results-container .cost-bar-value {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ah-dark);
  text-shadow: 0 0 2px #fff, 0 0 4px #fff;
  white-space: nowrap;
}

/* Table */
/* Results section spacing */
#cost-results-container {
  margin-top: 1.5rem;
  padding-top: 1rem;
}

#cost-results-container .cost-calc-step-heading {
  margin-top: 0.5rem;
}

.cost-calc-pricing-updated {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ah-secondary);
}

.cost-calc-results-subheader {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ah-dark);
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--calc-sage);
}

.cost-calc-section #value-breakdown-table {
  background: rgba(157, 212, 192, 0.15);
}

.cost-calc-section #capability-matrix-table {
  font-size: 0.85rem;
}

.cost-calc-section #capability-matrix-table th {
  white-space: nowrap;
  min-width: 6rem;
}

.cost-calc-section #env-impact-table {
  background: var(--calc-sky-blue);
}

.cost-calc-section #env-impact-table th {
  background: rgba(157, 212, 192, 0.3);
  font-weight: 600;
}

.cost-calc-section .table {
  color: var(--ah-secondary);
}

.cost-calc-section .table th {
  color: var(--ah-dark);
  font-weight: 600;
}

.cost-calc-section th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.cost-calc-section th.sortable:hover {
  background: rgba(0, 0, 0, 0.04);
}

.cost-calc-section th.sortable .sort-indicator {
  opacity: 0.4;
  font-size: 0.75em;
}

.cost-calc-section th.sortable.sorted-asc .sort-indicator::after {
  content: ' ▲';
  opacity: 1;
}

.cost-calc-section th.sortable.sorted-desc .sort-indicator::after {
  content: ' ▼';
  opacity: 1;
}

/* Assumptions panel (How we calculated): full details, not learn-more */
.cost-calc-section details:not(.cost-calc-learn-more):not(.cost-calc-caveats) {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 1rem;
  background: var(--ah-light);
}

.cost-calc-section .assumptions code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
