/* ============================================================
   REVIEW.HTML POLISH — "magnet" UX layer
   ------------------------------------------------------------
   Drop-in CSS specific to the Confidential Case Evaluation form.
   Works with the raw-CSS .input-field and .float-label classes
   already in style.css. Adds smooth focus flow, success pulses,
   section reveal, and magnetic micro-interactions.
   ============================================================ */

/* --- Prevent horizontal scroll on tight mobile viewports --- */
@media (max-width: 640px) {
    #paydayForm { overflow-x: hidden; }
}

/* --- Breathing room on mobile --- */
#paydayForm {
    scroll-margin-top: 2rem;
}

/* --- Section numbering stays crisp even on long forms --- */
#paydayForm > div > .flex.items-center.mb-8 {
    position: relative;
}
#paydayForm > div > .flex.items-center.mb-8::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.5rem;
    height: 1px;
    background: linear-gradient(to right, rgba(197, 168, 128, 0.3), transparent);
}

/* --- Field wrapper magnetic hover effect --- */
#paydayForm .relative {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#paydayForm .relative:hover {
    transform: translateY(-1px);
}
#paydayForm .relative:focus-within {
    transform: translateY(-2px);
}

/* --- Magnetic focus glow on the border --- */
#paydayForm .input-field {
    position: relative;
    z-index: 1;
}
#paydayForm .input-field:focus {
    border-bottom-width: 2px;
    box-shadow: 0 4px 20px -8px rgba(197, 168, 128, 0.4);
}

/* --- Success state for valid fields (populated + not focused) --- */
#paydayForm .input-field:valid:not(:placeholder-shown):not(:focus) {
    border-bottom-color: #10b981; /* emerald — success */
}
#paydayForm select.input-field:valid:not(:focus) {
    border-bottom-color: #10b981;
}

/* --- Subtle pulse animation when entering a field --- */
@keyframes review-focus-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(197, 168, 128, 0.3); }
    100% { box-shadow: 0 0 0 12px rgba(197, 168, 128, 0); }
}
#paydayForm .input-field:focus {
    animation: review-focus-pulse 0.6s ease-out;
}

/* --- Lender name optional field — visually softer so it doesn't demand attention --- */
#paydayForm input[name="lenders"] {
    opacity: 0.85;
}
#paydayForm input[name="lenders"]:focus {
    opacity: 1;
}

/* --- Custom radio buttons (Yes/No "Contacted by collectors") --- */
#paydayForm input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 1.5px solid #d1d5db;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    flex-shrink: 0;
}
#paydayForm input[type="radio"]::after {
    content: "";
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    background: #C5A880;
    transform: scale(0);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#paydayForm input[type="radio"]:checked {
    border-color: #C5A880;
    box-shadow: 0 0 0 3px rgba(197, 168, 128, 0.12);
}
#paydayForm input[type="radio"]:checked::after {
    transform: scale(1);
}
#paydayForm input[type="radio"]:hover:not(:checked) {
    border-color: #9ca3af;
}

/* --- Custom consent checkbox (matches radio style) --- */
#paydayForm input[type="checkbox"][name="consent"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.25s ease, background 0.25s ease;
    flex-shrink: 0;
    margin-top: 0.25rem;
}
#paydayForm input[type="checkbox"][name="consent"]:checked {
    background: #C5A880;
    border-color: #C5A880;
}
#paydayForm input[type="checkbox"][name="consent"]:checked::after {
    content: "";
    width: 0.25rem;
    height: 0.5rem;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* --- Submit button magnetic "awake" state --- */
#submitBtn {
    position: relative;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s ease,
                background 0.3s ease,
                filter 0.3s ease;
    filter: saturate(0.8);
}
#submitBtn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    pointer-events: none;
}
#submitBtn[data-fp-ready="true"] {
    filter: saturate(1);
    box-shadow: 0 18px 40px -10px rgba(197, 168, 128, 0.5),
                0 6px 18px -4px rgba(197, 168, 128, 0.3);
    transform: translateY(-2px);
}
#submitBtn[data-fp-ready="true"]::before {
    animation: submit-shimmer 2.5s ease-in-out infinite;
}
@keyframes submit-shimmer {
    0%   { transform: translateX(-100%); }
    60%  { transform: translateX(150%); }
    100% { transform: translateX(150%); }
}
#submitBtn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 22px 48px -12px rgba(197, 168, 128, 0.6);
}

/* --- Form alert slide-in animation --- */
#formAlert {
    animation: alert-slide-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes alert-slide-in {
    0%   { opacity: 0; transform: translateY(-6px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- Section fade-in on scroll (enhances existing .reveal class) --- */
#paydayForm > div {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
#paydayForm > div.in-view,
#paydayForm > div:first-child {
    opacity: 1;
    transform: translateY(0);
}
#paydayForm > div:nth-child(2) { transition-delay: 0.08s; }
#paydayForm > div:nth-child(3) { transition-delay: 0.16s; }

/* --- Reduced motion respect --- */
@media (prefers-reduced-motion: reduce) {
    #paydayForm *,
    #paydayForm *::before,
    #paydayForm *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* --- Mobile spacing tightening --- */
@media (max-width: 767px) {
    #paydayForm .space-y-16 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 3rem;
    }
    #paydayForm .grid {
        row-gap: 2rem;
    }
    #paydayForm .input-field {
        font-size: 16px; /* prevent iOS auto-zoom on focus */
    }
}
