/**
 * Elementor Price Calculator Pro – Frontend CSS v2
 * BEM-navnekonvention: .epc-[block]__[element]--[modifier]
 */

/* ─────────────────────────────────────────────────────────────────────────────
   CSS Custom properties (tema-tokens)
───────────────────────────────────────────────────────────────────────────── */
.epc-wrapper {
  --epc-primary:        #2271b1;
  --epc-primary-light:  #e8f0f8;
  --epc-accent:         #d63638;
  --epc-success:        #1c8a2c;
  --epc-error:          #c0392b;
  --epc-border:         #dcdcde;
  --epc-border-radius:  8px;
  --epc-input-radius:   6px;
  --epc-text:           #1e1e1e;
  --epc-muted:          #757575;
  --epc-bg:             #ffffff;
  --epc-summary-bg:     #f8f9fa;
  --epc-transition:     0.18s ease;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Layout
───────────────────────────────────────────────────────────────────────────── */
.epc-form-inner {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.epc-calc-side {
  flex: 1 1 0;
  min-width: 0;
}

/* Summary positions */
.epc-summary--right .epc-form-inner { flex-direction: row; }
.epc-summary--right .epc-summary    { flex: 0 0 320px; width: 320px; }

.epc-summary--top    .epc-form-inner,
.epc-summary--bottom .epc-form-inner { flex-direction: column; }
.epc-summary--top    .epc-summary,
.epc-summary--bottom .epc-summary    { width: 100%; }

/* ─────────────────────────────────────────────────────────────────────────────
   Progress-bar & Steps
───────────────────────────────────────────────────────────────────────────── */
.epc-progress-wrap {
  margin-bottom: 28px;
}

/* Linear bar */
.epc-progress-bar-outer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.epc-progress-track {
  flex: 1;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.epc-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--epc-primary);
  border-radius: inherit;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
}

.epc-progress-price-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  white-space: nowrap;
  flex-shrink: 0;
}

.epc-progress-price-label {
  font-size: 11px;
  color: var(--epc-muted);
  line-height: 1.2;
}

.epc-progress-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--epc-primary);
  line-height: 1.2;
  transition: color 0.2s;
}

/* Step dots track */
.epc-steps-track {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
  position: relative;
}

.epc-steps-track::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: #e0e0e0;
  z-index: 0;
}

.epc-step-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.epc-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #e0e0e0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--epc-muted);
  transition: background var(--epc-transition), border-color var(--epc-transition), color var(--epc-transition);
  position: relative;
  z-index: 2;
}

.epc-step-dot--active {
  background: var(--epc-primary);
  border-color: var(--epc-primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--epc-primary-light);
}

.epc-step-dot--done {
  background: var(--epc-primary);
  border-color: var(--epc-primary);
  color: #fff;
}

.epc-step-label {
  margin-top: 6px;
  font-size: 12px;
  color: var(--epc-muted);
  text-align: center;
  line-height: 1.3;
}

.epc-step-item--active .epc-step-label {
  color: var(--epc-primary);
  font-weight: 600;
}

.epc-step-desc {
  font-size: 11px;
  color: var(--epc-muted);
  text-align: center;
  margin-top: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Step panels & transitions
───────────────────────────────────────────────────────────────────────────── */
.epc-step-heading {
  font-size: 18px;
  font-weight: 600;
  color: var(--epc-text);
  margin: 0 0 20px 0;
}

.epc-step-panel {
  display: none;
  animation: none;
}

.epc-step-panel--active {
  display: block;
}

/* Slide exit */
.epc-step-panel--exit-left {
  display: block;
  animation: epcSlideOutLeft 0.22s ease forwards;
}

.epc-step-panel--exit-right {
  display: block;
  animation: epcSlideOutRight 0.22s ease forwards;
}

/* Slide enter */
.epc-step-panel--enter-right {
  display: block;
  animation: epcSlideInRight 0.22s ease forwards;
}

.epc-step-panel--enter-left {
  display: block;
  animation: epcSlideInLeft 0.22s ease forwards;
}

@keyframes epcSlideOutLeft {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-24px); }
}
@keyframes epcSlideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(24px); }
}
@keyframes epcSlideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes epcSlideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Shake (validation failed) */
@keyframes epcShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.epc-shake {
  animation: epcShake 0.45s ease both;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Field grid
───────────────────────────────────────────────────────────────────────────── */
.epc-fields-row {
  display: flex;
  flex-wrap: wrap;
  column-gap: 20px;
  row-gap: 24px;
  align-items: flex-start;
}

.epc-field-wrap {
  position: relative;
}

/* Hidden (conditional) */
.epc-field-hidden {
  display: none !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Label & hint
───────────────────────────────────────────────────────────────────────────── */
.epc-field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--epc-text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.epc-required {
  color: var(--epc-error);
}

.epc-unit-hint {
  display: block;
  font-size: 12px;
  color: var(--epc-muted);
  margin-top: -4px;
  margin-bottom: 6px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Base input styles
───────────────────────────────────────────────────────────────────────────── */
.epc-input {
  display: block;
  width: 100%;
  padding: 11px 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--epc-text);
  background: #fff;
  border: 1.5px solid var(--epc-border);
  border-radius: var(--epc-input-radius);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--epc-transition), box-shadow var(--epc-transition);
  font-family: inherit;
}

.epc-input:focus {
  outline: none;
  border-color: var(--epc-primary);
  box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.epc-input--invalid {
  border-color: var(--epc-error) !important;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.epc-input::placeholder {
  color: #b0b0b0;
}

.epc-textarea {
  resize: vertical;
  min-height: 100px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Select
───────────────────────────────────────────────────────────────────────────── */
.epc-select-wrap {
  position: relative;
}

.epc-select {
  padding-right: 40px;
  cursor: pointer;
}

.epc-select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--epc-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Range slider
───────────────────────────────────────────────────────────────────────────── */
.epc-range-wrap {
  position: relative;
  padding-top: 28px; /* space for bubble */
}

.epc-range {
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  height: 6px;
  border-radius: 3px;
  border: none;
  box-shadow: none;
  cursor: pointer;
  background: linear-gradient(
    to right,
    var(--epc-primary) 0%,
    var(--epc-primary) var(--epc-range-pct, 0%),
    #e0e0e0 var(--epc-range-pct, 0%),
    #e0e0e0 100%
  );
}

.epc-range:focus {
  box-shadow: none;
  border: none;
}

/* Thumb – Chrome/Safari */
.epc-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--epc-primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: grab;
  transition: transform 0.1s;
}

.epc-range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.15); }

/* Thumb – Firefox */
.epc-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--epc-primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: grab;
}

/* Floating bubble */
.epc-range-bubble {
  position: absolute;
  top: 0;
  left: var(--epc-range-pct, 0%);
  transform: translateX(-50%);
  background: var(--epc-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
  pointer-events: none;
  transition: left 0.05s;
}

.epc-range-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--epc-primary);
  border-bottom: none;
}

.epc-range-minmax {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--epc-muted);
  margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Visually hidden (native inputs behind card/pill)
───────────────────────────────────────────────────────────────────────────── */
.epc-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Radio / Toggle group – card style (default)
───────────────────────────────────────────────────────────────────────────── */
.epc-radio-group,
.epc-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Card */
.epc-option-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 16px;
  border: 1.5px solid var(--epc-border);
  border-radius: var(--epc-border-radius);
  cursor: pointer;
  background: #fff;
  transition: border-color var(--epc-transition), background var(--epc-transition), box-shadow var(--epc-transition);
  user-select: none;
  min-width: 100px;
  position: relative;
}

.epc-option-card:hover {
  border-color: var(--epc-primary);
  box-shadow: 0 2px 8px rgba(34,113,177,.1);
}

.epc-option-card--active {
  border-color: var(--epc-primary);
  background: var(--epc-primary-light);
}

/* Pill */
.epc-option-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--epc-border);
  border-radius: 100px;
  cursor: pointer;
  background: #fff;
  font-size: 14px;
  transition: border-color var(--epc-transition), background var(--epc-transition), color var(--epc-transition);
  user-select: none;
  white-space: nowrap;
}

.epc-option-pill:hover { border-color: var(--epc-primary); }

.epc-option-pill--active {
  background: var(--epc-primary);
  border-color: var(--epc-primary);
  color: #fff;
}

/* Label & price badge inside card/pill */
.epc-option-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.epc-option-price {
  font-size: 12px;
  color: var(--epc-primary);
  font-weight: 600;
}

.epc-option-card--active .epc-option-price,
.epc-option-pill--active .epc-option-price {
  color: inherit;
}

.epc-option-price--included {
  color: var(--epc-success);
}

/* Invalid radio group */
.epc-group--invalid .epc-option-card {
  border-color: var(--epc-error);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Checkbox card
───────────────────────────────────────────────────────────────────────────── */
.epc-checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.epc-checkbox-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--epc-border);
  border-radius: 4px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--epc-transition), border-color var(--epc-transition);
  position: relative;
}

.epc-option-card--active .epc-checkbox-icon {
  background: var(--epc-primary);
  border-color: var(--epc-primary);
}

.epc-option-card--active .epc-checkbox-icon::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Native toggle style override (when toggle_style = native)
───────────────────────────────────────────────────────────────────────────── */
.epc-toggles--native .epc-option-card,
.epc-toggles--native .epc-option-pill {
  border: none;
  background: transparent;
  padding: 0;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: auto;
}

.epc-toggles--native .epc-visually-hidden {
  position: relative !important;
  width: auto !important;
  height: auto !important;
  clip: auto !important;
  margin: 0 !important;
  overflow: visible !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Step navigation
───────────────────────────────────────────────────────────────────────────── */
.epc-step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.epc-btn-prev,
.epc-btn-next {
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--epc-input-radius);
  cursor: pointer;
  transition: opacity var(--epc-transition), transform var(--epc-transition);
  font-family: inherit;
}

.epc-btn-prev {
  background: #f0f0f0;
  color: var(--epc-text);
}

.epc-btn-next {
  background: var(--epc-primary);
  color: #fff;
  margin-left: auto;
}

.epc-btn-prev:hover,
.epc-btn-next:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Submit button
───────────────────────────────────────────────────────────────────────────── */
.epc-submit-wrap {
  margin-top: 28px;
}

.epc-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 32px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--epc-input-radius);
  cursor: pointer;
  background: var(--epc-accent);
  color: #fff;
  transition: opacity var(--epc-transition), transform var(--epc-transition), background var(--epc-transition);
  font-family: inherit;
  letter-spacing: .01em;
}

.epc-submit:hover:not(:disabled) {
  opacity: 0.88;
  transform: translateY(-1px);
}

.epc-submit:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.epc-submit--full {
  width: 100%;
}

/* Spinner */
.epc-submit__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: epcSpin 0.7s linear infinite;
}

.epc-submit--loading .epc-submit__spinner { display: block; }
.epc-submit--loading .epc-submit__text    { opacity: 0.6; }

@keyframes epcSpin {
  to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Messages
───────────────────────────────────────────────────────────────────────────── */
.epc-messages {
  display: none;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--epc-input-radius);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  line-height: 1.5;
}

.epc-messages--success {
  color: var(--epc-success);
  background: rgba(28,138,44,.08);
  border-color: rgba(28,138,44,.25);
}

.epc-messages--error {
  color: var(--epc-error);
  background: rgba(192,57,43,.08);
  border-color: rgba(192,57,43,.25);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Summary panel
───────────────────────────────────────────────────────────────────────────── */
.epc-summary {
  background: var(--epc-summary-bg);
  border: 1px solid var(--epc-border);
  border-radius: var(--epc-border-radius);
  padding: 24px;
}

.epc-summary--sticky {
  position: sticky;
  top: 24px;
}

.epc-summary__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--epc-text);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--epc-border);
}

/* Line items */
.epc-summary__lines {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.epc-summary__line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.epc-summary__line-label {
  color: var(--epc-muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epc-summary__line-amount {
  font-weight: 600;
  color: var(--epc-text);
  white-space: nowrap;
}

/* Totals */
.epc-summary__totals {
  border-top: 1px solid var(--epc-border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.epc-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  gap: 8px;
}

.epc-summary__row--subtotal,
.epc-summary__row--vat {
  color: var(--epc-muted);
}

.epc-summary__row--total {
  font-size: 18px;
  font-weight: 700;
  padding-top: 8px;
  border-top: 2px solid var(--epc-border);
  margin-top: 4px;
}

.epc-summary__total-label { color: var(--epc-text); }
.epc-summary__total-amount { color: var(--epc-primary); }

/* PDF button */
.epc-pdf-wrap {
  margin-top: 16px;
}

.epc-pdf-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: var(--epc-input-radius);
  cursor: pointer;
  transition: opacity var(--epc-transition);
  font-family: inherit;
}

.epc-pdf-btn:hover { opacity: 0.85; }

/* ─────────────────────────────────────────────────────────────────────────────
   Honeypot
───────────────────────────────────────────────────────────────────────────── */
.epc-hp-wrap {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Print iframe
───────────────────────────────────────────────────────────────────────────── */
.epc-print-frame {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  border: none;
  visibility: hidden;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive
───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .epc-summary--right .epc-form-inner {
    flex-direction: column;
  }

  .epc-summary--right .epc-summary {
    flex: none;
    width: 100%;
    position: static;
  }
}

@media (max-width: 600px) {
  .epc-field-wrap {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  .epc-steps-track {
    gap: 0;
  }

  .epc-step-label,
  .epc-step-desc {
    display: none;
  }

  .epc-step-dot {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .epc-summary {
    padding: 16px;
  }

  .epc-summary__row--total {
    font-size: 16px;
  }

  .epc-btn-prev,
  .epc-btn-next,
  .epc-submit {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .epc-step-nav {
    flex-direction: column-reverse;
  }

  .epc-btn-next { margin-left: 0; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Print (PDF via print-CSS)
───────────────────────────────────────────────────────────────────────────── */
@media print {
  .epc-wrapper,
  .epc-progress-wrap,
  .epc-step-nav,
  .epc-submit-wrap,
  .epc-messages,
  .epc-pdf-wrap,
  .epc-pdf-btn {
    display: none !important;
  }
}
