/* Base typography normalization for RSVP form */
#tpw-rsvp-form,
#tpw-rsvp-form select,
#tpw-rsvp-form input,
#tpw-rsvp-form label,
#tpw-rsvp-form legend,
#tpw-rsvp-form textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: 1.5;
    color: #333;
}

/* Improved fieldset and legend styling */
#tpw-rsvp-form fieldset {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 1.5em;
    margin-bottom: 1.5em;
    background-color: #f9f9f9;
}

#tpw-rsvp-form legend {
    font-weight: 600;
    font-size: 1.1em;
    color: #333;
    padding: 0 0.5em;
}

#tpw-rsvp-form label {
    font-size: inherit;
}

#tpw-rsvp-form input[type="radio"] + label,
#tpw-rsvp-form input[type="checkbox"] + label {
    font-size: inherit;
}

/* Member Meal Section (Your Meal Selection) */
.member-meal-section label {
    display: block;
    margin-bottom: 1rem;
}

.member-meal-section select, .guest-dining-section select {
    width: 100%;
    max-width: 100%;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.member-meal-section input[type="text"] {
    width: 100%;
    padding: 0.6rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* RSVP Form Layout */
.rsvp-form {
    max-width: 700px;
    margin: 0 auto;
    padding: 1.5rem;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* RSVP Question Block */
.rsvp-question {
    margin-bottom: 1.5rem;
}

.rsvp-question label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}


.rsvp-question input[type="text"],

#tpw-rsvp-form input[type="text"],
#tpw-rsvp-form input[type="email"],
#tpw-rsvp-form select,
#tpw-rsvp-form textarea {
    width: 100%;
    padding: 0.6rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

#tpw-rsvp-form input:focus,
#tpw-rsvp-form select:focus,
#tpw-rsvp-form textarea:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Consistent labels and spacing across Member and Guest areas */
#tpw-rsvp-form .member-attendance > p { margin-bottom: 1rem; }
#tpw-rsvp-form .member-attendance > p > label,
#tpw-rsvp-form .tpw-field label,
#tpw-rsvp-form .member-meal-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

/* Align the two member fields row spacing to guest row spacing */
.tpw-member-dietary-row { gap: 0.5rem; }

/* RSVP Submit Button */
.rsvp-submit {
    text-align: right;
}

.rsvp-submit button {
    background-color: #0073aa;
    color: #fff;
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.rsvp-submit button:hover {
    background-color: #005f8d;
}

.hidden {
    display: none;
}

.rsvp-highlight {
    background: #f5f5f5;
    padding: 10px;
    border-left: 5px solid #0073aa;
}

/* RSVP Checkout */
.entry-content > .tpw-rsvp-checkout,
.tpw-rsvp .tpw-rsvp-checkout {
  width: calc(100% - 4rem);
  max-width: 60rem;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.tpw-rsvp .notice {
  max-width: none;   
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 4rem;
  padding-right: 4rem;
  box-sizing: border-box;
  text-align:center;
}

.tpw-rsvp .tpw-checkout-summary-controls {
    width: 100%;
    margin: 0 0 20px;
    max-width: none;
    box-sizing: border-box;
}

.tpw-rsvp .tpw-checkout-column {
    width: 100%;
    max-width: 34rem;
    margin: 20px auto;
    box-sizing: border-box;
}

.tpw-rsvp .tpw-checkout-amount-card {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    background: #fafafa;
    padding: 16px 18px;
    box-shadow: none;
}

.tpw-rsvp .tpw-checkout-column #payment-method-section {
    width: 100%;
    max-width: none;
    margin: 0;
}

.tpw-rsvp-checkout--visitor .tpw-checkout-column {
    max-width: 34rem;
}

.tpw-rsvp-checkout--visitor .tpw-rsvp-visitor-checkout__summary {
    margin-bottom: 20px;
}

.tpw-rsvp-checkout--visitor .tpw-rsvp-visitor-checkout__summary h2,
.tpw-rsvp-checkout--visitor .tpw-rsvp-visitor-checkout__summary h3 {
    margin-top: 0;
}

.tpw-rsvp-checkout--visitor .tpw-rsvp-visitor-checkout__booking-summary {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e2e2;
}

.tpw-rsvp-checkout--visitor .tpw-rsvp-visitor-checkout__booking-summary ul {
    margin: 8px 0 0 1.2rem;
}

.tpw-rsvp-checkout--visitor .tpw-rsvp-visitor-checkout__amount,
.tpw-rsvp-checkout--visitor .tpw-rsvp-visitor-checkout__status {
    margin-bottom: 0;
}

.tpw-rsvp #payment-method-section {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    max-width: 34rem;
    background: #fafafa;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    padding: 16px 18px;
    margin: 20px auto;
    box-sizing: border-box;
}

.rsvp-payment-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 2rem;
}
.rsvp-payment-table-wrapper table {
    min-width: 600px;
}

.tpw-rsvp .rsvp-submissions-wrapper {
  max-width: none !important;
  width: 100% !important;
}

.tpw-rsvp .tpw-payment-breakdown, .tpw-rsvp .tpw-payment-summary {

    width: 100%;
    width: calc(100% - 4rem);
    margin-left: auto;
    margin-right: auto;
    max-width: 60rem;
    background: #f3f3f3;
    border: 1px solid #ccc;
    padding: 20px;
    margin: 20px auto;
}

.tpw-rsvp-checkout label {
    font-size: inherit;
    font-family: inherit;
}

.tpw-rsvp .tpw-payment-breakdown h3, .tpw-rsvp .tpw-payment-summary h3 {
    padding-top:0;
    margin-top: 0;
    color: #333;
}
.tpw-payment-breakdown ul {
    margin: 0;
    padding-left: 1.2em;
}
.tpw-payment-breakdown li {
    margin-bottom: 6px;
}

.tpw-payment-summary {
    background: #f9f9f9;
    border: 1px solid #ccc;
    padding: 10px 15px;
    margin-bottom: 20px;
}
.tpw-payment-summary ul {
    margin: 0;
    padding-left: 1.5em;
}

.rsvp-checkout-btn {
    margin: 2rem auto;
}

.rsvp-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #ccd0d4;
  background-color: #fff;
  font-size: 14px;
}

.rsvp-table th,
.rsvp-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e1e1e1;
  text-align: left;
}

.rsvp-table tbody tr:nth-child(odd) {
  background-color: #f9f9f9; /* this mimics 'striped' */
}

.tpw-visitor-share-modal {
    width: min(92vw, 38rem);
    border: none;
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.24);
}

.tpw-visitor-share-modal::backdrop {
    background: rgba(27, 31, 36, 0.54);
}

.tpw-visitor-share-modal__panel {
    margin: 0;
    padding: 1.5rem;
    border-radius: 14px;
}

.tpw-visitor-share-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tpw-visitor-share-modal__intro {
    flex: 1;
}

.tpw-visitor-share-modal__title {
    margin: 0 0 0.5rem 0;
}

.tpw-visitor-share-modal__description {
    margin: 0;
    max-width: 32rem;
}

.tpw-visitor-share-modal__section {
    margin-top: 1.5rem;
}

.tpw-visitor-share-modal__section--primary {
    margin-top: 0;
}

.tpw-visitor-share-modal__label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.tpw-visitor-share-modal__code-input,
.tpw-visitor-share-modal__link-input {
    width: 100%;
    box-sizing: border-box;
}

.tpw-visitor-share-modal__code-input {
    max-width: 22rem;
    padding: 0.95rem 1rem;
    border: 1px solid #c9d1d9;
    border-radius: 10px;
    background: #f6f8fa;
    color: #111827;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.tpw-visitor-share-modal__link-input {
    padding: 0.75rem 0.85rem;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-size: 0.95rem;
}

.tpw-visitor-share-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.tpw-visitor-share-modal__actions--primary {
    margin-top: 1rem;
}

.tpw-public-rsvp-gate__actions {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0 1.25rem;
}

.tpw-public-rsvp-gate__actions .tpw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    text-align: center;
}

.tpw-visitor-link-form {
    width: min(100%, 56rem);
    margin: 0 auto;
}

.tpw-visitor-link-form__form {
    margin-top: 1rem;
}

.tpw-visitor-link-form__fieldset {
    margin-bottom: 1.25rem;
}

.tpw-visitor-link-form__grid {
    display: grid;
    gap: 1rem;
    align-items: end;
}

.tpw-visitor-link-form__grid--identity {
    grid-template-columns: minmax(8rem, 10rem) minmax(0, 1fr);
}

.tpw-visitor-link-form__grid--details {
    grid-template-columns: minmax(0, 1.35fr) minmax(10rem, 0.65fr);
    margin-top: 1rem;
}

.tpw-visitor-link-form__field {
    min-width: 0;
}

#tpw-rsvp-form.tpw-visitor-link-form .tpw-visitor-link-form__field input[type="text"],
#tpw-rsvp-form.tpw-visitor-link-form .tpw-visitor-link-form__field input[type="email"],
#tpw-rsvp-form.tpw-visitor-link-form .tpw-visitor-link-form__field select {
    height: 2.75rem;
    min-height: 2.75rem;
    padding: 0.65rem 0.8rem;
    line-height: 1.2;
    box-sizing: border-box;
}

.tpw-visitor-link-form__field--reference {
    margin-top: 1rem;
    max-width: 32rem;
}

.tpw-visitor-link-form__field--title input[type="text"] {
    max-width: 10rem;
}

.tpw-visitor-link-form__field--rank input[type="text"] {
    max-width: 12rem;
}

.tpw-visitor-link-form__actions {
    margin-top: 1.75rem;
    margin-bottom: 0;
}

.tpw-visitor-link-form__actions .tpw-btn {
    min-width: 8.5rem;
}

.tpw-rsvp-visitor-info {
    line-height: 1.35;
    white-space: normal;
}

.tpw-rsvp-visitor-info div + div {
    margin-top: 0.2rem;
}

@media (max-width: 640px) {
    .tpw-visitor-share-modal {
        width: min(94vw, 38rem);
    }

    .tpw-visitor-share-modal__panel {
        padding: 1.125rem;
    }

    .tpw-visitor-share-modal__header {
        flex-direction: column;
    }

    .tpw-visitor-share-modal__code-input {
        max-width: 100%;
        font-size: 1.2rem;
        letter-spacing: 0.14em;
    }

    .tpw-visitor-share-modal__actions .tpw-btn {
        width: 100%;
    }

    .tpw-public-rsvp-gate__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .tpw-public-rsvp-gate__actions .tpw-btn {
        width: 100%;
    }

    .tpw-visitor-link-form {
        width: 100%;
    }

    .tpw-visitor-link-form__grid--identity,
    .tpw-visitor-link-form__grid--details {
        grid-template-columns: 1fr;
    }

    .tpw-visitor-link-form__field--reference,
    .tpw-visitor-link-form__field--title input[type="text"],
    .tpw-visitor-link-form__field--rank input[type="text"] {
        max-width: 100%;
    }

    .tpw-visitor-link-form__actions .tpw-btn {
        width: 100%;
    }
}

.rsvp-breakdown table.rsvp-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}

.rsvp-breakdown table.rsvp-table thead th {
  background-color: #f1f1f1;
  font-weight: bold;
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid #ccc;
}

.rsvp-breakdown table.rsvp-table tbody td {
  padding: 10px;
  border-bottom: 1px solid #e1e1e1;
}

.rsvp-breakdown table.rsvp-table tr.toggle-meal {
  cursor: pointer;
  transition: background 0.2s;
}

.rsvp-breakdown table.rsvp-table tr.toggle-meal:hover {
  background-color: #f9f9f9;
}

.rsvp-breakdown table.rsvp-table tr.meal-detail td {
  background-color: #fefefe;
  padding: 12px;
  border-top: 1px dashed #ddd;
  font-size: 13px;
  color: #333;
}

.rsvp-breakdown table.rsvp-table tfoot th {
  background-color: #fafafa;
  padding: 10px;
  border-top: 2px solid #ccc;
  text-align: right;
  font-weight: bold;
}

.rsvp-breakdown table.rsvp-table tfoot th[colspan="4"] {
  text-align: right;
}

.rsvp-breakdown table.rsvp-table tr td[style*="color:#c00"] {
  color: #c00 !important;
  font-weight: bold;
}

/* Mobile-friendly stacked layout for RSVP submissions table */
 .rsvp-form .member-attendance,
.rsvp-form .member-meal-section,
.rsvp-form .guest-section {
    margin-top: 1.5em;
}

@media (min-width: 600px) {
    .rsvp-form .rsvp-question,
    .rsvp-form .member-meal-section label {
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 1em;
        align-items: center;
    }
}

@media (max-width: 768px) {
    .rsvp-submissions-table {
        border: 0;
    }

    .rsvp-submissions-table thead {
        display: none;
    }

    .rsvp-submissions-table tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid #ddd;
        border-radius: 6px;
        padding: 1rem;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .rsvp-submissions-table td {
        display: block;
        text-align: left;
        font-size: 0.95rem;
        border: none;
        padding: 0.3rem 0;
    }

    .rsvp-submissions-table td::before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 110px;
        margin-right: 10px;
        color: #444;
    }

    .rsvp-submissions-wrapper {
        overflow-x: hidden;
    }

    .tpw-rsvp .tpw-rsvp-checkout {
        padding-left: 1rem;
        padding-right: 1rem;
        overflow-x: auto; /* handles any table overflows */
    }

    .tpw-rsvp .tpw-rsvp-checkout table {
        min-width: 600px; /* allow horizontal scroll if needed */
    }

    .tpw-rsvp .tpw-rsvp-summary.tpw-rsvp-checkout table {
        min-width: 0;
    }
}

/* Spacing for "View RSVP Summary" buttons on the RSVP form */
#tpw-rsvp-form #submit_button,
#tpw-rsvp-form #view_rsvp_top {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* TPW Core UI alignment for Guest Cards on RSVP form */
.tpw-card-guest {
    /** background: #fff;
    border: 1px solid #ddd; **/
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.tpw-card-guest .guest-fieldset {
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
}
.tpw-card-guest .guest-fieldset legend {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Grid utility for two-column layout */
.tpw-grid {
    display: grid;
    gap: 1rem;
}
.tpw-grid-2 {
    grid-template-columns: 1fr 1fr;
}
.tpw-grid-1 { grid-template-columns: 1fr; }
.tpw-grid-guest-row-1 {
    /* 4 columns on desktop/tablet: Title | First | Surname | Rank */
    grid-template-columns:
        minmax(80px, 120px)
        minmax(180px, 1fr)
        minmax(180px, 1fr)
        minmax(120px, 1fr);
    gap: 0.5rem;
}
.tpw-grid-guest-row-2 { grid-template-columns: minmax(120px, 180px) 1fr; gap: 0.5rem; align-items: end; margin-top: 0.75rem; }
.tpw-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
}
.tpw-field select,
.tpw-field input[type="text"],
.tpw-field input[type="email"],
.tpw-field textarea {
    width: 100%;
}
.tpw-span-2 {
    grid-column: 1 / -1;
}

/* Smaller field/input helpers */
.tpw-field-sm select,
.tpw-field-sm input[type="text"],
.tpw-input-sm {
    max-width: 180px;
    height: 40px;
    line-height: 1.2;
}
.tpw-field-title input[type="text"] {
    min-width: 80px;
    max-width: 120px;
}

/* Explicit minimums for first/surname/rank inputs */
.tpw-field-first-name input[type="text"] { min-width: 180px; }
.tpw-field-surname input[type="text"] { min-width: 180px; }
.tpw-field-rank input[type="text"] { min-width: 120px; }

/* Guest section spacing */
#tpw-rsvp-form .guest-self-pay-section {
    margin-top: 1rem;
}

/* Guest meal card */
.tpw-card-guest-meals {
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    padding: 1.25rem 1rem 1rem; /* extra top padding for space below legend */
    margin-top: 1.5rem; /* more space above the legend/card */
    position: relative;
}
.tpw-card-guest-meals .tpw-card-legend {
    position: absolute;
    top: -0.7rem;
    left: 0.75rem;
    background: transparent;
    padding: 0 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

/* Actions spacing */
.tpw-actions { margin-top: 1rem; }
.tpw-actions .tpw-btn { margin-top: 0.25rem; }

/* Responsive stack to one column on mobile */
@media (max-width: 640px) {
    .tpw-grid-2 { grid-template-columns: 1fr; }
    .tpw-grid-guest-row-1 { grid-template-columns: 1fr; }
    .tpw-grid-guest-row-2 { grid-template-columns: 1fr; }
}

/* Normalize input/select height and label spacing for alignment */
#tpw-rsvp-form .tpw-field input[type="text"],
#tpw-rsvp-form .tpw-field select {
    height: 40px;
    min-height: 40px;
    padding: 8px 10px;
    box-sizing: border-box;
}
.tpw-grid-guest-row-2 .tpw-field label,
.tpw-grid-guest-row-1 .tpw-field label {
    margin-bottom: 0.25rem;
}
.tpw-actions { margin-top: 1rem; }
.tpw-actions .tpw-btn { margin-top: 0.25rem; }

/* Make Member "Your Meal Selection" spacing consistent with Guest Meal Choice */
#tpw-rsvp-form .member-meal-section {
    padding: 0.75rem 1rem; /* match guest meals card internal spacing */
    margin-top: 1rem;      /* match spacing above */
}
#tpw-rsvp-form .member-meal-section br { display: none; } /* rely on label margin for spacing */
#tpw-rsvp-form .member-meal-section label {
    display: block;
    margin-bottom: 1rem;   /* match guest grid gap */
}
#tpw-rsvp-form .member-meal-section label:last-of-type { margin-bottom: 0; }
#tpw-rsvp-form .member-meal-section select {
    height: 40px;          /* align control height with guest selects */
    min-height: 40px;
    padding: 8px 10px;
    box-sizing: border-box;
}

/* Unconfirmed reminder banner (member checkout) */
#tpw-rsvp-unconfirmed-reminder {
    display: none;
    opacity: 0;
    transition: opacity 200ms ease-in;
    background: #f5f7fa;         /* neutral background */
    border: 1px solid #d0d7de;   /* soft border */
    color: #24292f;              /* neutral text */
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 6px;
    font-size: 0.95em;
}
#tpw-rsvp-unconfirmed-reminder.is-visible {
    opacity: 1;
}