/* Added theme variables and harmonized colors */
:root {
    --bg: #efe9e1;          /* soft warm page background */
    --primary: #825a34;     /* form background (requested) */
    --primary-dark: #6b4728;/* button hover / darker accent */
    --accent: #b79b75;      /* lighter accent */
    --text: #2b221a;        /* primary text color */
    --muted: #8e7b6b;       /* secondary text */
    --field-bg: #fffaf7;    /* input / textarea background */
    --field-border: rgba(139, 115, 94, 0.35);
    --field-focus: var(--primary-dark);

    /* new card variables */
    --card-bg: #ffffff;
    --card-max-width: 920px;
    --card-radius: 12px;
    --card-padding: 28px;
}

/* place the whole site on a white card centered on the warm background */
.main-page {
    max-width: var(--card-max-width);
    margin: 36px auto;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* reduce outer page padding so the warm background acts like a frame */
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    padding: 18px;
}

/* form */
form {
    max-width: 500px;
    margin: 0 auto;
    background-color: var(--primary); /* #825a34 */
    color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* headings and text */
h1 {
    text-align: center;
    color: var(--text);
}

p {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 0;
    color: var(--muted);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
    color: #fff; /* labels inside the dark form stay readable */
    text-align: left;
}

/* checkboxes (modern browsers) */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary-dark); /* harmonized check color */
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 8px;
    margin-bottom: 0;
}

/* inputs, selects, textarea (harmonized borders + focus) */
input,
textarea,
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid var(--field-border);
    border-radius: 4px;
    box-sizing: border-box;
    background: var(--field-bg);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--field-focus);
    box-shadow: 0 0 0 6px rgba(104,70,40,0.08);
}

/* placeholder color for inputs/textareas */
input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 1;
}

/* make select show the same muted placeholder style until a valid option is chosen */
select:required:invalid {
    color: var(--muted);
}

/* normal text color once a real option is selected */
select:required:valid {
    color: var(--text);
}

/* ensure option text itself uses regular text color */
select option {
    color: var(--text);
}

/* default textarea sizing (centered on form) */
textarea {
    width: 80%;
    max-width: 420px;
    display: block;
    margin: 0 auto 12px;
    min-height: 140px;  /* default height */
    height: 140px;      /* explicit default height */
    resize: vertical;
    box-sizing: border-box;
}

/* required field indicator */
input:required,
textarea:required,
select:required {
    border: 2px solid #ff6b6b;
}

input:required::after,
select:required::after {
    content: " *";
    color: #ff6b6b;
}

/* buttons */
button {
    display: block;
    margin: 20px auto 0;
    background-color: var(--primary-dark);
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #52321b; /* slightly darker */
}
/* center images */
img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
/* images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

/* slightly more space below the hero image */
.care-image {
    margin-top: 28px;
}

/* nicer list markers for benefits / how-it-works */
.benefits ul,
.how-it-works ul {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

.benefits li,
.how-it-works li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 10px;
    color: var(--text);
}

.benefits li::before,
.how-it-works li::before {
    content: "🐾";
    position: absolute;
    left: 0;
    top: 0;
    font-size: 16px;
    line-height: 1;
    color: var(--accent);
    -webkit-font-smoothing: antialiased;
}

/* center the Benefits / How It Works blocks */
.info-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;            /* reduced gap between the two sections */
    margin-bottom: 12px;  /* smaller space between info-grid and next section */
    align-items: center; /* center blocks on narrow screens */
}

/* center content inside each block while keeping list items readable */
.info-grid .benefits,
.info-grid .how-it-works {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* make the UL an inline-block so the list group centers, but list items remain left-aligned */
.info-grid ul {
    display: inline-block;
    text-align: left;
    padding-left: 0;
    margin: 0;
}

@media (min-width: 768px) {
    .info-grid {
        flex-direction: row;
        gap: 20px; /* smaller horizontal gap between How It Works and Benefits */
        align-items: flex-start;
        justify-content: center; /* center columns on wide screens */
    }

    .info-grid .benefits,
    .info-grid .how-it-works {
        max-width: 42%;
    }

    /* reduce space above the signup form so it sits closer to info-grid */
    .signup-section {
        margin-top: 12px;
    }
}

@media (max-width: 767px) {
    /* space evenly between top-level sections on small screens */
    .main-page {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    /* keep internal info-grid spacing consistent on small screens */
    .info-grid {
        gap: 5px;
    }

    /* avoid double spacing from image margin */
    .care-image {
        margin-bottom: 0;
    }

    .main-page {
        margin: 12px;
        padding: 16px;
        border-radius: 10px;
    }
}

/* center the signup section title */
.signup-section h2 {
    text-align: center;
    margin-top: 0.25rem;
    color: var(--text);
}

/* 2x2 checkbox layout inside the form (stacks to 1 column on small screens) */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
    margin: 8px 0 12px;

    /* visual grouping box */
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

/* ensure labels inside the boxed group read well on the dark form */
form .checkboxItem {
    color: #fff;
}

/* slight spacing tweak for items inside the box */
.checkboxItem {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.checkboxItem input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-dark);
}

@media (max-width: 420px) {
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

/* form submission messages (centered box + centered text) */
.form-success,
.form-error {
    display: block;
    margin: 12px auto 0;       /* center the message box horizontally */
    padding: 10px 12px;
    border-radius: 8px;
    text-align: center;        /* center the message text */
    font-weight: 600;
    max-width: 480px;          /* keep box a reasonable width */
    width: calc(100% - 24px);
}