/* =============================================
   Events Shortcode Styles
   WCAG AA | Responsive | ID-scoped, no !important
   ============================================= */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Wrapper ───────────────────────────────── */
.ec-wrap {
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
}

/* ── Filter Bar ────────────────────────────── */
.ec-wrap .ec-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* ── Tabs Container ────────────────────────── */
/* ID used: [instance_id]-tabs  e.g. #ec-abc123-tabs */
[id$="-tabs"] {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    background: transparent;
    padding: 0;
    margin: 0;
}

/* ── Tab Buttons ───────────────────────────── */
/* Triple ID+element specificity beats Elementor without !important */
[id$="-tabs"] button.ec-tab {
    all: unset;
    font-size: 20px;
    font-weight: 400;
    color: #3C3C3C;
    cursor: pointer;
    padding: 15px 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    transition: color 0.2s ease;
    line-height: 1.4;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: normal;
}

[id$="-tabs"] button.ec-tab:hover {
    color: var(--e-global-color-text);
    background: transparent;
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
}

[id$="-tabs"] button.ec-tab:focus {
    background: transparent;
    background-color: transparent;
    box-shadow: none;
}

[id$="-tabs"] button.ec-tab:focus-visible {
    outline: 3px solid var(--e-global-color-primary);
    outline-offset: 3px;
    border-radius: 2px;
}

[id$="-tabs"] button.ec-tab.active {
    color: var(--e-global-color-text);
    font-weight: 500;
    background: transparent;
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    border-bottom: 3px solid var(--e-global-color-accent);
    border-radius: 0;
	position:relative;
}

[id$="-tabs"] button.ec-tab.active:after {
    content: "";
    position: absolute;
    bottom: -13px;
    left: 0;
    right: 0;
    margin: auto;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid var(--e-global-color-accent);
}

[id$="-tabs"] button.ec-tab.active:hover {
    background: transparent;
    background-color: transparent;
    border-bottom: 3px solid var(--e-global-color-accent);
}

/* ── Divider ───────────────────────────────── */
.ec-wrap .ec-divider {
    width: 100%;
    height: 1px;
    background-color: #e0e0e0;
    margin-bottom: 30px;
	margin-top:-2px;
}

/* ── Category Dropdown Wrap ────────────────── */
[id$="-cat-wrap"] {
    position: relative;
    flex-shrink: 0;
}

/* ── Category Button ───────────────────────── */
[id$="-cat-btn"] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--e-global-color-primary) !important;
    justify-content: space-between;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(26, 107, 90, 0.2);
    line-height: normal;
    user-select: none;
    border-color: var(--e-global-color-primary) !important;
	padding: 12px 30px !important;
}

[id$="-cat-btn"]:hover {
    background-color: #155a4a;
    box-shadow: 0 4px 14px rgba(26, 107, 90, 0.3);
}

[id$="-cat-btn"]:focus-visible {
    outline: 3px solid var(--e-global-color-primary);
    outline-offset: 3px;
    border-radius: 30px;
}

.ec-cat-btn-label {
    flex: 1;
    text-align: left;
}

.ec-cat-btn-icon {
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

/* ── Dropdown Panel ────────────────────────── */
[id$="-cat-dropdown"] {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    margin: 0;
    list-style: none;
    z-index: 999;
    border: 1px solid #eeeeee;
    overflow: hidden;
}

[id$="-cat-dropdown"] .ec-cat-option {
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    box-sizing: border-box;
}

[id$="-cat-dropdown"] .ec-cat-option:hover {
    background-color: #f0f9f7;
    color: #1a6b5a;
}

[id$="-cat-dropdown"] .ec-cat-option.active {
    color: #1a6b5a;
    font-weight: 600;
    background-color: #f0f9f7;
}

[id$="-cat-dropdown"] .ec-cat-option.active::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #1a6b5a;
    flex-shrink: 0;
}

[id$="-cat-dropdown"] .ec-cat-option:not(.active)::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    flex-shrink: 0;
}

[id$="-cat-dropdown"] .ec-cat-option:focus-visible {
    outline: 2px solid #1a6b5a;
    outline-offset: -2px;
    background-color: #f0f9f7;
}

/* ── Loader ────────────────────────────────── */
.ec-wrap .ec-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.ec-wrap .ec-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #1a6b5a;
    border-radius: 50%;
    animation: ec-spin 0.8s linear infinite;
}

@keyframes ec-spin {
    to { transform: rotate(360deg); }
}

/* ── Grid ──────────────────────────────────── */
[id$="-grid"] {
    display: grid;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ec-wrap .ec-grid-col-1 { grid-template-columns: 1fr; }
.ec-wrap .ec-grid-col-2 { grid-template-columns: repeat(2, 1fr); }
.ec-wrap .ec-grid-col-3 { grid-template-columns: repeat(3, 1fr); }
.ec-wrap .ec-grid-col-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Event Card ────────────────────────────── */
[id$="-grid"] .event-card {
    background: #ffffff;
    border: 1px solid var(--e-global-color-cdbb471);
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 10px;
}

[id$="-grid"] .event-card:focus-within {
    outline: 3px solid #1a6b5a;
    outline-offset: 2px;
}

/* ── Card Image ────────────────────────────── */
[id$="-grid"] .event-card__image-wrap {
    width: 100%;
    overflow: hidden;
    border-radius: 15px;
    flex-shrink: 0;
    aspect-ratio: 3/2;
}

[id$="-grid"] .event-card__image-wrap a {
    display: block;
    width: 100%;
    height: 100%;
}

[id$="-grid"] .event-card__image-wrap a:focus-visible {
    outline: 3px solid #1a6b5a;
    outline-offset: -3px;
}

[id$="-grid"] .event-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

[id$="-grid"] .event-card__image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8f4f1 0%, #c8e6e0 100%);
}

/* ── Card Body ─────────────────────────────── */
[id$="-grid"] .event-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 5px;
    box-sizing: border-box;
}

/* ── Title ─────────────────────────────────── */
[id$="-grid"] .event-card__title {
    font-size: 20px;
    font-weight: 500;
    margin: 0 0 4px;
    line-height: 1.3;
}

[id$="-grid"] .event-card__title a {
    text-decoration: none;
    color: var(--e-global-color-text);
}

[id$="-grid"] .event-card:hover {
    background: var(--e-global-color-75fdb4c);
}

[id$="-grid"] .event-card__title a:hover {
    text-decoration: underline;
}

[id$="-grid"] .event-card__title a:focus-visible {
    outline: 3px solid var(--e-global-color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ── Meta ──────────────────────────────────── */
[id$="-grid"] .event-card__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    justify-content: space-between;
}

[id$="-grid"] .event-card__meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

[id$="-grid"] .event-card__meta-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

[id$="-grid"] .event-card__meta-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

[id$="-grid"] .event-card__category {
    font-size: 16px;
    font-weight: 500;
    color: #333333;
    text-decoration: none;
    transition: color 0.2s;
}

[id$="-grid"] .event-card__category:hover {
    color: #1a6b5a;
    text-decoration: underline;
}

[id$="-grid"] .event-card__category:focus-visible {
    outline: 3px solid var(--e-global-color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

[id$="-grid"] .event-card__date {
    font-size: 16px;
    font-weight: 500;
    color: #333333;
}

/* ── View Details Button ───────────────────── */
[id$="-grid"] .event-card__btn {
    display: block;
    text-align: center;
    background-color: transparent;
    color: #333333;
    border: 1.5px solid #cccccc;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    margin-top: auto;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    min-height: 44px;
    line-height: 1.4;
    cursor: pointer;
    box-sizing: border-box;
}

[id$="-grid"] .event-card__btn:hover {
    background-color: var(--e-global-color-accent, #e07b2a);
    color: #ffffff;
    border-color: var(--e-global-color-accent, #e07b2a);
    text-decoration: none;
}

[id$="-grid"] .event-card__btn:focus-visible {
    outline: 3px solid var(--e-global-color-accent, #e07b2a);
    outline-offset: 3px;
    border-radius: 25px;
}

/* ── No Results ────────────────────────────── */
.ec-wrap .ec-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666666;
    font-size: 16px;
    grid-column: 1 / -1;
}

/* ── Load More ─────────────────────────────── */
[id$="-loadmore-wrap"] {
    text-align: center;
    margin-top: 40px;
    padding-bottom: 20px;
}

[id$="-loadmore"] {
    background-color: var(--e-global-color-accent, #e07b2a);
    color: #ffffff;
    border: 2px solid var(--e-global-color-accent, #e07b2a);
    border-radius: 25px;
    padding: 14px 50px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    min-height: 44px;
    line-height: 1.4;
    box-shadow: none;
}

[id$="-loadmore"]:hover {
    background-color: #c96a1a;
    border-color: #c96a1a;
}

[id$="-loadmore"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 1024px) {
    .ec-wrap .ec-grid-col-3,
    .ec-wrap .ec-grid-col-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .ec-wrap .ec-filter-bar { flex-direction: column; align-items: flex-start; gap: 14px; }
    [id$="-tabs"] { gap: 16px; width: 100%; }
    [id$="-tabs"] button.ec-tab { font-size: 16px; }
    [id$="-cat-wrap"] { width: 100%; }
    [id$="-cat-btn"] { width: 100%; }
    [id$="-cat-dropdown"] { right: auto; left: 0; width: 100%; }
    .ec-wrap .ec-grid-col-2,
    .ec-wrap .ec-grid-col-3,
    .ec-wrap .ec-grid-col-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .ec-wrap .ec-grid-col-1,
    .ec-wrap .ec-grid-col-2,
    .ec-wrap .ec-grid-col-3,
    .ec-wrap .ec-grid-col-4 { grid-template-columns: 1fr; }
    [id$="-tabs"] button.ec-tab { font-size: 14px; }
    [id$="-loadmore"] { width: 100%; padding: 14px 20px; }
}

/* ── High contrast (WCAG) ──────────────────── */
@media (forced-colors: active) {
    [id$="-tabs"] button.ec-tab.active { border-bottom: 3px solid ButtonText; }
    [id$="-grid"] .event-card { border: 1px solid ButtonText; }
    [id$="-grid"] .event-card__btn,
    [id$="-loadmore"],
    [id$="-cat-btn"] { border: 2px solid ButtonText; }
}

/* ── Reduced motion (WCAG) ─────────────────── */
@media (prefers-reduced-motion: reduce) {
    [id$="-grid"] .event-card,
    [id$="-grid"] .event-card__image,
    [id$="-tabs"] button.ec-tab,
    [id$="-grid"] .event-card__btn,
    [id$="-loadmore"],
    [id$="-cat-btn"],
    .ec-cat-btn-icon { transition: none; }
    .ec-spinner { animation: none; }
}