/**
 * Single Event template — visibility helpers only.
 *
 * All visual styling for the event single lives in Elementor (the template was
 * cloned from the designed page #3741). This file only:
 *   1. Hides whole blocks when their per-post ACF enable/disable toggle is OFF
 *      (functions.php adds an `ev-hide-*` body class when the boolean is false).
 *   2. Empty-hides a Date/Time/Venue meta item, or an Event-Details row, when
 *      its value field is blank — Elementor drops a heading whose dynamic value
 *      is empty, so the value heading (tagged `event-*-val`) disappears and the
 *      row/item is hidden, leaving no dangling label.
 *   3. Styles the "Copy link" button that event-single.js injects into the
 *      Spread the Word share row (the Elementor share-buttons widget has no
 *      copy-link option).
 */

/* ── 1. Per-block enable / disable (default = shown) ───────────────────────── */
.ev-hide-register   .event-block-register,
.ev-hide-share      .event-block-share,
.ev-hide-newsletter .event-sec-newsletter {
    display: none !important;
}

/* ── 2. Empty-hide ─────────────────────────────────────────────────────────── */
/* top meta row: Date / Time / Venue item hides when its value is empty */
.aaps-single-event .event-meta-item:not(:has(.event-meta-val)) {
    display: none !important;
}
/* Event Details tab: a label+value row hides when its value is empty */
.aaps-single-event .event-detail-row:not(:has(.event-detail-val)) {
    display: none !important;
}

/* ── 3. Spread the Word: "Copy link" button ────────────────────────────────
   event-single.js injects it as the FIRST item in the share row: a labelled
   pill (copy icon + "Copy link") matching the social icons' bordered look
   (the widget's custom CSS gives each icon a 1px #D5D7DA border, 8px radius,
   40px height). The widget renders a 3-column .elementor-grid; with a 4th
   item that grid would wrap, so switch it to a flex row (keeping the widget's
   12px gap). */
.aaps-single-event .event-block-share .elementor-widget-share-buttons .elementor-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
/* Desktop: the share column is squeezed to ~140px by the fixed-width heading
   column beside it, which would wrap the 4 buttons into 3 rows. Let the column
   size to its content (the heading column has flex-shrink so it gives way) and
   keep all 4 buttons on one right-aligned line, per the design. */
@media (min-width: 768px) {
    .aaps-single-event .event-block-share > .e-con:has(.elementor-widget-share-buttons) {
        width: auto;
        flex: 0 0 auto;
    }
    .aaps-single-event .event-block-share .elementor-widget-share-buttons .elementor-grid {
        flex-wrap: nowrap;
        justify-content: flex-end;
    }
}
.aaps-single-event .event-block-share .elementor-widget-share-buttons .elementor-grid-item {
    width: auto !important;
    margin: 0 !important;
}

/* The pill itself. !important on box/colour props because two global rules
   target a bare <button> and would otherwise win: the parent theme's reset
   (theme.css: [type="button"]:hover/:focus → #c36 bg + white text — same
   attribute-selector specificity but loaded after this file) and the snippet
   #98 reset (.elementor-share-buttons--view-icon button{padding:0;border:none}). */
.aaps-single-event .event-copy-link,
.aaps-single-event .event-copy-link:hover,
.aaps-single-event .event-copy-link:focus,
.aaps-single-event .event-copy-link:active {
    background: #fff !important;
    color: #414651 !important;
    text-decoration: none !important;
}
.aaps-single-event .event-copy-link:hover,
.aaps-single-event .event-copy-link:focus {
    background: #FAFAFA !important;
}
.aaps-single-event .event-copy-link {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    height: 40px;
    padding: 0 16px !important;
    border: 1px solid #D5D7DA !important;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    position: relative;
    overflow: visible; /* the tooltip can overflow without widening the box */
}
.aaps-single-event .event-copy-link__icon {
    display: inline-flex;
    flex: 0 0 auto;
}
.aaps-single-event .event-copy-link__icon svg {
    width: 20px;
    height: 20px;
    display: block;
}
.aaps-single-event .event-copy-link:focus-visible {
    outline: 2px solid #1F78D1;
    outline-offset: 2px;
}

/* "Copied!" tooltip */
.aaps-single-event .event-copy-link__tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #181D27;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}
.aaps-single-event .event-copy-link.is-copied .event-copy-link__tip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Mobile: the copy-link pill stretches to fill the row's leftover width
   (per the design), the social squares keep their size. */
@media (max-width: 767px) {
    .aaps-single-event .event-block-share .elementor-widget-share-buttons .event-copy-link-item {
        flex: 1 1 auto;
    }
    .aaps-single-event .event-copy-link {
        width: 100%;
    }
}
