/**
 * Machine Service Manager – Frontend Form
 * Aesthetic: Confident, clean service booking. Dark accents, green CTA.
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    --msm-f-green:     #2a9134;
    --msm-f-green-dk:  #1f6e27;
    --msm-f-green-lt:  #f0faf1;
    --msm-f-dark:      #1A2332;
    --msm-f-text:      #1A2332;
    --msm-f-muted:     #6B7280;
    --msm-f-border:    #E5E7EB;
    --msm-f-bg:        #F9FAFB;
    --msm-f-white:     #ffffff;
    --msm-f-red:       #dc2626;
    --msm-f-radius:    8px;
    --msm-f-font:      'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Wrapper ────────────────────────────────────────────── */
.msm-form-wrapper {
    max-width: 700px;
    margin: 0 auto;
    font-family: var(--msm-f-font);
}

.msm-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--msm-f-dark);
    margin: 0 0 20px;
    line-height: 1.2;
}

/* ─── Form card ──────────────────────────────────────────── */
.msm-intake-form {
    background: var(--msm-f-white);
    border: 1px solid var(--msm-f-border);
    border-radius: 12px;
    /* No overflow:hidden — that clipped the DAWA address-autocomplete
       dropdown when it extended past the form's bottom edge. The submit
       row at the form's bottom gets its own matching border-radius below
       so its full-bleed background still respects the rounded corners. */
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    font-family: var(--msm-f-font) !important;
}

.msm-form-wrapper,
.msm-form-wrapper *,
.msm-intake-form,
.msm-intake-form * {
    font-family: var(--msm-f-font) !important;
    box-sizing: border-box;
}

/* ─── Fieldset ───────────────────────────────────────────── */
.msm-intake-form .msm-fieldset {
    border: none;
    border-bottom: 1px solid var(--msm-f-border);
    padding: 20px 24px;
    margin: 0;
    min-width: 0;
    box-sizing: border-box;
    width: 100%;
}
.msm-intake-form .msm-fieldset.msm-fieldset-last {
    border-bottom: none;
}

/* ─── Address field inside transport section ─────────────── */
#msm_f_address_group {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--msm-f-border);
}

.msm-fieldset-legend {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--msm-f-muted);
    padding: 0;
    margin-bottom: 14px;
    display: block;
    width: 100%;
}

/* ─── Two-column grid ────────────────────────────────────── */
.msm-fieldset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    width: 100%;
    box-sizing: border-box;
}

.msm-fieldset-grid .msm-field-full {
    grid-column: 1 / -1;
}

/* ─── Fields ─────────────────────────────────────────────── */
.msm-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msm-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--msm-f-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.msm-field label span {
    color: var(--msm-f-red);
}

.msm-field input[type="text"],
.msm-field input[type="tel"],
.msm-field input[type="email"],
.msm-field select,
.msm-field textarea {
    font-family: var(--msm-f-font);
    font-size: 14px;
    color: var(--msm-f-text);
    background: var(--msm-f-bg);
    border: 1px solid var(--msm-f-border);
    border-radius: var(--msm-f-radius);
    padding: 9px 12px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s, background .15s;
    outline: none;
    -webkit-appearance: none;
}

.msm-field input:focus,
.msm-field select:focus,
.msm-field textarea:focus {
    border-color: var(--msm-f-green);
    background: var(--msm-f-white);
    box-shadow: 0 0 0 3px rgba(42,145,52,.12);
}

.msm-field textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* ─── Transport cards ────────────────────────────────────── */
.msm-transport-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.msm-transport-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--msm-f-border);
    border-radius: var(--msm-f-radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    user-select: none;
    background: var(--msm-f-bg);
    position: relative;
}

.msm-transport-card:hover {
    border-color: var(--msm-f-green);
    background: var(--msm-f-green-lt);
}

.msm-transport-card.selected {
    border-color: var(--msm-f-green);
    background: var(--msm-f-green-lt);
}

.msm-transport-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Suppress the browser's default (black) focus outline on the card and its
   hidden radio — that dark box was the long-standing "active border" gripe.
   Keep an accessible focus ring for keyboard users, in the brand green, only
   when focus arrives via keyboard (:focus-visible), never on mouse click. */
.msm-transport-card input[type="radio"]:focus-visible + .msm-transport-card-radio,
.msm-transport-card:focus-within {
    outline: none;
}
.msm-transport-card input[type="radio"]:focus-visible ~ .msm-transport-card-radio {
    box-shadow: 0 0 0 3px var(--msm-f-green-lt);
}

.msm-transport-card-radio {
    width: 18px;
    height: 18px;
    border: 2px solid var(--msm-f-border);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 1px;
    transition: border-color .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msm-transport-card.selected .msm-transport-card-radio {
    border-color: var(--msm-f-green);
    background: var(--msm-f-green);
}

.msm-transport-card.selected .msm-transport-card-radio::after {
    content: '';
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
}

.msm-transport-card-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--msm-f-muted);
    fill: none;
    stroke-width: 1.8;
    flex-shrink: 0;
    margin-top: 1px;
}

.msm-transport-card.selected .msm-transport-card-icon svg {
    stroke: var(--msm-f-green);
}

.msm-transport-card-text strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--msm-f-dark);
    line-height: 1.3;
}

.msm-transport-card-text span {
    font-size: 11px;
    color: var(--msm-f-muted);
    line-height: 1.4;
    margin-top: 2px;
    display: block;
}


/* ─── Submit row ─────────────────────────────────────────── */
.msm-submit-row {
    padding: 16px 24px;
    background: var(--msm-f-bg);
    border-top: 1px solid var(--msm-f-border);
    /* Match the form's outer corners — was previously clipped by the form's
       overflow:hidden, which we removed so the DAWA dropdown can escape. */
    border-bottom-left-radius: 11px;
    border-bottom-right-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.msm-submit-note {
    font-size: 12px;
    color: var(--msm-f-muted);
    line-height: 1.4;
}

/* Hardened against THEME button styles (1.10.03): on the live site the
   theme's button:hover (light-green fill + green border) out-specified
   ours, leaving white text on light green — unreadable. A public form
   embeds in arbitrary themes, so the critical properties are locked with
   !important in BOTH states — same belt-and-braces rationale as the
   admin-bar fix in 1.8.07. */
.msm-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--msm-f-green) !important;
    color: #fff !important;
    font-family: var(--msm-f-font);
    font-size: 14px;
    font-weight: 600;
    padding: 11px 24px;
    border: none !important;
    border-radius: var(--msm-f-radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, transform .1s;
    flex-shrink: 0;
    text-decoration: none !important;
}
.msm-submit-btn span { color: inherit !important; }

.msm-submit-btn:hover,
.msm-submit-btn:focus {
    background: var(--msm-f-green-dk) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.msm-submit-btn:disabled {
    background: #9CA3AF !important;
    cursor: not-allowed;
    transform: none;
}

.msm-submit-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* ─── Messages ───────────────────────────────────────────── */
.msm-error-message {
    margin: 0 0 16px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--msm-f-radius);
    color: var(--msm-f-red);
    font-size: 13px;
    font-weight: 500;
}

/* ─── Thank you page ─────────────────────────────────────── */
.msm-thankyou-wrap {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
    padding: 40px 16px;
    font-family: var(--msm-f-font);
}

.msm-thankyou-icon {
    width: 60px;
    height: 60px;
    background: var(--msm-f-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
}

.msm-thankyou-icon svg {
    width: 30px;
    height: 30px;
    stroke: #fff;
}

.msm-thankyou-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--msm-f-dark);
    margin: 0 0 8px;
}

.msm-thankyou-subtitle {
    font-size: 15px;
    color: var(--msm-f-muted);
    margin: 0 0 18px;
    line-height: 1.6;
}

.msm-thankyou-ref {
    display: inline-block;
    background: var(--msm-f-green-lt);
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 6px;
    padding: 8px 20px;
    font-size: 14px;
    margin-bottom: 24px;
}

.msm-thankyou-summary {
    background: var(--msm-f-white);
    border: 1px solid var(--msm-f-border);
    border-radius: 10px;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.msm-thankyou-summary-title {
    background: var(--msm-f-dark);
    color: rgba(255,255,255,.7);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 10px 18px;
}

.msm-thankyou-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--msm-f-border);
    font-size: 14px;
}

.msm-thankyou-row:last-child { border-bottom: none; }
.msm-thankyou-row span { color: var(--msm-f-muted); flex-shrink: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; font-weight: 600; padding-top: 2px; }
.msm-thankyou-row strong { color: var(--msm-f-dark); text-align: right; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
    .msm-intake-form .msm-fieldset { padding: 16px 16px; }
    .msm-fieldset-grid { grid-template-columns: 1fr; }
    .msm-transport-options { grid-template-columns: 1fr; }
    .msm-submit-row { flex-direction: column; align-items: stretch; }
    .msm-submit-btn { justify-content: center; }
    .msm-submit-note { text-align: center; }
}

/* ─── Email-verify dance (Stage 3) ────────────────────────── */
.msm-email-confirm-wrap[hidden] {
    display: none !important;
}
.msm-email-confirm-hint {
    font-size: 12px;
    margin-top: 6px;
    min-height: 16px; /* reserve space so the layout doesn't jump */
    color: var(--msm-f-muted, #6B7280);
}
.msm-email-confirm-hint--ok {
    color: var(--msm-f-green, #2A9134);
    font-weight: 600;
}
.msm-email-confirm-hint--err {
    color: #DC2626;
    font-weight: 600;
}

/* ── Warranty / reklamation (1.7.21) ───────────────────────── */
.msm-warranty-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
}
.msm-warranty-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    /* Brand-green check instead of the browser's default blue, and no harsh
       black focus box on click. This — the native checkbox outline — was the
       real "sorte border", not the transport card. */
    accent-color: var(--msm-f-green);
    outline: none;
}
.msm-warranty-toggle input[type="checkbox"]:focus {
    outline: none;
}
.msm-warranty-toggle input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--msm-f-green);
    outline-offset: 2px;
}
.msm-warranty-disclaimer {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: #6d4c00;
}
.msm-label-optional {
    font-weight: 400;
    color: #8a94a6;
    font-size: 0.85em;
}

/* Helper / descriptive text under a field or checkbox (1.7.31).
   Was using the admin-only .msm-field-desc class, which isn't defined on
   the frontend — so these lines rendered at full body size and visually
   overpowered the fields they were meant to support. Small + muted now. */
.msm-intake-form .msm-field-desc {
    font-size: 13px;
    line-height: 1.45;
    font-weight: 400;
    color: var(--msm-f-muted, #8a94a6);
    margin: 6px 0 0;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Pickup pricelist (1.7.30) ─────────────────────────────── */
.msm-pricelist-wrap { margin-top: 16px; }
.msm-pricelist-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--msm-f-text, #1f2937);
    margin-bottom: 8px;
}
.msm-pricelist {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.msm-pricelist th,
.msm-pricelist td {
    text-align: left;
    padding: 7px 10px;
    border-bottom: 1px solid #e6e9ef;
}
.msm-pricelist th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #6b7280;
}
.msm-pricelist tr:first-child td { font-weight: 600; }
.msm-pricelist td:first-child { color: #374151; }

/* ─── Request-type chooser (1.10.00) ───────────────────────────
   Reuses the transport-card visual language. Three cards on desktop,
   stacked on mobile. The branch body reveals below on selection. */
.msm-rtype-options { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) {
    .msm-rtype-options { grid-template-columns: 1fr; }
}
.msm-branch-body[hidden] { display: none; }
.msm-branch-section[hidden] { display: none; }

/* Fix (1.10.01): the dynamic issue-label wrapper is a <span> INSIDE the
   label, so it caught the required-asterisk rule above (.msm-field label
   span = red). The wrapper must read as normal label text. */
.msm-field label span#msm-issue-label {
    color: inherit;
    font-weight: inherit;
    font-size: inherit;
}

/* ─── Chooser cards, polished (1.10.01) ────────────────────────
   The 1.10.00 cards reused the horizontal transport-card layout: radio
   dot + icon + wrapping text crammed side-by-side ("kan vist gøres
   pænere"). Now: vertical, centered, icon in a soft tinted circle, no
   visible radio (selection = green border, tinted bg, corner check),
   equal heights from the grid. */
.msm-rtype-options .msm-transport-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 20px 14px 16px;
}
.msm-rtype-options .msm-transport-card-radio { display: none; }
.msm-rtype-options .msm-transport-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.msm-rtype-options .msm-transport-card-icon svg {
    width: 20px;
    height: 20px;
    stroke: #64748B;
    fill: none;
    stroke-width: 1.8;
    transition: stroke .15s;
}
.msm-rtype-options .msm-transport-card:hover .msm-transport-card-icon,
.msm-rtype-options .msm-transport-card.selected .msm-transport-card-icon {
    background: #E7F3E8;
}
.msm-rtype-options .msm-transport-card:hover .msm-transport-card-icon svg,
.msm-rtype-options .msm-transport-card.selected .msm-transport-card-icon svg {
    stroke: var(--msm-f-green);
}
.msm-rtype-options .msm-transport-card-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.msm-rtype-options .msm-transport-card-text strong {
    font-size: 14px;
    line-height: 1.25;
    color: #1A2332;
}
.msm-rtype-options .msm-transport-card-text span {
    font-size: 12px;
    line-height: 1.35;
    color: #64748B;
}
/* Selected: corner check instead of the radio dot. */
.msm-rtype-options .msm-transport-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--msm-f-green);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

/* Sender-tilstand (1.10.08): knappen deaktiveres ALDRIG mere — kun visuel
   dæmpning + spinner-agtig puls mens forsendelsen kører. */
.msm-submit-btn.is-sending {
    opacity: .75;
    cursor: progress;
}
