/*!
 * OnTime event lists (v1.1.0)
 * Used by [upcoming_events], [upcoming_grouped_events], [past_events], [past_grouped_events].
 * Everything is scoped to .ot-events (and to tab blocks that contain it), so the
 * rest of the site is unaffected.
 */

/* ------------------------------------------------------------------ tokens */
.ot-events {
    --ot-navy: #294b67;
    --ot-navy-dark: #1d374c;
    --ot-yellow: #ffb803;
    --ot-yellow-hover: #ffc633;
    --ot-yellow-border: #f0ab00;
    --ot-red: #dc3545;
    --ot-red-hover: #bb2d3b;
    --ot-text: #1f2933;
    --ot-muted: #687385;
    --ot-border: #e4e7eb;
    --ot-border-strong: #d1d5db;
    --ot-surface: #ffffff;
    --ot-soft: #f5f6f8;
    --ot-focus: rgba(41, 75, 103, 0.35);
    --ot-radius: 14px;
    --ot-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.05);
    --ot-shadow-hover: 0 6px 16px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.04);
    --ot-media: 72px;

    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
    color: var(--ot-text);
    font-size: 15px;
    line-height: 1.45;
}

.ot-events *,
.ot-events *::before,
.ot-events *::after {
    box-sizing: border-box;
}

.ot-events .ot-icon {
    width: 1em;
    height: 1em;
    flex: none;
    fill: currentColor;
}

/* ------------------------------------------------------------------ search */
.ot-events .ot-search {
    position: relative;
    max-width: 480px;
    margin: 0 0 18px;
}

.ot-events .ot-search > .ot-icon {
    position: absolute;
    top: 50%;
    left: 16px;
    width: 18px;
    height: 18px;
    color: var(--ot-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.ot-events .ot-search__input {
    display: block;
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 18px 0 44px;
    font: inherit;
    font-size: 16px; /* 16px stops iOS from zooming in on focus */
    color: var(--ot-text);
    background: var(--ot-surface);
    border: 1px solid var(--ot-border-strong);
    border-radius: 999px;
    box-shadow: var(--ot-shadow);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ot-events .ot-search__input::placeholder {
    color: #8b95a3;
    opacity: 1;
}

.ot-events .ot-search__input:hover {
    border-color: #bfc5ce;
}

.ot-events .ot-search__input:focus {
    outline: none;
    border-color: var(--ot-navy);
    box-shadow: 0 0 0 3px var(--ot-focus);
}

.ot-events .ot-search__input::-webkit-search-cancel-button {
    cursor: pointer;
}

/* ------------------------------------------------------------------ list */
.ot-events .ot-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    transition: opacity 0.2s ease;
}

.ot-events .ot-list[aria-busy="true"] {
    opacity: 0.5;
}

.ot-events .ot-list--compact {
    gap: 8px;
}

/* ------------------------------------------------------------------ card */
.ot-events .ot-card {
    display: grid;
    grid-template-columns: var(--ot-media) minmax(0, 1fr) auto;
    grid-template-areas: "media body actions";
    align-items: center;
    column-gap: 16px;
    row-gap: 12px;
    margin: 0;
    padding: 14px 16px;
    background: var(--ot-surface);
    border: 1px solid var(--ot-border);
    border-radius: var(--ot-radius);
    box-shadow: var(--ot-shadow);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.ot-events .ot-card:hover {
    border-color: var(--ot-border-strong);
    box-shadow: var(--ot-shadow-hover);
}

/* logo */
.ot-events .ot-card__media {
    grid-area: media;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ot-media);
    height: var(--ot-media);
    padding: 5px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--ot-border);
    border-radius: 12px;
    text-decoration: none;
}

.ot-events .ot-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    object-fit: contain;
    border-radius: 6px;
}

.ot-events .ot-card__ph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #b3bcc8;
    background: var(--ot-soft);
    border-radius: 8px;
}

.ot-events .ot-card__ph .ot-icon {
    width: 46%;
    height: 46%;
}

/* text */
.ot-events .ot-card__body {
    grid-area: body;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.ot-events .ot-card__date {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ot-muted);
}

.ot-events .ot-card__date .ot-icon {
    width: 14px;
    height: 14px;
    opacity: 0.85;
}

.ot-events .ot-card__title {
    margin: 0;
    padding: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    color: var(--ot-text);
    overflow-wrap: anywhere;
}

.ot-events .ot-card__title > a:first-child {
    color: inherit;
    text-decoration: none;
}

.ot-events .ot-card__title > a:first-child:hover {
    color: var(--ot-navy);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

.ot-events .ot-live {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
    vertical-align: middle;
    white-space: nowrap;
    color: #fff;
    background: #e53935;
    border-radius: 999px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.ot-events .ot-live:hover {
    color: #fff;
    background: #c62828;
}

/* status + participants */
.ot-events .ot-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin-top: 5px;
}

.ot-events .ot-status {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 3px 11px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: 999px;
}

.ot-events .ot-status--open         { color: #136b40; background: #e7f6ee; border-color: #c4e8d4; }
.ot-events .ot-status--closing-soon { color: #855700; background: #fff5d6; border-color: #fbe2a0; }
.ot-events .ot-status--closed       { color: #a12733; background: #fdecee; border-color: #f5cbd0; }
.ot-events .ot-status--not-started  { color: #364657; background: #eef2f7; border-color: #d9e1ea; }
.ot-events .ot-status--in-progress  { color: #1d4fbf; background: #e8f0fe; border-color: #c8daf9; }
.ot-events .ot-status--ended        { color: #4b5563; background: #f1f2f4; border-color: #e1e4e8; }
.ot-events .ot-status--external     { color: #334155; background: #eef1f5; border-color: #d8dee6; }

.ot-events .ot-entries {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 17px;
    line-height: 1.2;
    color: var(--ot-navy);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ot-events .ot-entries .ot-icon {
    width: 21px;
    height: 21px;
}

.ot-events .ot-entries strong {
    font-weight: 800;
}

/* ------------------------------------------------------------------ buttons */
.ot-events .ot-card__actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.ot-events .ot-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 116px;
    height: 40px;
    margin: 0;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ot-events .ot-btn--details {
    color: var(--ot-navy);
    background: var(--ot-yellow);
    border-color: var(--ot-yellow-border);
}

.ot-events .ot-btn--details:hover {
    color: var(--ot-navy-dark);
    background: var(--ot-yellow-hover);
}

.ot-events .ot-btn--results {
    color: #fff;
    background: var(--ot-red);
    border-color: var(--ot-red);
}

.ot-events .ot-btn--results:hover {
    color: #fff;
    background: var(--ot-red-hover);
    border-color: var(--ot-red-hover);
}

.ot-events .ot-btn:active {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12);
}

.ot-events a:focus-visible,
.ot-events select:focus-visible {
    outline: 3px solid var(--ot-focus);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ compact (Kalendar tabs) */
.ot-events .ot-card--compact {
    --ot-media: 52px;
    column-gap: 14px;
    padding: 10px 14px;
    border-radius: 12px;
}

.ot-events .ot-card--compact .ot-card__media {
    padding: 4px;
    border-radius: 10px;
}

.ot-events .ot-card--compact .ot-card__title {
    font-size: 16px;
}

.ot-events .ot-card--compact .ot-btn {
    min-width: 104px;
    height: 36px;
    font-size: 14px;
}

/* ------------------------------------------------------------------ year / month headers */
.ot-events .ot-year + .ot-year {
    margin-top: 32px;
}

.ot-events .ot-year__title {
    margin: 0;
    padding: 0;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--ot-text);
}

.ot-events .ot-month {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 10px;
    padding: 0;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ot-navy);
}

.ot-events .ot-month::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--ot-border);
}

.ot-events .ot-year__title + .ot-month {
    margin-top: 12px;
}

/* ------------------------------------------------------------------ year picker */
.ot-events .ot-year-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin: 0 0 22px;
}

.ot-events .ot-year-picker__label {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ot-text);
}

.ot-events .ot-select {
    position: relative;
    display: inline-block;
}

.ot-events .ot-select::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 18px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--ot-navy);
    border-bottom: 2px solid var(--ot-navy);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.ot-events .ot-select select {
    height: 44px;
    min-width: 128px;
    margin: 0;
    padding: 0 46px 0 20px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--ot-text);
    background: var(--ot-surface);
    border: 1px solid var(--ot-border-strong);
    border-radius: 999px;
    box-shadow: var(--ot-shadow);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ot-events .ot-select select:hover {
    border-color: #bfc5ce;
}

.ot-events .ot-select select:focus {
    outline: none;
    border-color: var(--ot-navy);
    box-shadow: 0 0 0 3px var(--ot-focus);
}

/* ------------------------------------------------------------------ pagination */
.ot-events .ot-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 28px 0 0;
}

.ot-events .ot-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 15px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    color: var(--ot-text);
    background: var(--ot-surface);
    border: 1px solid var(--ot-border-strong);
    border-radius: 999px;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ot-events .ot-page:hover {
    color: var(--ot-text);
    background: var(--ot-soft);
    border-color: #bfc5ce;
}

.ot-events .ot-page.is-active {
    color: #fff;
    background: var(--ot-navy);
    border-color: var(--ot-navy);
    cursor: default;
}

/* ------------------------------------------------------------------ empty state */
.ot-events .ot-empty {
    margin: 4px 0 0;
    padding: 32px 16px;
    font-size: 15px;
    text-align: center;
    color: var(--ot-muted);
    background: var(--ot-soft);
    border: 1px dashed var(--ot-border-strong);
    border-radius: var(--ot-radius);
}

/* ------------------------------------------------------------------ Lista / Kalendar tabs
 * Only tab blocks that contain an event list are restyled. The theme styles
 * these with !important, so the overrides need it too. */
body .gutena-tabs-block:has(.ot-events) > .gutena-tabs-tab {
    display: flex !important;
    gap: 4px !important;
    width: 100% !important;
    max-width: 360px !important;
    margin: 0 auto 12px !important;
    padding: 4px !important;
    list-style: none !important;
    background: #eceef2 !important;
    border: 1px solid #e1e4e9 !important;
    border-radius: 999px !important;
    overflow: visible !important;
}

body .gutena-tabs-block:has(.ot-events) > .gutena-tabs-tab > .gutena-tab-title {
    display: flex !important;
    flex: 1 1 0 !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 16px !important;
    color: #4b5563 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 999px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease !important;
}

body .gutena-tabs-block:has(.ot-events) > .gutena-tabs-content > .gutena-tab-block {
    padding-top: 8px !important;
}

body .gutena-tabs-block:has(.ot-events) > .gutena-tabs-tab > .gutena-tab-title * {
    padding: 0 !important;
    margin: 0 !important;
    font: inherit !important;
    color: inherit !important;
}

body .gutena-tabs-block:has(.ot-events) > .gutena-tabs-tab > .gutena-tab-title.active {
    color: #294b67 !important;
    background: #fff !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 1px 4px rgba(16, 24, 40, 0.08) !important;
}

body .gutena-tabs-block:has(.ot-events) > .gutena-tabs-tab > .gutena-tab-title.inactive:hover {
    color: #1f2933 !important;
    background: rgba(255, 255, 255, 0.6) !important;
}

/* ------------------------------------------------------------------ phones */
@media (max-width: 680px) {
    .ot-events {
        --ot-media: 56px;
    }

    .ot-events .ot-search {
        max-width: none;
    }

    .ot-events .ot-card {
        grid-template-columns: var(--ot-media) minmax(0, 1fr);
        grid-template-areas:
            "media body"
            "actions actions";
        align-items: start;
        column-gap: 12px;
        padding: 12px;
    }

    .ot-events .ot-card__title {
        font-size: 16px;
    }

    /* Buttons sit in a row under the text, right-aligned, sized to their label.
       Detalji is always the last one, so it stays in the same corner on every card. */
    .ot-events .ot-card__actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: -2px;
    }

    .ot-events .ot-btn,
    .ot-events .ot-card--compact .ot-btn {
        min-width: 100px;
        height: 38px;
        padding: 0 18px;
        font-size: 14px;
    }

    .ot-events .ot-card--compact {
        --ot-media: 48px;
        padding: 10px 12px;
        row-gap: 10px;
    }

    .ot-events .ot-year__title {
        font-size: 22px;
    }

    /* Tighter outer gutters so cards use the screen: 9px (page) + 7px = 16px */
    body .gutena-tabs-block:has(.ot-events) > .gutena-tabs-content > .gutena-tab-block {
        padding-left: 7px !important;
        padding-right: 7px !important;
    }

    body .gutena-tabs-block:has(.ot-events) > .gutena-tabs-tab {
        width: auto !important;
        max-width: none !important;
        margin: 0 7px 12px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ot-events *,
    body .gutena-tabs-block:has(.ot-events) > .gutena-tabs-tab > .gutena-tab-title {
        transition: none !important;
    }
}
