/**
 * MUST - Public Styles
 * Version: 0.1.0
 */

/* ========================================
   Registration Form Container
   ======================================== */

.must-registration-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.must-registration-form-container h2 {
    margin: 0 0 10px 0;
    color: #1d2327;
    font-size: 28px;
}

.must-intro {
    margin: 0 0 30px 0;
    color: #50575e;
    font-size: 16px;
    line-height: 1.5;
}

/* ========================================
   Notice Messages
   ======================================== */

.must-notice {
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* A returning client re-opening a pending registration sees its state up
   front, not just a silently pre-filled form -- badge + one line on what
   that state means. Colors match program-my-registration.php's .mr-status
   badges so "pending" reads the same wherever a client sees it. */
.must-status-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.must-status-banner p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.must-status-badge {
    display: inline-block;
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .85rem;
    font-weight: 700;
}

.must-status-pending {
    background: #fdebd0;
}

.must-status-pending .must-status-badge {
    background: #f0b429;
    color: #7a4f04;
}

.must-status-pending p {
    color: #7a4f04;
}

.must-notice h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
}

.must-notice p {
    margin: 0;
    line-height: 1.6;
}

.must-notice-closed {
    background: #fcf0cd;
    border-left: 4px solid #dba617;
    color: #5a4a1f;
}

.must-notice-success {
    background: #d7f0db;
    border-left: 4px solid #2e7d32;
    color: #1e4620;
}

.must-notice-error {
    background: #f0d7d7;
    border-left: 4px solid #c62828;
    color: #8a1f1f;
}

/* ========================================
   Form Sections
   ======================================== */

/* Each logical group of the form (Your Information, Alternate Adult,
   Children, Affirmation) is its own visually contained box -- a
   contrasting background/border rather than the old bottom-line divider,
   so unrelated groups read as separate at a glance. All sections share the
   same box color; what separates them is that each is its own box, not
   that they're color-coded against each other. Colored slightly lighter
   than .must-child-entry's #f6f7f7 grey so a per-child card nested inside
   the Children Information box still reads as its own, smaller box rather
   than blending into the section background. */
.must-form-section {
    margin-bottom: 20px;
    padding: 20px;
    background: #eef4fb;
    border: 1px solid #c9dcee;
    border-radius: 6px;
}

.must-form-section h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #1d2327;
    font-weight: 600;
}

.must-form-section > p {
    margin: 0 0 15px 0;
    color: #50575e;
    font-size: 14px;
}

/* Section heading + an action button sharing one line (e.g. "Your
   Information" + "Update Profile") -- button pinned right, heading keeps
   its own margin removed so the row doesn't end up taller than either
   element needs. */
.must-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.must-section-head h3 {
    margin: 0;
}

/* ========================================
   Form Fields
   ======================================== */

.must-form-field {
    margin-bottom: 20px;
}

.must-form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #1d2327;
    font-size: 14px;
}

.must-form-field input[type="text"],
.must-form-field input[type="email"],
.must-form-field input[type="tel"],
.must-form-field input[type="number"],
.must-form-field input[type="date"],
.must-form-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.must-form-field input:focus,
.must-form-field select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.must-form-field input::placeholder {
    color: #8c8f94;
}

/* Known facts from the account, not editable fields -- deliberately NOT
   styled like inputs (no border, no background, no padding box) so this
   reads as plain output text -- what's already on file -- not a form
   waiting to be filled in. */
.must-readonly-summary {
    margin-bottom: 12px;
    text-align: left;
}

.must-readonly-summary p {
    margin: 0;
    padding: 0;
    font-size: 14px;
    color: #1d2327;
    line-height: 1.3;
}

/* Name + street + city/state/zip, mailing-envelope style: one paragraph,
   <br>-separated -- no per-line <p> margins to fight with, so this can't
   end up "double spaced" regardless of what other margin rules exist
   elsewhere on the page. */
.must-mailing-block {
    line-height: 1.3;
}

/* The blank-line gap between the mailing block and Email/Phone below. */
.must-readonly-contact {
    margin-top: 12px !important;
}

.required {
    color: #c62828;
    font-weight: bold;
}

.must-field-description {
    margin: 6px 0 0 0;
    color: #50575e;
    font-size: 13px;
    line-height: 1.5;
    font-style: italic;
}

.must-contact-indicator {
    color: #2271b1;
    font-weight: normal;
    font-size: 13px;
    font-style: italic;
}

/* Form rows (side-by-side fields) */
.must-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* Rows built from narrow fields (children / alternate-adult: first, last,
   date of birth, relationship) shouldn't stretch every field into
   an equal-width grid column -- that's what gave Date of Birth a full
   grid-cell's worth of width it didn't need, and made the row visibly read
   as "a grid" rather than plain running text. Flex + wrap instead: each
   field sizes to its own content, all five sit on one line when there's
   room, and they wrap (in whatever grouping fits) on a narrow screen --
   no explicit column positions at all. */
.must-form-row:has(.must-child-narrow) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* The Date of Birth field in these rows has no .must-child-narrow class
   (it needs more room than 12ch for "mm/dd/yyyy" plus the calendar-icon
   button), but it still inherits width:100% from the base
   .must-form-field input[type="date"] rule below. Inside a flex item with
   no width of its own, a 100%-wide child has nothing real to resolve
   against, so the browser falls back to growing the item to fill the row
   -- which is what was pushing into/overlapping the Gender field next to
   it. Give it a real, fixed width instead so it behaves like every other
   field in the row: sized to itself, not to its container. */
.must-form-row:has(.must-child-narrow) input[type="date"] {
    width: auto;
    max-width: 160px;
}

/* ========================================
   Children Entries
   ======================================== */

.must-child-entry {
    background: #f6f7f7;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
}

/* No more "Child N" label -- just the Remove button, kept top-right. */
.must-child-entry-head {
    margin: 0 0 15px 0;
    display: flex;
    justify-content: flex-end;
}

.must-remove-child {
    background: #c62828;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.must-remove-child:hover {
    background: #a02020;
}

/* First/Last name, Gender, Relationship: don't need the full grid-cell
   width (which is 100% of a narrow phone screen once .must-form-row
   collapses to one column below) -- ~12 characters is enough to show, and
   the field still accepts/scrolls longer input, this is a visual width cap
   only, not a maxlength. */
.must-child-narrow {
    width: auto !important;
    max-width: 12ch;
}

/* Checkbox groups */
.must-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.must-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    font-size: 14px;
    cursor: pointer;
}

.must-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Checkbox with input field (for "Other" options) */
.must-checkbox-with-input {
    display: flex;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px !important;
}

.must-other-id-input {
    width: 100%;
    max-width: 300px;
    padding: 8px 10px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 13px;
    margin-left: 24px;
    transition: border-color 0.2s;
}

.must-other-id-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.must-other-id-input.error {
    border-color: #c62828;
}

/* ========================================
   Signature Section
   ======================================== */

.must-signature-preview {
    background: #f6f7f7;
    border-left: 4px solid #2271b1;
    padding: 15px 20px;
    margin-top: 20px;
    border-radius: 4px;
}

.must-signature-preview p {
    margin: 5px 0;
    color: #1d2327;
}

.must-signature-display {
    font-family: 'Brush Script MT', cursive, sans-serif;
    font-size: 24px;
    color: #2271b1;
    font-style: italic;
    margin: 10px 0 !important;
}

.must-signature-timestamp {
    font-size: 13px;
    color: #50575e;
    font-style: italic;
}

/* ========================================
   Buttons
   ======================================== */

.must-button-primary,
.must-button-secondary {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.must-button-primary {
    background: #2271b1;
    color: #fff;
}

.must-button-primary:hover {
    background: #135e96;
}

.must-button-primary:disabled {
    background: #c3c4c7;
    cursor: not-allowed;
}

.must-button-secondary {
    background: #fff;
    color: #2271b1;
    border: 1px solid #2271b1;
}

.must-button-secondary:hover {
    background: #f0f6fc;
}

#must-add-child {
    margin-top: 10px;
}

/* ========================================
   Form Messages
   ======================================== */

#must-form-messages {
    margin-top: 20px;
}

#must-form-messages .must-notice {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Loading State
   ======================================== */

.must-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.must-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .must-registration-form-container {
        padding: 15px;
    }

    .must-registration-form-container h2 {
        font-size: 24px;
    }

    .must-form-row {
        grid-template-columns: 1fr;
    }

    .must-checkbox-group {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .must-button-primary,
    .must-button-secondary {
        width: 100%;
    }
}

/* ========================================
   Accessibility
   ======================================== */

/* Focus visible styles for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
