/**
 * PrintPoss Multi-Step Form - Frontend Stylesheet
 * Fully compatible with WordPress & Flatsome Theme
 */

:root {
  --ppsf-primary: #16a34a;
  --ppsf-primary-hover: #15803d;
  --ppsf-grad-start: #fbfde3;
  --ppsf-grad-mid: #dff3d4;
  --ppsf-grad-end: #b9e8cb;
  --ppsf-max-width: 640px;
  --ppsf-radius: 10px;
  --ppsf-font: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Base Wrapper Reset (Protects from Flatsome global overrides) */
.ppsf-wrapper {
  box-sizing: border-box;
  font-family: var(--ppsf-font);
  color: #111;
  position: relative;
  width: 100%;
}

.ppsf-wrapper *, 
.ppsf-wrapper *::before, 
.ppsf-wrapper *::after {
  box-sizing: border-box;
}

/* Trigger Button (for Modal mode) */
.ppsf-reopen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border: 0;
  border-radius: 6px;
  background-color: var(--ppsf-primary);
  color: #ffffff !important;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color .2s ease, transform .15s ease, box-shadow .2s ease;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.ppsf-reopen-btn:hover {
  background-color: var(--ppsf-primary-hover);
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.45);
}

/* Modal Overlay & Container */
.ppsf-is-modal .ppsf-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  backdrop-filter: blur(2px);
}

/* Inline Embed Mode */
.ppsf-is-inline .ppsf-modal-overlay {
  position: relative;
  width: 100%;
  display: block;
  background: transparent;
  padding: 0;
  z-index: 10;
}

/* Modal Dialog Box */
.ppsf-modal-dialog {
  position: relative;
  width: 100%;
  max-width: var(--ppsf-max-width);
  margin: auto;
  padding: 42px 38px 36px;
  border-radius: var(--ppsf-radius);
  background: linear-gradient(135deg, var(--ppsf-grad-start) 0%, var(--ppsf-grad-mid) 45%, var(--ppsf-grad-end) 100%);
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  animation: ppsf-pop .4s cubic-bezier(.2, .9, .3, 1.2);
}

@keyframes ppsf-pop {
  from { opacity: 0; transform: translateY(22px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.ppsf-modal-dialog.ppsf-closing {
  animation: ppsf-out .25s ease forwards;
}
@keyframes ppsf-out {
  to { opacity: 0; transform: translateY(16px) scale(.97); }
}

/* Close button - matches screenshot with circle & border */
.ppsf-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ppsf-primary);
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.1);
  color: var(--ppsf-primary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  z-index: 5;
  padding: 0;
}
.ppsf-close-btn:hover {
  background: var(--ppsf-primary);
  color: #fff;
  transform: rotate(90deg);
}

/* Header typography */
.ppsf-modal-title {
  margin: 0 0 6px !important;
  text-align: center;
  color: var(--ppsf-primary) !important;
  font-size: 31px !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
}

.ppsf-modal-sub {
  text-align: center;
  font-size: 17px;
  margin: 0 0 24px !important;
  color: #222;
  font-weight: 500;
}

/* Progress Bar */
.ppsf-progress-bar-wrap {
  height: 8px;
  border-radius: 99px;
  background: rgba(22, 163, 74, .2);
  overflow: hidden;
  margin-bottom: 8px;
}
.ppsf-progress-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ppsf-primary);
  border-radius: 99px;
  transition: width .45s ease;
}
.ppsf-step-count {
  font-size: 14px;
  color: #4b5563;
  margin-bottom: 18px;
  text-align: right;
  font-weight: 600;
}

/* Step Transitions */
.ppsf-step-pane {
  animation: ppsf-inRight .35s ease both;
}
.ppsf-step-pane.ppsf-back {
  animation-name: ppsf-inLeft;
}
@keyframes ppsf-inRight {
  from { opacity: 0; transform: translateX(35px); }
  to { opacity: 1; transform: none; }
}
@keyframes ppsf-inLeft {
  from { opacity: 0; transform: translateX(-35px); }
  to { opacity: 1; transform: none; }
}

.ppsf-question-title {
  font-size: 21px !important;
  font-weight: 700 !important;
  margin: 0 0 6px !important;
  color: #14532d !important;
  line-height: 1.35 !important;
}
.ppsf-question-hint {
  font-size: 15px;
  color: #4b5563;
  margin: 0 0 16px !important;
}

/* Options */
.ppsf-options-list {
  display: grid;
  gap: 10px;
}
.ppsf-opt-item {
  display: flex !important;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  min-height: 52px;
  background: #ffffff;
  border: 1.5px solid #9fb3a6;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, transform .15s, box-shadow .15s, background .15s;
  color: #1f2937;
  margin-bottom: 0 !important;
  font-weight: 500;
}
.ppsf-opt-item:hover {
  border-color: var(--ppsf-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, .18);
}
.ppsf-opt-item input[type="radio"],
.ppsf-opt-item input[type="checkbox"] {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  width: 0 !important;
  height: 0 !important;
}
.ppsf-mark {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 2px solid #7a8a80;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  background: #fff;
}
.ppsf-multi .ppsf-mark {
  border-radius: 5px;
}
.ppsf-mark::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  transition: transform .15s;
}
.ppsf-opt-item.ppsf-selected {
  border-color: var(--ppsf-primary);
  background: #effaf1;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .2);
}
.ppsf-opt-item.ppsf-selected .ppsf-mark {
  background: var(--ppsf-primary);
  border-color: var(--ppsf-primary);
}
.ppsf-opt-item.ppsf-selected .ppsf-mark::after {
  transform: rotate(-45deg) scale(1);
}

/* Textarea & Inputs */
.ppsf-textarea, 
.ppsf-input-email, 
.ppsf-input-tel {
  width: 100% !important;
  font: inherit !important;
  font-size: 16px !important;
  padding: 12px 14px !important;
  border: 1px solid #7a8a80 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  color: #111 !important;
  outline: none !important;
  box-shadow: none !important;
}
.ppsf-textarea {
  margin-top: 12px;
  min-height: 90px;
  resize: vertical;
  animation: ppsf-inRight .3s ease;
}
.ppsf-textarea:focus, 
.ppsf-input-email:focus, 
.ppsf-phone-wrap:focus-within {
  border-color: var(--ppsf-primary) !important;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .25) !important;
}

/* Contact form fields */
.ppsf-field-group {
  margin-bottom: 18px;
}
.ppsf-label {
  display: block;
  font-size: 16px;
  margin: 0 0 6px !important;
  color: #1f2937;
  font-weight: 600;
}
.ppsf-phone-wrap {
  display: flex;
  align-items: center;
  height: 50px;
  border: 1px solid #7a8a80;
  border-radius: 6px;
  background: #fff;
  transition: border-color .15s;
}
.ppsf-phone-country {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-right: 1px solid #e5e7eb;
}
.ppsf-phone-arrow {
  font-size: 10px;
  color: #444;
}
.ppsf-phone-flag {
  width: 28px;
  height: 19px;
  display: block;
}
.ppsf-phone-wrap input {
  border: 0 !important;
  box-shadow: none !important;
  height: 100% !important;
  padding-left: 10px !important;
  background: transparent !important;
  width: 100% !important;
  outline: none !important;
  font-size: 16px !important;
}
.ppsf-err-msg {
  color: #b91c1c;
  font-size: 13px;
  margin-top: 5px;
  min-height: 18px;
}
.ppsf-invalid {
  border-color: #b91c1c !important;
}

/* Navigation buttons */
.ppsf-nav-buttons {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}
.ppsf-btn {
  height: 54px;
  border: 0;
  border-radius: 6px;
  font-size: 17px !important;
  font-weight: 700 !important;
  letter-spacing: .4px;
  text-transform: uppercase !important;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}
.ppsf-btn-next {
  flex: 1;
  background: var(--ppsf-primary);
  color: #ffffff !important;
}
.ppsf-btn-next:hover:not(:disabled) {
  background: var(--ppsf-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(22, 163, 74, .35);
}
.ppsf-btn-next:disabled {
  background: #a7c4b0 !important;
  cursor: not-allowed;
  opacity: .85;
}
.ppsf-btn-back {
  flex: 0 0 110px;
  background: transparent !important;
  color: var(--ppsf-primary) !important;
  border: 2px solid var(--ppsf-primary) !important;
}
.ppsf-btn-back:hover {
  background: rgba(22, 163, 74, .1) !important;
}

/* Result Screens - Exact match to user's uploaded screenshot */
.ppsf-result-wrap {
  text-align: center;
  padding: 4px 10px 10px;
  animation: ppsf-inRight .4s ease both;
}
.ppsf-result-wrap.ppsf-thankyou-screen {
  padding: 8px 6px 12px;
}
.ppsf-result-title {
  font-size: 26px !important;
  margin: 18px 0 12px !important;
  color: #14532d !important;
  font-weight: 800 !important;
  text-align: center !important;
  line-height: 1.3 !important;
}
.ppsf-result-text {
  font-size: 16px;
  line-height: 1.5;
  margin: 0 0 8px !important;
  color: #374151;
  text-align: center !important;
}
.ppsf-note-text {
  margin: 0 0 18px !important;
  text-align: center !important;
  font-size: 16px;
  line-height: 1.5;
  color: #2d3748;
}
.ppsf-divider {
  border: 0;
  border-top: 1px solid rgba(138, 154, 144, 0.45);
  margin: 20px 0;
}
.ppsf-privacy-text {
  margin: 0 !important;
  font-size: 14px;
  line-height: 1.5;
  color: #4b5563;
  text-align: center !important;
}

/* Result Icons / SVG check circle matching user screenshot */
.ppsf-check-circle {
  width: 76px;
  height: 76px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ppsf-check-svg {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  display: block;
}
.ppsf-check-svg circle {
  stroke: var(--ppsf-primary);
  stroke-width: 4;
  fill: #fff;
  stroke-dasharray: 252;
  stroke-dashoffset: 252;
  animation: ppsf-draw .6s ease forwards;
}
.ppsf-check-svg path {
  stroke: var(--ppsf-primary);
  stroke-width: 5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: ppsf-draw .4s .5s ease forwards;
}
.ppsf-check-svg.ppsf-gray circle,
.ppsf-check-svg.ppsf-gray path {
  stroke: #6b7280 !important;
}
@keyframes ppsf-draw {
  to { stroke-dashoffset: 0; }
}

/* Spinner */
.ppsf-spinner {
  width: 34px;
  height: 34px;
  margin: 18px auto 0;
  border: 4px solid rgba(22, 163, 74, .25);
  border-top-color: var(--ppsf-primary);
  border-radius: 50%;
  animation: ppsf-spin .8s linear infinite;
}
@keyframes ppsf-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Mobile Responsive Styles (Optimized for Phones & Tablets)
   ========================================================================== */

@media (max-width: 640px) {
  /* Overlay padding on mobile */
  .ppsf-is-modal .ppsf-modal-overlay {
    padding: 14px 10px;
    align-items: center;
  }

  /* Modal Dialog Box on mobile */
  .ppsf-modal-dialog {
    padding: 48px 18px 22px;
    border-radius: 12px;
    max-height: calc(100dvh - 28px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  }

  /* Close button on mobile */
  .ppsf-close-btn {
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    font-size: 22px;
  }

  /* Modal Title & Subtitle */
  .ppsf-modal-title {
    font-size: 21px !important;
    line-height: 1.3 !important;
    margin: 0 0 5px !important;
    padding: 0 24px; /* Ensure title does not collide with close button */
  }
  .ppsf-modal-sub {
    font-size: 14.5px;
    margin: 0 0 16px !important;
    line-height: 1.4;
  }

  /* Progress Bar & Step Counter */
  .ppsf-progress-bar-wrap {
    height: 6px;
    margin-bottom: 6px;
  }
  .ppsf-step-count {
    font-size: 12.5px;
    margin-bottom: 14px;
  }

  /* Question Title & Hint */
  .ppsf-question-title {
    font-size: 17.5px !important;
    line-height: 1.35 !important;
    margin: 0 0 5px !important;
  }
  .ppsf-question-hint {
    font-size: 13.5px;
    margin: 0 0 14px !important;
    line-height: 1.4;
  }

  /* Options list */
  .ppsf-options-list {
    gap: 8px;
  }
  .ppsf-opt-item {
    font-size: 14.5px;
    padding: 10px 14px;
    min-height: 48px;
    gap: 12px;
    border-radius: 8px;
    line-height: 1.35;
  }
  .ppsf-opt-item:hover {
    transform: none; /* Disable hover float on touch screens */
  }
  .ppsf-mark {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
  }
  .ppsf-mark::after {
    width: 9px;
    height: 5px;
    border-left-width: 2.2px;
    border-bottom-width: 2.2px;
  }

  /* Inputs & Textarea */
  .ppsf-textarea, 
  .ppsf-input-email, 
  .ppsf-input-tel {
    font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
    padding: 10px 12px !important;
    border-radius: 6px !important;
  }
  .ppsf-textarea {
    min-height: 80px;
    margin-top: 10px;
  }
  .ppsf-field-group {
    margin-bottom: 14px;
  }
  .ppsf-label {
    font-size: 14.5px;
    margin-bottom: 4px !important;
  }
  .ppsf-phone-wrap {
    height: 46px;
  }
  .ppsf-phone-country {
    padding: 0 10px;
    gap: 6px;
  }
  .ppsf-phone-flag {
    width: 25px;
    height: 16px;
  }
  .ppsf-phone-wrap input {
    padding-left: 8px !important;
    font-size: 16px !important;
  }
  .ppsf-err-msg {
    font-size: 12.5px;
    margin-top: 3px;
    min-height: 16px;
  }

  /* Navigation Buttons */
  .ppsf-nav-buttons {
    margin-top: 18px;
    gap: 10px;
  }
  .ppsf-btn {
    height: 48px;
    font-size: 15px !important;
    letter-spacing: .3px;
    border-radius: 6px;
  }
  .ppsf-btn-back {
    flex: 0 0 85px;
    padding: 0 10px;
  }
  .ppsf-btn-next {
    padding: 0 14px;
  }

  /* Result / Thank You Screen on mobile */
  .ppsf-result-wrap {
    padding: 6px 4px 10px;
  }
  .ppsf-check-circle {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
  }
  .ppsf-check-svg {
    width: 64px;
    height: 64px;
  }
  .ppsf-result-title {
    font-size: 21px !important;
    margin: 12px 0 10px !important;
    line-height: 1.3 !important;
  }
  .ppsf-note-text {
    font-size: 14.5px;
    line-height: 1.45;
    margin: 0 0 14px !important;
  }
  .ppsf-divider {
    margin: 14px 0;
  }
  .ppsf-privacy-text {
    font-size: 12.5px;
    line-height: 1.4;
  }
}

/* Extra small devices (iPhone SE, Galaxy Fold, screens <= 380px) */
@media (max-width: 380px) {
  .ppsf-modal-dialog {
    padding: 44px 14px 18px;
  }
  .ppsf-modal-title {
    font-size: 19px !important;
    padding: 0 16px;
  }
  .ppsf-modal-sub {
    font-size: 13.5px;
  }
  .ppsf-question-title {
    font-size: 16px !important;
  }
  .ppsf-opt-item {
    font-size: 13.5px;
    padding: 9px 12px;
    min-height: 44px;
    gap: 10px;
  }
  .ppsf-btn {
    height: 45px;
    font-size: 14px !important;
  }
  .ppsf-btn-back {
    flex: 0 0 74px;
    padding: 0 6px;
  }
  .ppsf-result-title {
    font-size: 19px !important;
  }
  .ppsf-note-text {
    font-size: 13.5px;
  }
}

