/* AI Bus Trip — shared frontend styles.
 * Root stylesheet for all ABT components that live outside the airport
 * departure-board theme. Loaded on any page that uses ABT share buttons
 * or other generic UI elements.
 *
 * Theme palette variables (Kadence defaults fall back to ABT gold):
 *   --global-palette2       accent gold (#D1A155)
 *   --global-palette-btn    button text (#fff)
 *   --global-palette-btn-bg-hover  hover bg (#fff)
 *   --global-palette-btn-hover     hover text (#D1A155)
 */

/* ==========================================================================
   AddToAny Share button — generic golden button, theme aligned.
   ========================================================================== */

/* Base style for all share buttons + the EM "Book AI Bus Trip Now!" button
 * (scoped to EM's own classes so it survives EM updates).
 * NOTE: the `.em.pixelbones` prefix + `:not([data-nostyle])` are required —
 * EM's pixelbones CSS sets `background-color: transparent !important` on
 * `.em.pixelbones .input .button:not([data-nostyle])` (specificity 0,6,0).
 * Our selector must beat that, so we mirror the same classes and add `body`. */
body .aibus-share-button,
body .aibus-share-button:visited,
body .aibus-share-button:active,
body .aibus-share-button:focus,
body .aibus-share-button--inline,
body .aibus-share-button--compact,
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]),
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]):visited,
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]):active,
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]):focus {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: var(--global-heading-font-family, Inconsolata, monospace) !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    color: #ffffff !important;
    background: #D1A155 !important;
    background-color: #D1A155 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    vertical-align: middle !important;
    transition: all 0.3s ease-in-out !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 999999 !important;
}

/* Forced override for hover/focus to prevent theme inversion */
body .aibus-share-button:hover,
body .aibus-share-button:focus,
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]):hover,
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]):focus {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #D1A155 !important;
    box-shadow: 0px 15px 25px -7px rgba(0,0,0,0.1) !important;
}

/* EM ticket icon inside the Book button: EM ships a black SVG — replace the
 * background-image with our own white (on gold) / gold (on hover, white bg)
 * versions of the same ticket glyph. Deterministic — no filter math.
 * Scoped to EM's own classes. */
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]) .em-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' version='1.0' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23ffffff' stroke-miterlimit='10' stroke-width='2'%3E%3Cpath d='M57 18c-1.504 1.504-2.705 2-5 2-4.59 0-8-3.41-8-8 0-2.295.496-3.496 2-5l-6-6L1 40l6 6c1.504-1.504 2.705-2 5-2 4.59 0 8 3.41 8 8 0 2.295-.496 3.496-2 5l6 6 39-39-6-6zM26 15l4 4M45 34l4 4'/%3E%3C/g%3E%3Cpath fill='none' stroke='%23ffffff' stroke-miterlimit='10' stroke-width='2' d='m32 21 4 4M39 28l4 4'/%3E%3C/svg%3E") !important;
    margin-right: 8px !important;
}
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]):hover .em-icon,
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]):focus .em-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xml:space='preserve' version='1.0' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23D1A155' stroke-miterlimit='10' stroke-width='2'%3E%3Cpath d='M57 18c-1.504 1.504-2.705 2-5 2-4.59 0-8-3.41-8-8 0-2.295.496-3.496 2-5l-6-6L1 40l6 6c1.504-1.504 2.705-2 5-2 4.59 0 8 3.41 8 8 0 2.295-.496 3.496-2 5l6 6 39-39-6-6zM26 15l4 4M45 34l4 4'/%3E%3C/g%3E%3Cpath fill='none' stroke='%23D1A155' stroke-miterlimit='10' stroke-width='2' d='m32 21 4 4M39 28l4 4'/%3E%3C/svg%3E") !important;
}

/* Book button sizing — EM's pixelbones forces height 38px / line-height 38px
 * / font-size 11px; normalize to match the Share button (inline variant). */
body .em.pixelbones .em-item-actions .em-event-book-now.button:not([data-nostyle]) {
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
    letter-spacing: normal !important;
    padding: 4px 30px !important;
    height: auto !important;
    min-height: 0 !important;
    border-radius: 0 !important;
}

/* Hide EM's "More Info" link — the event title is already a link to the
 * same page, so the extra button is redundant. Scoped to EM's own classes. */
body .em.pixelbones .em-item-actions .em-item-read-more {
    display: none !important;
}

/* Share button on the EM events list (/book/) — pixel-identical to the
 * "Book AI Bus Trip Now!" button (gold, white text, hover invert).
 * Injected by ShareButton::injectListShareButtons() after each Book link. */
body .em.pixelbones .em-item-actions .aibus-share-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: var(--global-heading-font-family, Inconsolata, monospace) !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    color: #ffffff !important;
    background: #D1A155 !important;
    background-color: #D1A155 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    vertical-align: middle !important;
    transition: all 0.3s ease-in-out !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
    letter-spacing: normal !important;
    padding: 4px 30px !important;
    height: auto !important;
    margin-left: 10px !important;
}
body .em.pixelbones .em-item-actions .aibus-share-action .aibus-action-internal {
    color: #ffffff !important;
    text-decoration: none !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    font: inherit !important;
    display: inline !important;
    padding: 0 !important;
    margin: 0 !important;
}
body .em.pixelbones .em-item-actions .aibus-share-action:hover,
body .em.pixelbones .em-item-actions .aibus-share-action:focus {
    background: #ffffff !important;
    background-color: #ffffff !important;
    box-shadow: 0px 15px 25px -7px rgba(0,0,0,0.1) !important;
}
body .em.pixelbones .em-item-actions .aibus-share-action:hover .aibus-action-internal,
body .em.pixelbones .em-item-actions .aibus-share-action:focus .aibus-action-internal {
    color: #D1A155 !important;
}
/* Hide AddToAny-injected SVG/label inside the Share anchor */
body .em.pixelbones .em-item-actions .aibus-share-action .a2a_svg,
body .em.pixelbones .em-item-actions .aibus-share-action .a2a_label {
    display: none !important;
}

/* FIX: The Nuclear Z-Index. 
 * We force the popup and any of its potential wrappers to be on top of EVERY other element. */
body .a2a_popup, 
body .a2a_kit, 
body .aibus-share-kit {
    z-index: 2147483647 !important; /* Max possible 32-bit signed integer */
}

/* FIX: Kill any potential stacking context on the booking form that might isolate the popup. */
body .em-booking-form-section-confirm,
body .booking-form-buttons,
body .em-booking-form-footer {
    z-index: 1 !important;
    position: relative !important;
}

/* FIX: Force the EM booking submit button to sit BEHIND the share popup. */
body .em-booking-form-section-confirm input[type="submit"],
body .em-booking-form-section-confirm button {
    position: relative !important;
    z-index: 1 !important;
}

/* Inline variant: full-size primary button, used on booking form and
 * booking confirmation page. Matches Kadence .button.button-primary. */
a.aibus-share-button--inline {
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.6 !important;
    letter-spacing: normal !important;
    padding: 4px 30px !important;
    height: auto !important;
}

/* Compact variant: small pill, used inside the departure board action column.
 * Same visual weight as the adjacent [Book] link. */
a.aibus-share-button--compact {
    font-weight: 700 !important;
    font-size: 14px !important;
    line-height: 1 !important;
    letter-spacing: 0.05em !important;
    border-radius: 3px !important;
    padding: 0 !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    display: block !important;
    overflow: hidden !important;
    width: 100% !important;
    position: relative !important;
    text-align: center !important;
    border: none !important;
    box-sizing: border-box !important;
}

/* Hard-lock the "Share" text position using absolute centering.
 * We use a fixed top offset and line-height to kill any baseline movement. */
.aibus-share-kit .aibus-share-button::before {
    content: "Share";
    position: absolute !important;
    top: 3px !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    display: block !important;
    line-height: 14px !important;
    text-align: center !important;
    width: 100% !important;
    height: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 10 !important;
}

/* Wrapper for compact button (required by AddToAny kit) */
.aibus-share-kit {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: 10px !important;
    height: 20px !important;
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    vertical-align: middle !important;
}

/* Hide all AddToAny injected children, show only our "Share" via ::before */
.aibus-share-kit .aibus-share-button *,
.aibus-share-kit .aibus-share-button *::before,
.aibus-share-kit .aibus-share-button *::after {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

/* ==========================================================================
   Share button wrapper — inline row with trailing text.
   ========================================================================== */

.aibus-ride-with-friends {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px 0;
    margin: 0;
}

/* Booking form variant: align with the full-width submit button above and
 * keep the trailing text vertically centred with the Share button. */
.em-booking-form-section-confirm .aibus-ride-with-friends {
    align-items: center;
    padding-top: 25px !important;
    padding-bottom: 0 !important;
}

.aibus-ride-with-friends .aibus-share-button {
    flex-shrink: 0;
}

.aibus-ride-with-friends .aibus-share-text {
    display: inline;
    line-height: 1.6;
    vertical-align: middle;
    margin: 0;
    padding: 0;
}

/* On the confirmation page the Share row should look like a normal paragraph,
 * left-aligned with the rest of the confirmation block. */
.aibus-booking-confirmed .aibus-ride-with-friends {
    justify-content: flex-start;
    padding-left: 0;
    padding-right: 0;
}
