/* TPS Quiz – Elementor Widget frontend styles */

.elementor-widget-tps_quiz {
  width: 100%;
}

.tps-eq-container {
  position: relative;
  box-sizing: border-box;
}

/* Steps */
.tps-eq-step {
  display: none;
}

.tps-eq-step.is-active {
  display: block;
}

/* Question counter */
.tps-eq-count {
  font-size: 0.85em;
  margin-bottom: 8px;
  opacity: 0.7;
}

/* Question text */
.tps-eq-question-text {
  font-size: 1.25em;
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.4;
}

/* Question description */
.tps-eq-question-desc {
  font-size: 0.95em;
  opacity: 0.75;
  margin: 0;
}

/* Question header — wraps image + text/description */
.tps-eq-question-header {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

/* Image on top (default) */
.tps-eq-img--top {
  flex-direction: column;
}

/* Image on bottom */
.tps-eq-img--bottom {
  flex-direction: column-reverse;
}

/* Image on left */
.tps-eq-img--left {
  flex-direction: row;
  align-items: center;
}

/* Image on right */
.tps-eq-img--right {
  flex-direction: row-reverse;
  align-items: center;
}

/* Body fills remaining space in horizontal layouts */
.tps-eq-img--left .tps-eq-question-body,
.tps-eq-img--right .tps-eq-question-body {
  flex: 1;
}

/* Icon/image doesn't shrink in horizontal layouts */
.tps-eq-img--left .tps-eq-question-icon,
.tps-eq-img--right .tps-eq-question-icon {
  flex: 0 0 auto;
}

/* Question icon / image */
.tps-eq-question-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tps-eq-question-icon svg,
.tps-eq-question-icon i {
  width: var(--tps-q-icon-size, 40px);
  height: var(--tps-q-icon-size, 40px);
  font-size: var(--tps-q-icon-size, 40px);
  line-height: 1;
}

.tps-eq-question-icon img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

/* Answers container — default is vertical (column). Elementor controls override this. */
.tps-eq-answers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Horizontal layout: prevent answer buttons from shrinking below their content */
.tps-eq-answers[style*="flex-direction: row"] .tps-eq-answer,
.tps-eq-answers[style*="flex-direction:row"] .tps-eq-answer {
  flex: 1;
}

/* Answer button */
.tps-eq-answer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background-color: #f5f5f5;
  color: #333;
  border: none;
  border-radius: 6px;
  font: inherit;
  font-size: 1em;
  cursor: pointer;
  text-align: left;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

/* Alignment modifiers */
.tps-eq-answer--align-left   { align-items: flex-start; text-align: left; }
.tps-eq-answer--align-center { align-items: center;     text-align: center; }
.tps-eq-answer--align-right  { align-items: flex-end;   text-align: right; }

/* Icon position modifiers */
.tps-eq-answer--icon-top    { flex-direction: column; }
.tps-eq-answer--icon-bottom { flex-direction: column-reverse; }

.tps-eq-answer--icon-left,
.tps-eq-answer--icon-right {
  flex-direction: row;
  align-items: center;
}

.tps-eq-answer--icon-right { flex-direction: row-reverse; }

/* Text+description wrapper — fills remaining space in row layouts */
.tps-eq-answer-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.tps-eq-answer:hover {
  background-color: #e8e8e8;
}

.tps-eq-answer.is-selected {
  background-color: #0073aa;
  color: #fff;
}

.tps-eq-answer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tps-eq-answer-icon svg,
.tps-eq-answer-icon i {
  width: var(--tps-a-icon-size, 24px);
  height: var(--tps-a-icon-size, 24px);
  font-size: var(--tps-a-icon-size, 24px);
  line-height: 1;
}

.tps-eq-answer-icon img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}

.tps-eq-answer-label {
  font-weight: 500;
}

.tps-eq-answer-desc {
  font-size: 0.85em;
  opacity: 0.8;
}

/* Text input */
.tps-eq-text-input {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 6px;
  resize: vertical;
  box-sizing: border-box;
}

.tps-eq-text-input:focus {
  outline: 2px solid #0073aa;
  border-color: #0073aa;
}

/* Rating stars */
.tps-eq-rating {
  display: flex;
  gap: 8px;
}

.tps-eq-star {
  width: 40px;
  height: 40px;
  background: #f5f5f5;
  border: none;
  border-radius: 50%;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.tps-eq-star:hover,
.tps-eq-star.is-selected {
  background: #0073aa;
  color: #fff;
}

/* Navigation buttons */
.tps-eq-nav-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  gap: 12px;
}

.tps-eq-btn-prev,
.tps-eq-btn-next {
  display: inline-flex;
  align-items: center;
  padding: 10px 24px;
  background-color: #0073aa;
  color: #fff;
  border: none;
  border-radius: 4px;
  font: inherit;
  font-size: 1em;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.tps-eq-btn-prev:hover,
.tps-eq-btn-next:hover {
  opacity: 0.9;
}

.tps-eq-btn-prev[style*="display:none"],
.tps-eq-btn-prev[style*="display: none"] {
  visibility: hidden;
  pointer-events: none;
}

/* Indicators */
.tps-eq-indicators {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.tps-eq-indicator {
  width: 10px;
  height: 10px;
  background-color: #ccc;
  color: #666;
  border: none;
  border-radius: 50%;
  font: inherit;
  font-size: 0.8em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  padding: 0;
}

.tps-eq-indicator.is-active {
  background-color: #0073aa;
  color: #fff;
}

/* Number indicators get min-width to accommodate the digit */
[data-nav-type="numbers"] .tps-eq-indicator {
  min-width: max(24px, var(--indicator-size, 24px));
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 600;
}

/* Results screen */
.tps-eq-results {
  text-align: center;
  padding: 16px 0;
}

.tps-eq-results-icon {
  font-size: 3em;
  color: #0073aa;
  margin-bottom: 8px;
}

.tps-eq-results-title {
  font-size: 1.4em;
  margin: 0 0 8px;
}

.tps-eq-results-message {
  opacity: 0.75;
  margin: 0 0 16px;
}

.tps-eq-results-summary {
  text-align: left;
  font-size: 0.9em;
  line-height: 1.6;
}

.tps-eq-results-summary p {
  margin: 4px 0;
}

.tps-eq-btn-restart {
  margin-top: 20px;
  padding: 10px 24px;
  background: #f5f5f5;
  color: #333;
  border: none;
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.tps-eq-btn-restart:hover {
  background: #e0e0e0;
}

/* Editor placeholder */
.tps-eq-placeholder {
  padding: 32px;
  text-align: center;
  background: #f0f0f0;
  border: 2px dashed #ccc;
  border-radius: 8px;
  color: #888;
}

/* ── Recommendation product cards ── */
.tps-eq-products {
  margin-top: 24px;
  width: 100%;
}

.tps-eq-reco-heading {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 16px;
}

.tps-eq-products-loading {
  display: flex;
  justify-content: center;
  padding: 24px;
}

.tps-eq-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: tps-spin 0.7s linear infinite;
}

@keyframes tps-spin {
  to { transform: rotate(360deg); }
}

.tps-eq-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.tps-eq-products-loop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.tps-eq-product-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.tps-eq-product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.tps-eq-product-img-link {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
}

.tps-eq-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tps-eq-product-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  flex: 1;
}

.tps-eq-product-name {
  font-size: 14px;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  line-height: 1.3;
}

.tps-eq-product-name:hover {
  text-decoration: underline;
}

.tps-eq-product-price {
  font-size: 13px;
  color: #555;
}

.tps-eq-product-btn {
  display: inline-block;
  margin-top: auto;
  padding: 8px 14px;
  background: #000;
  color: #fff;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}

.tps-eq-product-btn:hover {
  background: #333;
  color: #fff;
}

/* Unanswered shake feedback */
@keyframes tps-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.tps-eq-step.tps-eq-unanswered {
  animation: tps-shake 0.35s ease;
}
