/* ==========================================================
   Painting-Quote Slide-In Form  (v1.8  – 30 May 2025)
   ========================================================== */

/* ───────────────────────────────────────────────
   Slide-in form container
   ───────────────────────────────────────────── */
#cpqf-form-container{
  position: fixed;
  right: 0;
  top: 55%;
  transform: translateY(-50%) translateX(0);
  width: 50vw;
  max-width: 600px;
  min-width: 450px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  padding: 2rem;
  transition: transform .4s ease, opacity .4s ease;
  z-index: 4000;

  /* NEW – self-scroll when taller than viewport */
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  overscroll-behavior: contain;          /* stops BG scroll on iOS */
  -webkit-overflow-scrolling: touch;     /* momentum scroll */
  padding-top:100px;
}
#cpqf-form-container.hidden{
  transform: translateY(-50%) translateX(105%);
  opacity: 0;
}

/* ───────────────────────────────────────────────
   Close button
   ───────────────────────────────────────────── */
#cpqf-close-btn{
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #555;
  z-index: 1000;
}

/* ───────────────────────────────────────────────
   Form headers
   ───────────────────────────────────────────── */
.pq-form-header{
  margin: 0 0 1rem;
  padding-top: 25px;
  font-size: 1.5rem;
  color: #333;
  text-align: left;
}
.pq-form-header-sub{                 /* helper for “select all that apply” */
  margin: -.75rem 0 1rem;
  font-size: .9rem;
  color: #666;
}

/* ───────────────────────────────────────────────
   Two-column basic info
   ───────────────────────────────────────────── */
.pq-basic-info{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.pq-basic-info input{
  padding: .75rem 1rem;
  font-size: .95rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  transition: border-color .3s ease, box-shadow .3s ease;
}
.pq-basic-info input:focus{
  outline: none;
  border-color: #00bfff;
  box-shadow: 0 0 0 3px rgba(0,191,255,.2);
}

/* ───────────────────────────────────────────────
   Two selects in one row
   ───────────────────────────────────────────── */
.pq-select-row{
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.pq-select-row select{
  width: 100%;
  padding: .75rem 1rem;
  font-size: .95rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  transition: border-color .3s ease, box-shadow .3s ease;
}
.pq-select-row select:focus{
  outline: none;
  border-color: #00bfff;
  box-shadow: 0 0 0 3px rgba(0,191,255,.2);
}

/* ───────────────────────────────────────────────
   Stylish animated checkboxes
   ───────────────────────────────────────────── */
.pq-project-types{
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: .75rem 1rem;
}
.pq-project-types label{
  position: relative;
  display: flex;
  align-items: center;
  gap: .65rem;                      /* NEW – consistent spacing */
  cursor: pointer;
  user-select: none;
  font-size: .9rem;
}
.pq-project-types label input[type="checkbox"]{
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0; width: 0;
}

/* checkbox box */
.pq-project-types label .pq-checkmark{
  position: relative;
  width: 1.15rem;                  /* NEW – fixed size */
  height: 1.15rem;
  min-width: 1.15rem;
  min-height: 1.15rem;
  background: #fff;
  border: 2px solid #142058;
  border-radius: 4px;
  transition: background .3s, transform .2s;
  box-sizing: border-box;          /* keep border inside size */
}
/* tick */
.pq-project-types label .pq-checkmark::after{
  content: '';
  position: absolute;
  display: none;
  left: .35rem;  top: .1rem;
  width: .3rem;  height: .6rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.pq-project-types label input[type="checkbox"]:checked ~ .pq-checkmark{
  background: #142058;
}
.pq-project-types label input[type="checkbox"]:checked ~ .pq-checkmark::after{
  display: block;
}
.pq-project-types label span:last-child{
  margin-left: 0;                  /* handled by gap */
}

/* ───────────────────────────────────────────────
   Photo prompt + upload tighter stack
   ───────────────────────────────────────────── */
.pq-photo-row{
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin-top: 1rem;
}
.pq-photo-label{
  font-size: .9rem;
  margin: 0;
}
.pq-photo-row input[type="file"]{
  font-size: .9rem;
}

/* ───────────────────────────────────────────────
   Details textarea
   ───────────────────────────────────────────── */
#pq-details{
  width: 100%;
  margin-top: 1rem;
  padding: .75rem 1rem;
  font-size: .95rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  transition: border-color .3s ease, box-shadow .3s ease;
  min-height: 3em;
}
#pq-details:focus{
  outline: none;
  border-color: #00bfff;
  box-shadow: 0 0 0 3px rgba(0,191,255,.2);
}

/* ───────────────────────────────────────────────
   Submit button
   ───────────────────────────────────────────── */
#painting-quote-form button[type="submit"]{
  margin-top: 1.5rem;
  background: #505050;
  color: #fff;
  border: none;
  padding: .75rem 1.25rem;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .25s ease,
              box-shadow .25s ease,
              transform .15s ease;
}
#painting-quote-form button[type="submit"]:hover{
  background: #142058;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
}

/* ───────────────────────────────────────────────
   Floating toggle tab
   ───────────────────────────────────────────── */
#cpqf-toggle-btn{
  position: fixed;
  top: 50%;
  right:0;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: top right;
  background: #fff;
  color: #2216c5;
  text-transform: uppercase;
  border: none;
  padding: .75rem 1.25rem;
  cursor: pointer;
  transition: right .3s ease, opacity .3s ease;
  opacity: 0;
  z-index: 1010;
  font-size: .95rem;
  letter-spacing: .5px;
  white-space: nowrap;
}
#cpqf-toggle-btn.show{
  opacity: 1;
}

/* ───────────────────────────────────────────────
   Slim down all form fields (global override)
   ───────────────────────────────────────────── */
#painting-quote-form input,
#painting-quote-form select,
#painting-quote-form textarea{
  padding: .5rem .75rem;
  font-size: .9rem;
  line-height: 1.2;
}

/* ───────────────────────────────────────────────
   Mobile-first adjustments  ≤640 px
   ───────────────────────────────────────────── */
@media (max-width:640px){

  /* smaller headings & inputs for cramped screens */
  .pq-form-header{ font-size: 1.25rem; }
  #painting-quote-form input,
  #painting-quote-form select,
  #painting-quote-form textarea{
    font-size: .85rem;
  }

  /* stack two-column grids into one column */
  .pq-basic-info{   grid-template-columns: 1fr; }
  .pq-select-row,
  .pq-project-types{grid-template-columns: 1fr; }

  /* bring the vertical tab in a bit for thumb-reach */
  #cpqf-toggle-btn{ right: -40px; }
}
/* ───────── Loading dots on submit button ───────── */
#painting-quote-form button.loading{
  position: relative;
  pointer-events: none;          /* stop double-clicks                */
  opacity: .85;                  /* subtle disabled look              */
  padding-right: 3.25rem;        /* make room for the dots            */
}

#painting-quote-form button.loading::after{
  content: '';                   /* single dot we’ll clone with shadow*/
  position: absolute;
  right: 1.2rem;
  top: 50%;  transform: translateY(-50%);
  width: .55rem;  height: .55rem;
  border-radius: 50%;
  background: currentColor;      /* inherits button text colour       */

  /* duplicate dots with box-shadow & animate them */
  box-shadow:
    0   0 0 0 currentColor,      /* dot 2 placeholder */
    0   0 0 0 currentColor;      /* dot 3 placeholder */

  animation: pqsf-dots 1.2s infinite ease-in-out;
}

@keyframes pqsf-dots{
  0%   { box-shadow: 0 0 0 0 currentColor,
                     0 0 0 0 currentColor; }      /* •__ */
  33%  { box-shadow: .8rem 0 0 0 currentColor,
                     0 0 0 0 currentColor; }      /* ••_ */
  66%  { box-shadow: .8rem 0 0 0 currentColor,
                     1.6rem 0 0 0 currentColor; } /* ••• */
  100% { box-shadow: 0 0 0 0 currentColor,
                     0 0 0 0 currentColor; }      /* repeat */
}
