/* ============================================
   Platform Showcase Component
   Interactive enterprise platform UI demonstration
   with progressive reveal animations.

   Dependencies: CSS custom properties from :root
   (--white, --black, --accent, --warm-gray-*,
    --border-light, --radius, --transition)
   ============================================ */

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

.platform-showcase {
  width: 94%;
  max-width: 982px;
  position: relative;
  padding: 3rem 0;
}

.platform-showcase-inner {
  position: relative;
}

.ps-ui {
  container-type: inline-size;
  width: 100%;
  display: grid;
  grid-template-columns: 55fr 45fr;
  border-radius: var(--radius);
  border: var(--border-light);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.04),
    0 24px 64px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.02);
  background: var(--white);
  overflow: visible;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.ps-col { padding: max(2.4cqi, 20px); }

/* --- Progressive Reveal --- */

.ps-ui.ps-orchestrated .ps-section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.ps-ui.ps-orchestrated .ps-section.ps-revealed {
  opacity: 1;
  transform: translateY(0);
}
.ps-ui.ps-orchestrated .ps-col-right {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.ps-ui.ps-orchestrated .ps-col-right.ps-revealed {
  opacity: 1;
}

/* --- Section Structure --- */

.ps-border-t {
  margin-top: max(2cqi, 16px);
  padding-top: max(2cqi, 16px);
}

.ps-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: max(1.2cqi, 10px);
  padding-bottom: max(0.7cqi, 6px);
  border-bottom: 1px solid var(--warm-gray-100);
}

.ps-hdr span {
  font-size: max(1.7cqi, 15px);
  font-weight: 400;
  color: var(--warm-gray-600);
  letter-spacing: 0;
}

.ps-chev {
  width: max(1.6cqi, 14px);
  height: max(1.6cqi, 14px);
  color: var(--warm-gray-400);
}

.ps-file {
  font-size: max(1.3cqi, 12px);
  color: #6c5ba7;
  margin-top: max(1.2cqi, 10px);
  margin-bottom: max(1.2cqi, 10px);
  max-width: none;
  line-height: 1.4;
  font-style: italic;
  text-align: left;
}

.ps-doc {
  display: flex;
  align-items: center;
  gap: max(0.5cqi, 4px);
  margin-bottom: max(0.6cqi, 5px);
}

.ps-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: max(0.9cqi, 8px);
  font-weight: 700;
  color: var(--white);
  border-radius: max(0.35cqi, 3px);
  width: max(2.2cqi, 19px);
  height: max(2.2cqi, 19px);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.ps-badge-il, .ps-badge-ps, .ps-badge-pd { background: #6c5ba7; }

.ps-doc-label {
  font-size: max(1.5cqi, 14px);
  font-weight: 400;
  color: var(--warm-gray-700);
}

.ps-ext {
  width: max(1.1cqi, 10px);
  height: max(1.1cqi, 10px);
  color: var(--accent);
  flex-shrink: 0;
}

.ps-quote {
  font-size: max(2.2cqi, 20px);
  color: var(--warm-gray-300);
  line-height: 0.8;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: max(0.1cqi, 1px);
}

/* --- Tables --- */

.ps-tbl {
  width: 100%;
  border-collapse: collapse;
}

.ps-tbl th {
  text-align: left;
  font-size: max(1.25cqi, 11px);
  font-weight: 600;
  color: var(--warm-gray-500);
  background: #f5f5f4;
  padding: max(0.65cqi, 6px) max(1cqi, 8px);
  border-bottom: 1px solid var(--warm-gray-100);
  white-space: nowrap;
}

.ps-tbl td {
  text-align: left;
  font-size: max(1.35cqi, 13px);
  padding: max(0.65cqi, 6px) max(1cqi, 8px);
  color: var(--warm-gray-600);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  line-height: 1.5;
  white-space: nowrap;
}

.ps-tbl tr:last-child td { border-bottom: none; }

/* --- Overcharge Finding --- */

.ps-finding {
  display: flex;
  align-items: center;
  gap: max(0.8cqi, 7px);
  margin-bottom: max(1cqi, 8px);
}

.ps-finding-label {
  font-size: max(1.4cqi, 13px);
  font-weight: 400;
  color: var(--warm-gray-700);
}

.ps-finding-amt {
  font-size: max(1.7cqi, 15px);
  font-weight: 600;
  color: var(--black);
  font-variant-numeric: tabular-nums;
}

.ps-detail {
  display: flex;
  gap: max(0.7cqi, 6px);
  align-items: flex-start;
}

.ps-detail-star {
  font-size: max(1cqi, 9px);
  color: var(--accent);
  margin-top: max(0.2cqi, 1px);
  flex-shrink: 0;
  line-height: 1.6;
}

.ps-detail-text {
  font-size: max(1.5cqi, 13px);
  color: var(--warm-gray-600);
  line-height: 1.55;
  max-width: none;
  text-align: left;
}

/* --- Agentic Workflow --- */

.ps-wf {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: max(0.35cqi, 3px);
  padding: 0;
  margin: 0;
}

.ps-wf li {
  display: flex;
  align-items: center;
  gap: max(0.7cqi, 6px);
  font-size: max(1.35cqi, 13px);
  color: var(--warm-gray-600);
  line-height: 1.4;
  padding: max(0.55cqi, 5px) max(0.8cqi, 7px);
  text-align: left;
  background: rgba(0, 0, 0, 0.015);
  border-radius: max(0.4cqi, 4px);
}

.ps-wf-num {
  font-weight: 600;
  color: var(--warm-gray-400);
  min-width: max(1.8cqi, 16px);
  text-align: left;
}

.ps-wf-text {
  flex: 1;
  text-align: left;
}

.ps-wf-icon {
  display: inline-block;
  vertical-align: middle;
  margin-left: 2px;
}

.ps-wf-status {
  width: max(1.8cqi, 16px);
  height: max(1.8cqi, 16px);
  flex-shrink: 0;
  border-radius: 50%;
  position: relative;
  transition: background 0.3s ease;
}

.ps-wf li.ps-done .ps-wf-status::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(0.6cqi, 5.5px);
  height: max(0.35cqi, 3px);
  border-left: 1.5px solid var(--white);
  border-bottom: 1.5px solid var(--white);
  transform: translate(-50%, -65%) rotate(-45deg);
}

.ps-wf li.ps-active .ps-wf-status {
  background: var(--warm-gray-300);
  animation: psPulse 1.5s ease-in-out infinite;
}

/* --- Animations --- */

@keyframes psPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes psAmtGlow {
  0%   { text-shadow: none; transform: scale(1); }
  30%  { text-shadow: 0 0 12px rgba(108, 91, 167, 0.5), 0 0 24px rgba(108, 91, 167, 0.2); transform: scale(1.08); }
  100% { text-shadow: none; transform: scale(1); }
}
.ps-finding-amt.ps-amt-glow {
  animation: psAmtGlow 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  display: inline-block;
}

@keyframes psCheckBounce {
  0%   { transform: scale(0); }
  50%  { transform: scale(1.25); }
  75%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.ps-wf li.ps-done .ps-wf-status {
  background: #1c1c1c;
  animation: psCheckBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Row highlighting for pricing error flash */
.ps-tbl tbody tr {
  transition: background-color 0.6s ease, box-shadow 0.6s ease;
}
.ps-tbl tbody tr.ps-row-highlight {
  background-color: rgba(220, 80, 60, 0.08);
}
.ps-tbl tbody tr.ps-row-highlight td:first-child {
  box-shadow: inset 3px 0 0 rgba(220, 80, 60, 0.3);
  transition: box-shadow 0.6s ease;
}

/* --- Action Buttons --- */

.ps-btns {
  display: flex;
  gap: max(0.8cqi, 7px);
  margin-top: max(1.4cqi, 12px);
}

.ps-btn-act, .ps-btn-mod {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: max(1.3cqi, 12px);
  font-weight: 600;
  padding: max(0.7cqi, 6px) max(2.4cqi, 20px);
  border-radius: max(0.5cqi, 5px);
  cursor: default;
  line-height: 1.5;
}

.ps-btn-act {
  background: var(--black);
  color: var(--white);
}

.ps-btn-mod {
  background: transparent;
  color: var(--black);
  border: 1px solid var(--warm-gray-200);
}

@container (max-width: 480px) {
  .ps-ui { grid-template-columns: 1fr; }
}

/* --- Callout Badges --- */

.callout {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  max-width: 300px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 2;
}

.callout.ps-callout-visible {
  opacity: 1;
  transform: translateY(0);
}

.callout-step {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.1em;
  line-height: 1;
  transition: background 0.3s ease;
}

.platform-showcase-inner .callout:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.05);
  z-index: 10;
}
.platform-showcase-inner .callout:hover .callout-step {
  background: #6c5ba7;
}

.callout-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.callout-body strong {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--black);
  line-height: 1.3;
}

.callout-body span {
  font-size: 0.875rem;
  color: var(--warm-gray-600);
  line-height: 1.4;
}

/* Callout positions */
.callout-0 { top: calc(-12% + 7px); left: 10%; }
.callout-3 { bottom: calc(-4% - 5px); left: -10%; }
.callout-1 { top: -13%; right: calc(-2% - 45px); }
.callout-2 { bottom: -8%; right: calc(-7% - 17px); }

/* --- Responsive: Tablet --- */

@media (max-width: 960px) {
  .platform-showcase {
    width: 100%;
  }

  .callout {
    max-width: 280px;
    padding: 0.75rem 1rem;
  }

  .callout-0 { left: -1%; }
  .callout-1 { right: -1%; }
  .callout-2 { right: -1%; }
  .callout-3 { left: -1%; }

  .callout-body strong {
    font-size: 0.9375rem;
  }

  .callout-body span {
    font-size: 0.875rem;
  }
}

/* --- Responsive: Mobile --- */

@media (max-width: 640px) {
  .ps-ui {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .ps-tbl td,
  .ps-tbl th {
    white-space: normal;
    font-size: max(1.1cqi, 11px);
  }

  .callout {
    position: static;
    max-width: 100%;
    transform: none;
    opacity: 1;
    margin-top: 0.75rem;
  }

  .callout.ps-callout-visible {
    transform: none;
  }

  .ps-ui.ps-orchestrated .ps-section {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .ps-ui.ps-orchestrated .ps-col-right {
    opacity: 1;
    transition: none;
  }

  .platform-showcase-inner {
    display: flex;
    flex-direction: column;
  }
}
