/* BBQ Booking custom field — beat Gravity Forms theme width:100% on nested divs */

.cbbq-booking-field {
    width: 100%;
}

.cbbq-booking-rows {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* CSS grid (not flex): GF often forces width:100% on children, which
   collapses flex rows but still respects explicit grid columns. */
.cbbq-booking-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.65rem 0.75rem;
    width: 100% !important;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    box-sizing: border-box;
    overflow: visible !important;
    position: relative;
    z-index: 1;
}

/* Elevate the row that is typing / has an open suggestions list */
.cbbq-booking-row:focus-within,
.cbbq-booking-row:has(.cbbq-member-suggestions:not([hidden])) {
    z-index: 200;
}

.cbbq-booking-col--name,
.cbbq-booking-col--menu,
.cbbq-booking-col--actions {
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    float: none !important;
    box-sizing: border-box;
    overflow: visible !important;
}

.cbbq-booking-col--name {
    grid-column: 1;
    position: relative;
    z-index: 2;
}

.cbbq-booking-col--menu {
    grid-column: 2;
    position: relative;
    z-index: 1;
}

.cbbq-booking-col--actions {
    grid-column: 3;
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    /* Align with inputs under the labels */
    margin-top: 1.35rem;
    padding-bottom: 0;
    z-index: 1;
}

@media (max-width: 639px) {
    .cbbq-booking-row {
        grid-template-columns: minmax(0, 1fr) auto !important;
        align-items: end;
        gap: 0.65rem 0.5rem;
    }

    .cbbq-booking-row + .cbbq-booking-row {
        margin-top: 0.35rem;
        padding-top: 0.85rem;
        border-top: 1px solid rgba(87, 61, 90, 0.18);
    }

    /* Name full width */
    .cbbq-booking-col--name {
        grid-column: 1 / -1 !important;
    }

    /* Menu fills remaining width; X only takes button width, flush right */
    .cbbq-booking-col--menu {
        grid-column: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .cbbq-booking-col--menu .cbbq-booking-menu-wrap,
    .cbbq-booking-col--menu .cbbq-booking-menu {
        width: 100% !important;
        max-width: 100% !important;
    }

    .cbbq-booking-col--actions {
        grid-column: 2 !important;
        margin-top: 0 !important;
        align-self: end;
        justify-content: flex-end !important;
        justify-self: end;
        width: auto !important;
        max-width: none !important;
        flex: 0 0 auto;
        padding-bottom: 0.15rem;
    }
}

.cbbq-booking-col__label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(87, 61, 90, 0.7);
}

.cbbq-booking-name-wrap,
.cbbq-booking-menu-wrap {
    position: relative !important;
    display: block;
    width: 100%;
    overflow: visible !important;
}

.cbbq-booking-name,
.cbbq-booking-menu {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    border: 2px solid rgba(87, 61, 90, 0.25);
    border-radius: 0.75rem;
    background-color: #fff;
    color: #573d5a;
    -webkit-text-fill-color: #573d5a;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.35;
    min-height: 2.85rem;
    padding: 0.7rem 0.9rem;
}

/* Caret on the select itself (reliable vs ::after on a parent GF restyles) */
.cbbq-booking-menu {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    padding: 10px 2.6rem 10px 15px !important;
    cursor: pointer;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23573d5a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.95rem center !important;
    background-size: 0.75rem 0.5rem !important;
}

.cbbq-booking-menu option {
    color: #573d5a;
    background: #fff;
    -webkit-text-fill-color: #573d5a;
}

.cbbq-booking-name:focus,
.cbbq-booking-menu:focus {
    outline: none;
    border-color: #8a9d57;
    box-shadow: 0 0 0 3px rgba(138, 157, 87, 0.25);
}

/* Purple action buttons — cream text/icon */
.cbbq-booking-add,
.cbbq-booking-remove {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin: 0;
    border: 0;
    border-radius: 9999px;
    background: #573d5a !important;
    color: #fff7ec !important;
    -webkit-text-fill-color: #fff7ec;
    font-family: inherit;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1;
    cursor: pointer;
    box-shadow: none !important;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.cbbq-booking-add {
    height: 2.25rem;
    padding: 0 0.9rem;
    font-size: 0.72rem;
    white-space: nowrap;
}

.cbbq-booking-remove {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    font-size: 1.25rem;
}

.cbbq-booking-add:hover,
.cbbq-booking-remove:hover,
.cbbq-booking-add:focus,
.cbbq-booking-remove:focus {
    background: #6b4d6e !important;
    color: #fff7ec !important;
    -webkit-text-fill-color: #fff7ec;
    transform: translateY(-1px);
}

.cbbq-booking-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    margin-top: 0.65rem;
}

.cbbq-member-suggestions {
    position: absolute !important;
    top: calc(100% + 2px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    z-index: 3000 !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 2px solid #573d5a;
    border-radius: 0.75rem;
    background: #fff;
    max-height: 220px;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 4px 4px 0 0 #573d5a;
    width: 100% !important;
    height: auto !important;
    float: none !important;
}

.cbbq-member-suggestions li {
    padding: 8px 10px;
    cursor: pointer;
    color: #573d5a;
}

.cbbq-member-suggestions li:hover {
    background: rgba(138, 157, 87, 0.2);
}

.cbbq-booking-entry {
    margin: 0;
    padding-left: 1.1rem;
}

.cbbq-booking-entry__id {
    opacity: 0.65;
    font-size: 0.9em;
}
