/* ===== container ===== */
.sa-container {
  max-width: var(--wp--style--global--content-size, 100%);
  margin: 48px auto;
  padding: 0;
  color: var(--wp--preset--color-text, #222);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ===== main title ===== */
.sa-container>h3,
.sa-main-title {
  text-align: center;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: .2px;
  color: #166b5a;
  position: relative;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6),
    0 0 14px rgba(20, 184, 166, 0.45);
  animation: saTitleGlow 4s ease-in-out infinite;
}

.sa-container>h3::before,
.sa-main-title::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 115%;
  height: 46%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(20, 184, 166, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
  z-index: -1;
}

/* line */
.sa-container>h3::after,
.sa-main-title::after {
  content: "";
  display: block;
  width: min(42%, 240px);
  height: 2px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, #0f766e 0%, #14b8a6 60%, rgba(20, 184, 166, 0) 100%);
  border-radius: 9999px;
  animation: saUnderlinePulse 3.6s ease-in-out infinite;
  transform-origin: center;
}

@keyframes saUnderlinePulse {

  0%,
  100% {
    opacity: 1;
    transform: scaleX(1);
  }

  50% {
    opacity: .55;
    transform: scaleX(1.08);
  }
}

/* ===== intro ===== */
.sa-intro {
  text-align: center;
  color: #0f5132;
  font-size: 16px;
  font-weight: 500;
  margin: 4px auto 26px;
  text-shadow: 0 0 8px rgba(20, 184, 166, 0.15);
  animation: saIntroGlow 5s ease-in-out infinite;
  max-width: 780px;
}

@keyframes saIntroGlow {

  0%,
  100% {
    text-shadow: 0 0 6px rgba(20, 184, 166, 0.15);
  }

  50% {
    text-shadow: 0 0 12px rgba(20, 184, 166, 0.35);
  }
}

/* ===== fallback ===== */
.sa-section {
  margin-top: 28px;
  padding: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

/* ===== background ===== */
.sa-form.sa-section {
  background: #ecfdf3;
  border: 1px solid #5eead4;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.12);
}

.sa-container [data-role="results"]>.sa-section {
  background: #ecfdf3;
  border: 2px solid transparent;
  border-radius: 16px;
  background-image:
    linear-gradient(#ecfdf3, #ecfdf3),
    linear-gradient(90deg, #5eead4, #a7f3d0, #5eead4);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 6px 20px rgba(20, 184, 166, 0.08);
  animation: saBorderSoftGlow 8s ease-in-out infinite;
}

.sa-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 700;
  margin: 0 0 18px;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(22, 107, 90, 0.12);
  color: #1f2937;
  justify-content: center;
  text-align: center;
  gap: 10px;
}

/* ===== grid ===== */
.sa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.sa-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  text-align: center;
  color: #0f766e;
}

.sa-form input,
.sa-form select {
  width: 100%;
  height: 44px;
  line-height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  text-align: center;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
}

/* ===== button ===== */
.sa-form .button.button-primary {
  display: block;
  margin: 20px auto 0;
  padding: 14px 48px;
  background: linear-gradient(120deg, #0f766e 0%, #14b8a6 40%, #0f766e 80%);
  background-size: 200% 200%;
  border: none;
  border-radius: 9999px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  min-width: 190px;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.28);
  text-align: center;
}

@keyframes saButtonFlow {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.sa-form .button.button-primary {
  animation: saButtonFlow 4.2s ease-in-out infinite;
}

.sa-form .button.button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(15, 118, 110, 0.32);
}

/* ===== metrics ===== */
.sa-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.sa-metric {
  border: 1px solid #d1fae5;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(209, 250, 229, .5);
}

.sa-metric .label {
  color: #0f766e;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .01em;
  margin-bottom: 4px;
}

.sa-metric .value {
  font-weight: 800;
  font-size: 28px;
  color: #0f172a;
}

/* ===== TABLE ===== */

.sa-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sa-table {
  min-width: 540px;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid #d1fae5;
  border-radius: 14px;
  overflow: hidden;
  width: 100%;
}

.sa-table th,
.sa-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
}

.sa-table th {
  font-weight: 700;
  color: #0f5132;
  background: #f0fdf4;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  vertical-align: middle;
  padding: 12px 16px;
  letter-spacing: 0.01em;
}

.sa-table th:first-child,
.sa-table tbody td:first-child {
  text-align: left !important;
  padding-left: 36px;
}

.sa-table th:not(:first-child),
.sa-table tbody td:not(:first-child) {
  text-align: center;
}

@media (max-width: 768px) {
  .sa-table {
    min-width: 480px;
  }
}


/* ===== accordion ===== */
.sa-accordion {
  margin-top: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.sa-accordion>summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
}

.sa-accordion-body {
  padding: 12px 16px 16px;
}

/* ===== strategy ===== */
.sa-strategy {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.sa-strategy .sa-details {
  margin-top: 0 !important;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.sa-details__header {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sa-details__header .sa-h4 {
  display: block;
  font-size: clamp(18px, 2vw, 20px);
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.sa-result-callout {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #e8f7ee;
  color: #064e3b;
  border: 1px solid #34d399;
  font-weight: 600;
}

/* ===== card ===== */
.sa-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  padding: 16px 18px 18px;
  margin-top: 16px;
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.05);
}

.sa-subtitle-bottom {
  margin-top: 10px;
  color: #6b7280;
  text-align: center;
  font-size: 13px;
}

/* ===== chart ===== */
.sa-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.sa-bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 70px;
  align-items: center;
  gap: 10px;
}

.sa-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-align: right;
  white-space: nowrap;
}

.sa-bar-track {
  position: relative;
  height: 20px;
  background: #edf2f7;
  border-radius: 9999px;
  overflow: hidden;
}

.sa-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #0ea5e9 100%);
  border-radius: 9999px;
  transition: width .4s ease;
}

.sa-bar-value {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  text-align: right;
}

/* ===== media ===== */
@media (max-width: 768px) {
  .sa-container {
    margin-top: 32px;
    max-width: 100%;
    margin: 32px auto;
    padding: 0 14px;
  }

  .sa-strategy {
    grid-template-columns: 1fr;
  }

  .sa-bar-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .sa-bar-label,
  .sa-bar-value {
    text-align: left;
  }

  .sa-form .button.button-primary {
    width: 100%;
  }

  .sa-container>h3::after,
  .sa-main-title::after {
    width: 180px;
  }
}

.sa-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  text-align-last: center;
  padding-left: 0;
}

@keyframes saTitleGlow {

  0%,
  100% {
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6),
      0 0 14px rgba(20, 184, 166, 0.45);
  }

  50% {
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6),
      0 0 20px rgba(20, 184, 166, 0.7);
  }
}

.sa-card h4 {
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: #0f5132;
  margin-bottom: 12px;
}

/* ===== form BorderFlow ===== */
.sa-form.sa-section {
  background: #ecfdf3;
  border: 2px solid transparent;
  border-radius: 16px;
  background-image:
    linear-gradient(#ecfdf3, #ecfdf3),
    linear-gradient(90deg, #5eead4, #a7f3d0, #5eead4);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 6px 20px rgba(20, 184, 166, 0.08);
  animation: saBorderSoftGlow 8s ease-in-out infinite;
}

@keyframes saBorderSoftGlow {

  0%,
  100% {
    background-image:
      linear-gradient(#ecfdf3, #ecfdf3),
      linear-gradient(90deg, #5eead4, #a7f3d0, #5eead4);
  }

  50% {
    background-image:
      linear-gradient(#ecfdf3, #ecfdf3),
      linear-gradient(270deg, #a7f3d0, #5eead4, #a7f3d0);
  }
}

/* === mobile table column wrap === */
@media (max-width: 768px) {

  .sa-table th,
  .sa-table td {
    font-size: 13px;
    padding: 8px 6px;
    white-space: normal;
  }

  .sa-table th:nth-child(3) {
    max-width: 180px;
    word-break: normal;
    white-space: normal;
    line-height: 1.25;
  }

  .sa-table th:nth-child(4),
  .sa-table td:nth-child(4) {
    max-width: 150px;
    word-break: break-word;
    white-space: normal;
    line-height: 1.25;
  }
}

@media (min-width: 769px) {
  .sa-card--chart .sa-bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 70px;
    align-items: center;
    gap: 10px;
  }

  .sa-card--chart .sa-bar-label {
    text-align: right;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.2;
    padding-right: 4px;
  }

  .sa-card--chart .sa-bar-track {
    width: 100%;
  }

  .sa-card--chart .sa-bar-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding-left: 4px;
  }
}