/* ==========================================================================
   Clairify Qualifier - Liquid Glass Popup Styles
   Brand Kit: Ink #4B3A2F, Gold #C7B08A, Accent #A18162, Paper #EAE2CF, Espresso #28190E
   ========================================================================== */

/* ---------- CTA Button ---------- */

.clairify-qualify-btn {
    display: inline-block;
    padding: 16px 36px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    background: #A18162;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
    box-shadow: 0 4px 18px rgba(161, 129, 98, 0.35);
}

.clairify-qualify-btn:hover {
    background: #8a6e53;
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(161, 129, 98, 0.45);
}

.clairify-qualify-btn:active {
    transform: translateY(0);
}

/* ---------- Overlay & Modal ---------- */

.clairify-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(40, 25, 14, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.clairify-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.clairify-modal {
    position: relative;
    width: 92%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: rgba(75, 58, 47, 0.55);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    border: 1px solid rgba(199, 176, 138, 0.25);
    border-radius: 28px;
    padding: 40px 36px 32px;
    box-shadow:
        0 24px 80px rgba(40, 25, 14, 0.30),
        0 8px 32px rgba(40, 25, 14, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 rgba(199, 176, 138, 0.08),
        inset 0 0 20px rgba(161, 129, 98, 0.03);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s ease;
}

.clairify-modal::-webkit-scrollbar {
    display: none;
}

/* Animated liquid shine */
.clairify-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(ellipse 60% 40% at 20% 20%, rgba(199, 176, 138, 0.08), transparent 60%),
        radial-gradient(ellipse 50% 50% at 80% 80%, rgba(234, 226, 207, 0.06), transparent 60%);
    animation: clairifyShine 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* Gradient border rim-light */
.clairify-modal::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.20) 0%,
        rgba(199, 176, 138, 0.20) 40%,
        rgba(161, 129, 98, 0.10) 70%,
        rgba(255, 255, 255, 0.15) 100%
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
}

/* All modal children above pseudo-elements */
.clairify-modal > * {
    position: relative;
    z-index: 2;
}

@keyframes clairifyShine {
    0%, 100% { opacity: 0.6; transform: rotate(0deg) scale(1); }
    50%      { opacity: 1;   transform: rotate(3deg) scale(1.02); }
}

.clairify-overlay.is-open .clairify-modal {
    transform: translateY(0) scale(1);
}

/* ---------- Close button ---------- */

.clairify-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #EAE2CF;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 4px 8px;
    z-index: 3;
}

.clairify-close:hover {
    opacity: 1;
}

/* ---------- Progress dots ---------- */

.clairify-progress {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 32px;
}

.clairify-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(234, 226, 207, 0.2);
    border: 1px solid rgba(234, 226, 207, 0.15);
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.clairify-dot.active {
    background: #C7B08A;
    border-color: #C7B08A;
    transform: scale(1.25);
    box-shadow: 0 0 8px rgba(199, 176, 138, 0.5);
}

.clairify-dot.completed {
    background: #4B3A2F;
    border-color: #4B3A2F;
}

/* ---------- Steps ---------- */

.clairify-step {
    display: none;
    border: none;
    margin: 0;
    padding: 0;
    min-height: 0;
    animation: clairifyFadeIn 0.3s ease;
}

.clairify-step.active {
    display: block;
}

@keyframes clairifyFadeIn {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ---------- Question heading ---------- */

.clairify-question {
    font-size: 20px;
    font-weight: 700;
    color: #EAE2CF;
    margin-bottom: 24px;
    line-height: 1.35;
    padding: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ---------- Radio option cards ---------- */

.clairify-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clairify-option {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: rgba(234, 226, 207, 0.08);
    border: 1px solid rgba(199, 176, 138, 0.20);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    font-size: 15px;
    color: #EAE2CF;
    user-select: none;
}

.clairify-option:hover {
    border-color: rgba(199, 176, 138, 0.5);
    background: rgba(234, 226, 207, 0.13);
}

.clairify-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(199, 176, 138, 0.30);
    border-radius: 50%;
    margin: 0 12px 0 0;
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    position: relative;
    cursor: pointer;
    background: transparent;
}

.clairify-option input[type="radio"]:checked {
    border-color: #C7B08A;
    background: #C7B08A;
    box-shadow: 0 0 6px rgba(199, 176, 138, 0.4);
}

.clairify-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: #4B3A2F;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.clairify-option:has(input:checked) {
    border-color: #C7B08A;
    background: rgba(199, 176, 138, 0.15);
    box-shadow: 0 0 12px rgba(199, 176, 138, 0.15);
}

.clairify-option span {
    line-height: 1.35;
}

/* ---------- Contact info fields ---------- */

.clairify-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.clairify-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #EAE2CF;
    margin-bottom: 6px;
}

.clairify-field label .required {
    color: #C7B08A;
}

.clairify-field label .optional {
    font-weight: 400;
    color: rgba(234, 226, 207, 0.5);
    font-size: 13px;
}

.clairify-field input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: #EAE2CF;
    background: rgba(234, 226, 207, 0.08);
    border: 1px solid rgba(199, 176, 138, 0.20);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
}

.clairify-field input::placeholder {
    color: rgba(234, 226, 207, 0.4);
}

.clairify-field input:focus {
    border-color: #C7B08A;
    box-shadow: 0 0 0 3px rgba(199, 176, 138, 0.2);
    background: rgba(234, 226, 207, 0.10);
}

.clairify-field input.has-error {
    border-color: #e74c3c;
}

.clairify-field textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: #EAE2CF;
    background: rgba(234, 226, 207, 0.08);
    border: 1px solid rgba(199, 176, 138, 0.20);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
    resize: vertical;
    min-height: 80px;
}

.clairify-field textarea::placeholder {
    color: rgba(234, 226, 207, 0.4);
}

.clairify-field textarea:focus {
    border-color: #C7B08A;
    box-shadow: 0 0 0 3px rgba(199, 176, 138, 0.2);
    background: rgba(234, 226, 207, 0.10);
}

/* ---------- Navigation buttons ---------- */

.clairify-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    gap: 12px;
}

.clairify-back {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #EAE2CF;
    background: transparent;
    border: 1px solid rgba(199, 176, 138, 0.25);
    border-radius: 50px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s ease;
}

.clairify-back:hover {
    border-color: rgba(199, 176, 138, 0.5);
    background: rgba(199, 176, 138, 0.08);
    transform: translateY(-1px);
}

.clairify-next {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #EAE2CF;
    background: rgba(199, 176, 138, 0.14);
    border: 1px solid rgba(199, 176, 138, 0.25);
    border-radius: 50px;
    cursor: pointer;
    margin-left: auto;
    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.clairify-next:hover {
    background: rgba(199, 176, 138, 0.25);
    border-color: rgba(199, 176, 138, 0.45);
    transform: translateY(-1px);
}

.clairify-submit {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #EAE2CF;
    background: rgba(161, 129, 98, 0.25);
    border: 1px solid rgba(161, 129, 98, 0.4);
    border-radius: 50px;
    cursor: pointer;
    margin-left: auto;
    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.clairify-submit:hover {
    background: rgba(161, 129, 98, 0.35);
    border-color: rgba(161, 129, 98, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(161, 129, 98, 0.2);
}

.clairify-next:disabled,
.clairify-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ---------- Error message ---------- */

.clairify-error {
    margin-top: 14px;
    padding: 10px 14px;
    font-size: 14px;
    color: #ff9b8e;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.25);
    border-radius: 8px;
    text-align: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ---------- Success screen ---------- */

.clairify-success {
    text-align: center;
    padding: 20px 0;
    animation: clairifyFadeIn 0.4s ease;
}

.clairify-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: rgba(199, 176, 138, 0.20);
    border: 1px solid rgba(199, 176, 138, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #C7B08A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
}

.clairify-success h3 {
    font-size: 22px;
    color: #EAE2CF;
    margin: 0 0 8px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.clairify-success p {
    font-size: 15px;
    color: rgba(234, 226, 207, 0.7);
    margin: 0 0 24px;
}

.clairify-close-success {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #EAE2CF;
    background: rgba(199, 176, 138, 0.12);
    border: 1px solid rgba(199, 176, 138, 0.25);
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.clairify-close-success:hover {
    background: rgba(199, 176, 138, 0.20);
    border-color: rgba(199, 176, 138, 0.4);
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
    .clairify-modal {
        width: 96%;
        padding: 28px 20px 24px;
        border-radius: 20px;
        max-height: 94vh;
    }

    .clairify-question {
        font-size: 18px;
        margin-bottom: 18px;
    }

    .clairify-option {
        padding: 12px 14px;
        font-size: 14px;
    }

    .clairify-qualify-btn {
        padding: 14px 28px;
        font-size: 15px;
    }
}

/* ---------- Accessibility fallbacks ---------- */

@supports not (backdrop-filter: blur(1px)) {
    .clairify-overlay {
        background: rgba(40, 25, 14, 0.92);
    }

    .clairify-modal {
        background: rgba(75, 58, 47, 0.95);
    }

    .clairify-modal::before {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .clairify-modal::before {
        animation: none;
    }

    .clairify-modal,
    .clairify-overlay,
    .clairify-dot,
    .clairify-option,
    .clairify-field input,
    .clairify-back,
    .clairify-next,
    .clairify-submit {
        transition-duration: 0.01ms;
    }

    .clairify-step {
        animation: none;
    }
}

@media (prefers-reduced-transparency) {
    .clairify-modal {
        background: rgba(75, 58, 47, 0.95);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .clairify-option {
        background: rgba(75, 58, 47, 0.7);
    }

    .clairify-field input {
        background: rgba(75, 58, 47, 0.7);
    }
}
