/**
 * BPHA Qualification Questionnaire Styles
 *
 * Designed to blend with the CalMSP theme (Albert Sans, Tailwind-based).
 * Uses the site's color variables where possible.
 */

/* ── Variables ── */
:root {
    --bpha-blue: #1b2553;
    --bpha-blue-dark: #141542;
    --bpha-blue-darker: #140e39;
    --bpha-teal: #45d5d0;
    --bpha-teal-light: #7fe6e2;
    --bpha-teal-border: #47d6d1;
    --bpha-text: #2c3e50;
    --bpha-text-light: #7f8c8d;
    --bpha-border: #dce1e6;
    --bpha-bg: #f8f9fa;
    --bpha-card-bg: #ffffff;
    --bpha-success-bg: #eafaf1;
    --bpha-success-border: #27ae60;
    --bpha-maybe-bg: #fdf2e9;
    --bpha-maybe-border: #e67e22;
    --bpha-unsure-bg: #fef9e7;
    --bpha-unsure-border: #f1c40f;
}

/* ── Trigger Button ── */
.bpha-trigger-wrap {
    margin: 0;
}

.bpha-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 1.05rem;
    font-weight: 900;
    font-family: "Albert Sans", sans-serif;
    transition: all 0.2s ease;
    outline: none;
    cursor: pointer;
    border: 1px solid var(--bpha-teal-border);
    background: linear-gradient(to right, var(--bpha-teal), var(--bpha-teal-light));
    color: var(--bpha-blue-dark);
    height: 2.75rem;
    padding: 0.5rem 1.5rem;
}

@media (min-width: 1024px) {
    .bpha-trigger-btn {
        font-size: 1.25rem;
        padding: 0.5rem 2rem;
        height: auto;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

.bpha-trigger-btn:hover {
    opacity: 0.9;
}

.bpha-trigger-btn:active {
    transform: scale(0.97);
}

.bpha-trigger-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(69, 213, 208, 0.5);
}

/* ── Questionnaire Container ── */
.bpha-questionnaire {
    max-width: 660px;
    width: 100%;
    background: var(--bpha-card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-top: 24px;
}

/* ── Progress Bar ── */
.bpha-progress-wrapper {
    background: #eaecee;
    height: 6px;
    width: 100%;
}

.bpha-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--bpha-blue), var(--bpha-teal));
    transition: width 0.4s ease;
    border-radius: 0 3px 3px 0;
}

.bpha-step-indicator {
    text-align: center;
    padding: 18px 32px 0;
    font-size: 13px;
    color: var(--bpha-text-light);
    font-weight: 500;
    letter-spacing: 0.5px;
    font-family: "Albert Sans", sans-serif;
}

/* ── Step Content ── */
.bpha-step {
    display: none;
    padding: 24px 32px 32px;
    animation: bpha-fadeIn 0.35s ease;
}

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

@keyframes bpha-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bpha-step-title {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 6px;
    color: var(--bpha-blue-darker);
    font-family: "Albert Sans", sans-serif;
    line-height: 1.3;
}

.bpha-step-subtitle {
    font-size: 14px;
    color: var(--bpha-text-light);
    margin-bottom: 24px;
    font-weight: 300;
    font-family: "Albert Sans", sans-serif;
    line-height: 1.6;
}

/* ── Form Elements ── */
.bpha-field-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--bpha-text);
    font-family: "Albert Sans", sans-serif;
}

.bpha-questionnaire input[type="text"],
.bpha-questionnaire input[type="email"],
.bpha-questionnaire input[type="tel"],
.bpha-questionnaire input[type="number"],
.bpha-questionnaire select,
.bpha-questionnaire textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--bpha-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: "Albert Sans", sans-serif;
    color: var(--bpha-text);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 18px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    font-weight: 300;
}

.bpha-questionnaire select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237f8c8d' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.bpha-questionnaire input:focus,
.bpha-questionnaire select:focus,
.bpha-questionnaire textarea:focus {
    outline: none;
    border-color: var(--bpha-teal);
    box-shadow: 0 0 0 3px rgba(69, 213, 208, 0.15);
}

.bpha-questionnaire textarea {
    resize: vertical;
    min-height: 70px;
}

.bpha-field-row {
    display: flex;
    gap: 16px;
}

.bpha-field-row > div {
    flex: 1;
}

/* ── Radio / Card Options ── */
.bpha-option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.bpha-option-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--bpha-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    box-sizing: border-box;
}

.bpha-option-card:hover {
    border-color: var(--bpha-teal);
    background: #f0fafa;
}

.bpha-option-card.selected {
    border-color: var(--bpha-blue);
    background: #eef3fb;
}

.bpha-option-card input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--bpha-blue);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.bpha-option-text {
    font-size: 15px;
    font-weight: 500;
    font-family: "Albert Sans", sans-serif;
    color: var(--bpha-text);
}

.bpha-option-desc {
    font-size: 13px;
    color: var(--bpha-text-light);
    margin-top: 2px;
    font-weight: 300;
    font-family: "Albert Sans", sans-serif;
}

/* ── Conditional Sub-Questions ── */
.bpha-conditional {
    display: none;
    background: #f7f9fb;
    border-left: 3px solid var(--bpha-teal);
    padding: 16px 18px;
    margin: -8px 0 18px 28px;
    border-radius: 0 8px 8px 0;
    animation: bpha-fadeIn 0.3s ease;
}

.bpha-conditional.visible {
    display: block;
}

.bpha-conditional .bpha-field-label {
    font-size: 13px;
    margin-bottom: 8px;
}

.bpha-inline-options {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.bpha-inline-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-family: "Albert Sans", sans-serif;
    font-weight: 400;
    cursor: pointer;
    padding: 8px 16px;
    border: 1.5px solid var(--bpha-border);
    border-radius: 8px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.bpha-inline-options label:hover {
    border-color: var(--bpha-teal);
}

.bpha-inline-options label.selected {
    border-color: var(--bpha-blue);
    background: #eef3fb;
}

.bpha-inline-options label.selected span {
    color: var(--bpha-blue);
    font-weight: 600;
}

.bpha-inline-options input[type="radio"] {
    accent-color: var(--bpha-blue);
}

/* ── Buttons ── */
.bpha-btn-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.bpha-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: "Albert Sans", sans-serif;
    box-sizing: border-box;
}

.bpha-btn-primary {
    border: 1px solid var(--bpha-teal-border);
    background: linear-gradient(to right, var(--bpha-teal), var(--bpha-teal-light));
    color: var(--bpha-blue-dark);
    font-weight: 900;
}

.bpha-btn-primary:hover {
    opacity: 0.9;
}

.bpha-btn-primary:active {
    transform: scale(0.97);
}

.bpha-btn-primary:disabled {
    background: #bdc3c7;
    border-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

.bpha-btn-back {
    background: transparent;
    color: var(--bpha-text-light);
    padding: 12px 16px;
}

.bpha-btn-back:hover {
    color: var(--bpha-text);
}

/* ── Loading spinner ── */
.bpha-btn-primary.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.bpha-btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2.5px solid var(--bpha-blue-dark);
    border-top-color: transparent;
    border-radius: 50%;
    animation: bpha-spin 0.6s linear infinite;
}

@keyframes bpha-spin {
    to { transform: rotate(360deg); }
}

/* ── Results Page ── */
.bpha-result-box {
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.bpha-result-box.qualified {
    background: var(--bpha-success-bg);
    border-color: var(--bpha-success-border);
}

.bpha-result-box.maybe {
    background: var(--bpha-maybe-bg);
    border-color: var(--bpha-maybe-border);
}

.bpha-result-box.unsure {
    background: var(--bpha-unsure-bg);
    border-color: var(--bpha-unsure-border);
}

.bpha-result-box h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    font-family: "Albert Sans", sans-serif;
    color: var(--bpha-text);
}

.bpha-result-box p {
    font-size: 14px;
    color: var(--bpha-text);
    font-weight: 300;
    line-height: 1.6;
    font-family: "Albert Sans", sans-serif;
    margin: 0;
}

.bpha-summary-table {
    width: 100%;
    font-size: 14px;
    margin: 16px 0;
    border-collapse: collapse;
    font-family: "Albert Sans", sans-serif;
}

.bpha-summary-table td {
    padding: 8px 0;
    border-bottom: 1px solid var(--bpha-border);
    vertical-align: top;
}

.bpha-summary-table td:first-child {
    color: var(--bpha-text-light);
    width: 40%;
    padding-right: 12px;
    font-weight: 300;
}

.bpha-summary-table td:last-child {
    font-weight: 500;
    color: var(--bpha-text);
}

.bpha-followup-note {
    font-size: 14px;
    color: var(--bpha-text-light);
    margin-top: 16px;
    line-height: 1.6;
    font-weight: 300;
    font-family: "Albert Sans", sans-serif;
}

.bpha-followup-note a {
    color: var(--bpha-teal);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.bpha-followup-note a:hover {
    text-decoration: none;
}

/* ── Error message ── */
.bpha-error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #991b1b;
    font-family: "Albert Sans", sans-serif;
}

/* ── Responsive ── */
@media (max-width: 520px) {
    .bpha-step {
        padding: 20px 20px 28px;
    }

    .bpha-step-title {
        font-size: 19px;
    }

    .bpha-field-row {
        flex-direction: column;
        gap: 0;
    }

    .bpha-inline-options {
        flex-direction: column;
        gap: 8px;
    }

    .bpha-conditional {
        margin-left: 12px;
    }

    .bpha-trigger-btn {
        width: 100%;
    }
}
