/* GetSettle UK - forms
   Mobile first. Base rules are the phone layout; media queries only widen.

   Replaces the inline width:90% / margin-right:2rem / grid 1fr 1fr that made
   every field 31% to 66% of a 375px screen with dead space beside it.

   The 16px minimum on controls is not cosmetic: iOS Safari zooms the page when
   a focused input is smaller than that, which throws the user out of the form. */

/* The card the form sits in. Full bleed on a phone, capped on a desktop.
   .feature-card ships 32px of padding, which on a 375px screen stacks with the
   section and container padding to eat 128px, a third of the viewport. Claw it
   back on small screens and restore it once there is room. */
.gs-card {
    width: 100%;
    max-width: 800px;
    margin-inline: auto;
    text-align: start;
    padding: 1.15rem;
}

@media (min-width: 640px) {
    .gs-card {
        padding: 2rem;
    }
}

.gs-card--narrow {
    max-width: 600px;
}

.gs-form {
    display: grid;
    gap: 1.5rem;
    width: 100%;
    min-width: 0;
}

/* Grid children default to min-width:auto, so a long label or a URL can push a
   track wider than its parent. Every level has to opt out. */
.gs-form>*,
.gs-row>*,
.gs-field>* {
    min-width: 0;
}

.gs-form h3 {
    margin: 0 0 .75rem;
    font-size: 1.05rem;
    font-weight: 700;
}

/* Field groups stack on a phone and only pair up when there is room */
.gs-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 560px) {
    .gs-row.gs-row--pair {
        grid-template-columns: 1fr 1fr;
    }
}

/* Two-up content sections. Several pages hardcoded
   `grid-template-columns: 1fr 1fr` inline, which never collapsed and pushed the
   page 50px wider than a phone screen. One column first, two when there is room. */
.gs-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
}

.gs-split > * {
    min-width: 0;
}

@media (min-width: 768px) {
    .gs-split {
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
    }
}

.gs-field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    min-width: 0;
    /* lets a grid child shrink instead of forcing overflow */
}

.gs-field label,
.gs-label {
    font-weight: 500;
    font-size: .95rem;
    line-height: 1.5;
}

.gs-field label .gs-optional {
    font-weight: 400;
    color: var(--text-secondary, #566b68);
}

.gs-form input[type="text"],
.gs-form input[type="email"],
.gs-form input[type="url"],
.gs-form input[type="tel"],
.gs-form select,
.gs-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: .8rem .85rem;
    border: 1px solid var(--border-strong, #b9c7c5);
    border-radius: var(--radius, 10px);
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #12211f);
    font: inherit;
    font-size: 16px;
    /* never below 16px, see note above */
    line-height: 1.5;
}

.gs-form textarea {
    min-height: 7rem;
    resize: vertical;
}

.gs-form select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
        linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 1.1rem) 1.25rem, calc(100% - .75rem) 1.25rem;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-inline-end: 2.5rem;
}

[dir="rtl"] .gs-form select {
    background-position: 1.1rem 1.25rem, .75rem 1.25rem;
    background-image: linear-gradient(135deg, transparent 50%, currentColor 50%),
        linear-gradient(45deg, currentColor 50%, transparent 50%);
}

.gs-form input:focus-visible,
.gs-form select:focus-visible,
.gs-form textarea:focus-visible {
    outline: 2px solid var(--brand-teal, #1e7f7f);
    outline-offset: 1px;
    border-color: var(--brand-teal, #1e7f7f);
}

/* Helper text under a field */
.gs-hint {
    margin: 0;
    font-size: .88rem;
    line-height: 1.6;
    color: var(--text-secondary, #566b68);
}

/* The submit panel */
.gs-submit {
    background: var(--bg-surface-secondary, #f4f7f6);
    padding: 1.25rem;
    border-radius: var(--radius, 10px);
}

.gs-submit p {
    margin: 0 0 1rem;
    font-size: .95rem;
    line-height: 1.65;
}

.gs-form button[type="submit"] {
    width: 100%;
    /* 44px is the minimum comfortable tap target */
    min-height: 48px;
    font-size: 1rem;
}

.gs-status {
    text-align: center;
    margin: 1rem 0 0;
    font-size: .95rem;
    line-height: 1.6;
    min-height: 1.2em;
}

.gs-status[data-state="ok"] {
    color: var(--brand-teal, #1e7f7f);
}

.gs-status[data-state="error"] {
    color: #a32f2a;
}

[data-theme="dark"] .gs-status[data-state="ok"],
body.dark-mode .gs-status[data-state="ok"] {
    color: #6FD8CC;
}

[data-theme="dark"] .gs-status[data-state="error"],
body.dark-mode .gs-status[data-state="error"] {
    color: #e58a82;
}

/* Spam trap, never visible, never focusable */
.gs-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Order summary panel above the form */
.gs-summary {
    background: var(--bg-surface-secondary, #f4f7f6);
    padding: 1rem 1.1rem;
    border-radius: var(--radius, 10px);
    margin-bottom: 1.75rem;
}

.gs-summary-line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: .5rem;
}

.gs-summary-total {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-weight: 700;
    font-size: 1.1rem;
    border-top: 1px solid var(--border-subtle, #dfe6e4);
    padding-top: .6rem;
}

[data-theme="dark"] .gs-form input,
[data-theme="dark"] .gs-form select,
[data-theme="dark"] .gs-form textarea,
body.dark-mode .gs-form input,
body.dark-mode .gs-form select,
body.dark-mode .gs-form textarea {
    background: rgba(255, 255, 255, .05);
    border-color: rgba(255, 255, 255, .2);
    color: rgba(255, 255, 255, .92);
}

[data-theme="dark"] .gs-submit,
[data-theme="dark"] .gs-summary,
body.dark-mode .gs-submit,
body.dark-mode .gs-summary {
    background: rgba(255, 255, 255, .04);
}
