/* ============================================================
   Primrose Grant Application — Form Styles
   ============================================================ */

:root {
    --pga-accent:       #6a8f3b;
    --pga-accent-light: #558d33;
    --pga-green:        #65bc7b;
    --pga-red:          #dc3545;
    --pga-border:       #d2d2d2;
    --pga-bg:           #ffffff;
    --pga-bg-alt:       #f6f6f6;
    --pga-text:         #333333;
    --pga-text-muted:   #747474;
    --pga-radius:       4px;
    --pga-shadow:       0 2px 12px rgba(0, 0, 0, 0.08);
    --pga-transition:   0.2s ease;
}

/* ── Wrapper ────────────────────────────────────────────── */
.pga-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 16px 60px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--pga-text);
    font-size: 15px;
    line-height: 1.5;
    box-sizing: border-box;
}

.pga-wrap *,
.pga-wrap *::before,
.pga-wrap *::after {
    box-sizing: inherit;
}

/* ── Progress Bar ───────────────────────────────────────── */
.pga-progress {
    display: flex;
    align-items: stretch;
    margin: 32px 0 36px;
    border-radius: var(--pga-radius);
    overflow: hidden;
    border: 1px solid var(--pga-border);
    background: var(--pga-bg-alt);
}

.pga-progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    text-align: center;
    border-right: 1px solid var(--pga-border);
    transition: background var(--pga-transition);
    position: relative;
}

.pga-progress-step:last-child {
    border-right: none;
}

.pga-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--pga-border);
    color: var(--pga-text-muted);
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    transition: background var(--pga-transition), color var(--pga-transition);
}

.pga-step-label {
    font-size: 12px;
    color: var(--pga-text-muted);
    font-weight: 500;
    transition: color var(--pga-transition);
}

.pga-progress-step.active {
    background: var(--pga-accent);
}

.pga-progress-step.active .pga-step-num {
    background: #fff;
    color: var(--pga-accent);
}

.pga-progress-step.active .pga-step-label {
    color: #fff;
    font-weight: 700;
}

.pga-progress-step.completed {
    background: #e8f0fb;
}

.pga-progress-step.completed .pga-step-num {
    background: var(--pga-green);
    color: #fff;
}

.pga-progress-step.completed .pga-step-label {
    color: var(--pga-accent);
}

.pga-progress-step.completed .pga-step-num::before {
    content: "✓";
}

/* ── Alert ──────────────────────────────────────────────── */
.pga-alert {
    padding: 12px 16px;
    border-radius: var(--pga-radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.pga-alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.pga-alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.pga-alert-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* ── Step Panel ─────────────────────────────────────────── */
.pga-step-panel {
    background: var(--pga-bg);
    border: 1px solid var(--pga-border);
    border-radius: var(--pga-radius);
    padding: 28px 32px;
    box-shadow: var(--pga-shadow);
}

.pga-step-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--pga-accent);
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--pga-accent);
}

.pga-subsection-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--pga-accent);
    margin: 24px 0 12px;
}

/* ── Fields ─────────────────────────────────────────────── */
.pga-field {
    margin-bottom: 18px;
}

.pga-field label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    color: var(--pga-text);
}

.pga-required {
    color: var(--pga-red);
    margin-left: 2px;
}

.pga-hint {
    font-weight: 400;
    color: var(--pga-text-muted);
    font-size: 13px;
    margin-left: 4px;
}

.pga-field input[type="text"],
.pga-field input[type="email"],
.pga-field input[type="tel"],
.pga-field input[type="number"],
.pga-field input[type="date"],
.pga-field input[type="file"],
.pga-field textarea,
.pga-field select {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--pga-border);
    border-radius: var(--pga-radius);
    font-size: 15px;
    color: var(--pga-text);
    background: var(--pga-bg);
    transition: border-color var(--pga-transition), box-shadow var(--pga-transition);
    appearance: none;
}

.pga-field input[type="file"] {
    padding: 7px 12px;
    cursor: pointer;
}

.pga-field textarea {
    resize: vertical;
    min-height: 110px;
}

.pga-field input:focus,
.pga-field textarea:focus,
.pga-field select:focus {
    outline: none;
    border-color: var(--pga-accent-light);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.pga-field.has-error input,
.pga-field.has-error textarea {
    border-color: var(--pga-red);
}

.pga-field-error {
    display: block;
    color: var(--pga-red);
    font-size: 13px;
    margin-top: 4px;
    min-height: 18px;
}

.pga-current-file {
    font-size: 13px;
    color: var(--pga-text-muted);
    margin: 6px 0 0;
}

/* ── Field Layout ───────────────────────────────────────── */
.pga-field-row {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}

.pga-field-row .pga-field {
    margin-bottom: 0;
}

.pga-col-half {
    flex: 1;
    min-width: 0;
}

.pga-col-quarter {
    flex: 1;
    min-width: 0;
}

/* ── Fieldset ───────────────────────────────────────────── */
.pga-fieldset {
    border: 1px solid var(--pga-border);
    border-radius: var(--pga-radius);
    padding: 20px 20px 4px;
    margin-bottom: 18px;
}

fieldset.pga-fieldset legend,
.pga-fieldset legend {
    font-weight: 700;
    color: var(--pga-accent);
    padding: 0 8px;
    font-size: 14px;
}

/* ── Radio Group ────────────────────────────────────────── */
.pga-radio-group {
    display: flex;
    gap: 24px;
    margin-top: 6px;
}

.pga-radio-label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-weight: 400;
}

.pga-radio-label input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: var(--pga-accent);
    cursor: pointer;
}

/* ── Checkbox ───────────────────────────────────────────── */
.pga-confirmation-field {
    background: var(--pga-bg-alt);
    border: 1px solid var(--pga-border);
    border-radius: var(--pga-radius);
    padding: 16px;
    margin-top: 24px;
}

.pga-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
}

.pga-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--pga-accent);
    cursor: pointer;
}

/* ── Finance Table (Step 2) ─────────────────────────────── */
.pga-finance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 8px;
}

.pga-finance-table th,
.pga-finance-table td {
    padding: 8px 10px;
    border: 1px solid var(--pga-border);
    vertical-align: middle;
}

.pga-finance-table thead th {
    background: var(--pga-accent);
    color: #fff;
    font-weight: 600;
    text-align: center;
}

.pga-finance-table tbody tr:nth-child(even) {
    background: var(--pga-bg-alt);
}

.pga-finance-table tbody td:first-child {
    font-weight: 600;
}

.pga-finance-table input[type="text"] {
    width: 100%;
    border: 1px solid var(--pga-border);
    border-radius: var(--pga-radius);
    padding: 5px 8px;
    font-size: 13px;
}

.pga-finance-table input[type="text"]:focus {
    outline: none;
    border-color: var(--pga-accent-light);
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

/* ── Financial History Table (Step 4) ───────────────────── */
.pga-table-scroll {
    overflow-x: auto;
    margin-bottom: 16px;
}

.pga-financial-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 560px;
}

.pga-financial-table th,
.pga-financial-table td {
    padding: 8px 10px;
    border: 1px solid var(--pga-border);
    vertical-align: middle;
}

.pga-financial-table thead th {
    background: var(--pga-accent);
    color: #fff;
    font-weight: 600;
    text-align: center;
}

.pga-financial-table thead th:first-child {
    text-align: left;
}

.pga-financial-table tbody tr:nth-child(even) {
    background: var(--pga-bg-alt);
}

.pga-financial-table tbody td:first-child {
    font-weight: 600;
}

.pga-financial-table input[type="text"] {
    width: 100%;
    border: 1px solid var(--pga-border);
    border-radius: var(--pga-radius);
    padding: 5px 8px;
    font-size: 13px;
    text-align: center;
}

.pga-financial-table input[type="text"]:focus {
    outline: none;
    border-color: var(--pga-accent-light);
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

/* ── reCAPTCHA Note ─────────────────────────────────────── */
.pga-recaptcha-note {
    font-size: 12px;
    color: var(--pga-text-muted);
    margin-top: 16px;
}

.pga-recaptcha-note a {
    color: var(--pga-accent);
}

/* ── Navigation ─────────────────────────────────────────── */
.pga-form-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--pga-border);
    gap: 12px;
    flex-wrap: wrap;
}

.pga-nav-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

/* ── Buttons ────────────────────────────────────────────── */
.pga-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: var(--pga-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    transition: background var(--pga-transition), color var(--pga-transition), border-color var(--pga-transition);
    white-space: nowrap;
}

.pga-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.pga-btn-primary {
    background: var(--pga-accent);
    color: #fff;
    border-color: var(--pga-accent);
}

.pga-btn-primary:hover:not(:disabled) {
    background: var(--pga-accent-light);
    border-color: var(--pga-accent-light);
    color: #fff;
}

.pga-btn-secondary {
    background: #fff;
    color: var(--pga-accent);
    border-color: var(--pga-border);
}

.pga-btn-secondary:hover:not(:disabled) {
    background: var(--pga-bg-alt);
    border-color: var(--pga-accent);
}

.pga-btn-outline {
    background: transparent;
    color: var(--pga-text-muted);
    border-color: var(--pga-border);
    font-weight: 500;
}

.pga-btn-outline:hover:not(:disabled) {
    background: var(--pga-bg-alt);
    border-color: var(--pga-text-muted);
    color: var(--pga-text);
}

/* ── Success Message ────────────────────────────────────── */
.pga-success-box {
    text-align: center;
    padding: 48px 32px;
    background: var(--pga-bg);
    border: 1px solid #c3e6cb;
    border-radius: var(--pga-radius);
    box-shadow: var(--pga-shadow);
}

.pga-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--pga-green);
    color: #fff;
    border-radius: 50%;
    font-size: 32px;
    margin-bottom: 20px;
}

.pga-success-box h2 {
    color: var(--pga-accent);
    font-size: 24px;
    margin-bottom: 12px;
}

.pga-success-box p {
    color: var(--pga-text-muted);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Modal Overlay ──────────────────────────────────────── */
.pga-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pga-modal {
    background: var(--pga-bg);
    border-radius: 6px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
}

.pga-modal h3 {
    font-size: 20px;
    color: var(--pga-accent);
    margin: 0 0 10px;
}

.pga-modal p {
    color: var(--pga-text-muted);
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
}

.pga-modal .pga-field input[type="email"] {
    border: 1px solid var(--pga-border);
}

.pga-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
    .pga-step-panel {
        padding: 20px 16px;
    }

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

    .pga-field-row .pga-field {
        margin-bottom: 18px;
    }

    .pga-col-quarter {
        width: 100%;
    }

    .pga-finance-table {
        font-size: 12px;
    }

    .pga-form-nav {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .pga-nav-right {
        flex-direction: column;
        margin-left: 0;
    }

    .pga-btn {
        width: 100%;
    }

    .pga-progress-step {
        padding: 10px 4px;
    }

    .pga-step-label {
        font-size: 10px;
    }
}
