/* ─── Public Form Styles ─── */
.public-form-body {
    background: var(--surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.public-form-body footer {
    background: var(--green-950);
    padding: 0; /* Minimal footer for form */
}

.form-header {
    background: var(--white);
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.form-main {
    flex: 1;
    padding: 2rem 24px 4rem;
}

.form-container {
    max-width: 640px;
    margin: 0 auto;
}

.form-header-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    border-top: 10px solid var(--green-600);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    animation: fadeInUp 0.6s var(--ease) both;
}

.form-header-card h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-900);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.form-header-card p {
    color: var(--text-600);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.required-note {
    font-size: 0.85rem;
    color: #d32f2f;
    font-weight: 500;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

/* Question Cards */
.pub-question-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    animation: fadeInUp 0.6s var(--ease) both;
    transition: var(--transition);
}

.pub-question-card:focus-within {
    border-color: var(--green-400);
    box-shadow: var(--shadow);
}

.pub-question-card.has-error {
    border-color: #d32f2f;
}

.q-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-900);
    margin-bottom: 0.25rem;
    display: block;
}

.q-label.required::after {
    content: ' *';
    color: #d32f2f;
}

.q-desc {
    font-size: 0.88rem;
    color: var(--text-400);
    margin-bottom: 1.25rem;
}

.q-error {
    color: #d32f2f;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Form Inputs */
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-md);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-900);
    transition: var(--transition);
    background: var(--white);
}

.form-input:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(52, 167, 110, 0.15);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* Radios and Checkboxes */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label, .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--green-600);
    margin-top: 2px;
    cursor: pointer;
}

.radio-text, .checkbox-text {
    font-size: 1rem;
    color: var(--text-900);
}

.form-footer {
    padding: 1rem 0;
}

.form-terms {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-400);
    margin-top: 1rem;
}

/* States */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-md);
    border-radius: 50%;
    border-top-color: var(--green-600);
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.form-error-state, .form-success-state {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 2.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    animation: fadeInUp 0.6s var(--ease);
}

.success-icon {
    width: 64px;
    height: 64px;
    background: var(--green-100);
    color: var(--green-700);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
}

.form-success-state h2 {
    color: var(--green-900);
    margin-bottom: 0.5rem;
}

.w-100 {
    width: 100%;
}

/* The shared .btn-secondary is white-on-transparent for dark hero sections; on the
   light form page that makes every secondary button (the "← Back" nav button, the
   "Submit another response" button on the success screen, and the agreement modal's
   Cancel button) white-on-white and effectively invisible. Re-skin all of them here.
   Buttons that carry their own inline colour (e.g. the location "Detect" button) keep
   it, since inline styles outrank this rule. */
.public-form-body .btn-secondary {
    background: #fff;
    color: var(--green-700);
    border: 2px solid var(--border-md, #cbd5e1);
    cursor: pointer;
}
.public-form-body .btn-secondary:hover {
    background: var(--green-50, #f0fdf4);
    border-color: var(--green-600, #16a34a);
    transform: translateY(-2px);
}

/* The loading spinner lives on the public form, which loads styles.css + form.css but
   NOT admin.css (where @keyframes spin was originally defined) — so define it here too
   or the spinner never rotates. */
@keyframes spin {
    to { transform: rotate(360deg); }
}
