/**
 * Seamless event view shortcodes
 *
 * Styles for [seamless_event_list_view] and [seamless_event_grid_view].
 * All rules are scoped under the shortcode wrapper so they override the
 * generic .event-* rules shipped in dist/css/seamless.css and stay isolated
 * from the JS-driven event widgets.
 *
 * The accent colour is sourced from the plugin's dynamic CSS variables
 * (set by SeamlessRender::enqueue_dynamic_styles), with a sensible fallback.
 */

.seamless-event-list-view,
.seamless-event-grid-view {
    --seamless-event-view-color: var(--seamless-primary-color, #26337a);
    --seamless-event-view-divider: var(--seamless-secondary-color, #2a8a9e);
    font-family: var(--seamless-font-family, var(--wp--preset--font-family--body, var(--wp--preset--font-family--system-font, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)));
}

/* Keep every text element on the same theme font (titles are <h3> and would
   otherwise inherit the theme's heading font, diverging from the dates). */
.seamless-event-list-view .event-title,
.seamless-event-list-view .event-title-link,
.seamless-event-list-view .event-date,
.seamless-event-list-view .event-time-range,
.seamless-event-grid-view .event-title,
.seamless-event-grid-view .event-title-link,
.seamless-event-grid-view .event-date,
.seamless-event-grid-view .event-time-range,
.seamless-event-grid-view .event-venue {
    font-family: inherit;
}

/* ─────────────────────────────  List view  ───────────────────────────── */

.seamless-event-list-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0;
}

.seamless-event-list-view .seamless-event-list-item {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--seamless-event-view-divider);
}

.seamless-event-list-view .seamless-event-list-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.seamless-event-list-view .event-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 3px;
    padding: 0;
}

.seamless-event-list-view .event-title .seamless-event-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 3px;
    color: var(--seamless-event-view-color);
}

.seamless-event-list-view .event-title-link {
    font-size: 16px;
    line-height: 21px;
    font-weight: 600;
    color: var(--seamless-event-view-color);
    text-decoration: none;
}

.seamless-event-list-view .event-title-link:hover {
    text-decoration: underline;
    font-weight: 600;
}

/* Align the date block with the title text (icon width + gap). */
.seamless-event-list-view .event-time-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 26px;
}

.seamless-event-list-view .event-date,
.seamless-event-list-view .event-time-range {
    margin: 0;
    font-size: 14px;
    line-height: 21px;
    font-weight: 400;
    color: var(--seamless-event-view-color);
}

/* ─────────────────────────────  Grid view  ───────────────────────────── */

/* Shadow-DOM-like isolation barrier: roll every theme/Elementor declaration
   inside the grid back to the browser defaults, then re-apply the grid's own
   styles below with !important so nothing outside this file can override
   them. `all` deliberately excludes CSS custom properties, so the dynamic
   --seamless-* colors set on :root still cascade in. Inline styles in the
   template (the hidden-until-loaded images) also survive the revert. */
.seamless-event-grid-view,
.seamless-event-grid-view * {
    all: revert;
}

.seamless-event-grid-view,
.seamless-event-grid-view *,
.seamless-event-grid-view *::before,
.seamless-event-grid-view *::after {
    box-sizing: border-box !important;
}

.seamless-event-grid-view {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: var(--seamless-font-family, var(--wp--preset--font-family--body, var(--wp--preset--font-family--system-font, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif))) !important;
}

.seamless-event-grid-view .event-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    margin: 0 !important;
    padding: 28px 24px !important;
    background: #fff !important;
    border: 1px solid var(--seamless-event-view-color) !important;
    border-radius: 14px !important;
    box-shadow: none !important;
}

.seamless-event-grid-view .event-link {
    display: block !important;
    width: 100% !important;
    text-decoration: none !important;
    border: 0 !important;
}

.seamless-event-grid-view .image-container {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 0 0 18px !important;
}

.seamless-event-grid-view .event-image {
    max-width: 100% !important;
    max-height: 105px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border: 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

.seamless-event-grid-view .loader {
    position: absolute !important;
    width: 28px !important;
    height: 28px !important;
    border: 3px solid rgba(38, 51, 122, 0.2) !important;
    border-top-color: var(--seamless-event-view-color) !important;
    border-radius: 50% !important;
    animation: seamless-event-view-spin 0.8s linear infinite !important;
}

@keyframes seamless-event-view-spin {
    to {
        transform: rotate(360deg);
    }
}

.seamless-event-grid-view .event-details {
    width: 100% !important;
}

.seamless-event-grid-view .event-title {
    margin: 0 0 12px !important;
    padding: 0 !important;
    font-family: inherit !important;
    font-size: 20px !important;
    line-height: 25px !important;
}

.seamless-event-grid-view .event-title-link {
    font-family: inherit !important;
    font-size: 20px !important;
    line-height: 25px !important;
    font-weight: 700 !important;
    color: var(--seamless-event-view-color) !important;
    text-decoration: none !important;
    border: 0 !important;
}

.seamless-event-grid-view .event-title-link:hover {
    text-decoration: underline !important;
    color: var(--seamless-event-view-color) !important;
    font-weight: 700 !important;
}

.seamless-event-grid-view .event-time-details {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

.seamless-event-grid-view .event-date {
    margin: 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
    font-size: 19px !important;
    line-height: 24px !important;
    font-weight: 600 !important;
    color: var(--seamless-event-view-color) !important;
}

.seamless-event-grid-view .event-time-range {
    margin: 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 18px !important;
    font-weight: 500 !important;
    color: var(--seamless-event-view-color) !important;
    opacity: 0.85 !important;
}

.seamless-event-grid-view .event-venue {
    margin: 4px 0 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 18px !important;
    font-weight: 500 !important;
    color: var(--seamless-event-view-color) !important;
}

/* Empty-state message should span the full grid width. */
.seamless-event-grid-view > p {
    grid-column: 1 / -1 !important;
}

/* ─────────────────────────────  Responsive  ──────────────────────────── */

@media (max-width: 600px) {
    .seamless-event-grid-view {
        grid-template-columns: 1fr;
    }
}
