/**
 * THELOGE EVENTS WIDGET — theloge-events.css
 *
 * Covers:
 *   - CSS custom properties (design tokens + JS-readable values)
 *   - Slider: viewport, track, slides, arrows, dots, equal-height
 *   - Grid: layout, cards, images, skeletons, equal-height
 *   - Status badges, CTA buttons, section headings
 *   - Shimmer skeleton animation
 *   - Loading spinner
 *   - Responsive overrides (tablet 900 / mobile 600)
 *
 * RESPONSIVE SIZING NOTE:
 *   --tlev-slides-per-view and --tlev-slide-gap are set as inline styles
 *   on .tlev-events-wrap by Elementor's responsive controls at each
 *   breakpoint. These are read by JS at runtime to compute px slide widths.
 *   The CSS values below are fallbacks for when Elementor has not yet
 *   applied inline styles (e.g. skeleton phase, no-JS).
 *
 * @package Theloge Addon
 */

/* ============================================================
 * CUSTOM PROPERTIES (design tokens)
 * ============================================================ */
.tlev-events-wrap {
    /* Slider responsive sizing — JS reads these at runtime.
       Elementor responsive controls overwrite them via inline style.
       1.5 = centre slide + half-slide peeking on each side (default peek).  */
    --tlev-slides-per-view: 1.5;
    --tlev-slide-gap:       24px;

    /* Colours */
    --tlev-gold:            #CF9D42;
    --tlev-gold-dark:       #b8893a;
    --tlev-teal:            #5aacaa;
    --tlev-dark:            #0E1115;
    --tlev-text:            #111111;
    --tlev-muted:           #6b7280;
    --tlev-border:          #e5e7eb;
    --tlev-white:           #ffffff;
    --tlev-card-radius:     14px;

    /* Slider motion */
    --tlev-slide-transition: transform 0.46s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* Skeleton shimmer */
    --tlev-shimmer-from:    #e8e8e8;
    --tlev-shimmer-to:      #f5f5f5;

    box-sizing: border-box;
}

/* ============================================================
 * RESETS
 * ============================================================ */
.tlev-events-wrap *,
.tlev-events-wrap *::before,
.tlev-events-wrap *::after {
    box-sizing: inherit;
}

.tlev-events-wrap button {
    appearance: none;
    border:     none;
    background: none;
    cursor:     pointer;
    padding:    0;
    font:       inherit;
    line-height: 1;
}

/* ============================================================
 * SLIDER SECTION
 * ============================================================ */
.tlev-slider-section {
    background:  #0d0d0d;
    padding:     48px 0 64px;
    overflow:    hidden;
    width:       100%;
}

/* ── Section heading ─────────────────────────────────────── */
.tlev-section-heading {
    font-size:      0.75rem;
    font-weight:    600;
    letter-spacing: 0.18em;
    text-transform: normal;
    color:          rgba(255, 255, 255, 0.45);
    margin:         0 0 28px;
    /*padding:        0 6vw;*/
}
.tlev-section-heading--light {
    color: #3a3a3a;
}

/* ── Slider viewport: clips the track ───────────────────── */
.tlev-slider-viewport {
    position:   relative;
    width:      100%;
    overflow:   hidden;
}

/* ── Slider root: wraps track + arrows + dots ───────────── */
.tlev-slider-root {
    position: relative;
}

/* ── Equal-height mode (stamped by JS when enabled) ──────
   Stretches all slides to match the tallest one, so card
   bodies line up at the same baseline.                     */
.tlev-slider-root.tlev-slider--equal-height .tlev-slider-track {
    align-items: stretch;
}
.tlev-slider-root.tlev-slider--equal-height .tlev-slide {
    display:        flex;
    flex-direction: column;
}
.tlev-slider-root.tlev-slider--equal-height .tlev-slide-card {
    display:        flex;
    flex-direction: column;
    height:         100%;
}
.tlev-slider-root.tlev-slider--equal-height .tlev-slide-body {
    flex:           1 1 auto;
    display:        flex;
    flex-direction: column;
}
/* Push CTA button to the bottom in equal-height mode */
.tlev-slider-root.tlev-slider--equal-height .tlev-slide-body .tlev-btn {
    margin-top: auto;
}

/* ── Track ────────────────────────────────────────────────
   JS sets translateX for positioning.
   JS also stamps inline width on each slide (flex: 0 0 Xpx).   */
.tlev-slider-track {
    display:    flex;
    /* Gap is read by JS from --tlev-slide-gap. CSS gap mirrors it
       so layout is consistent before JS fires.                   */
    gap:        var(--tlev-slide-gap);
    transition: var(--tlev-slide-transition);
    will-change: transform;
    /* No padding-left — JS centres via translateX calculation.    */
}

/* ── Individual slide ────────────────────────────────────
   JS stamps flex / width / min-width / max-width as inline
   styles. CSS flex:0 0 auto ensures no flex-grow interference.  */
.tlev-slide {
    flex:           0 0 auto;
    min-width:      0;          /* prevent flex blowout */
    transition:     opacity    0.32s ease,
    box-shadow 0.32s ease;
    opacity:        0.42;
    position:       relative;
    z-index:        1;
    pointer-events: none;
}

.tlev-slide.is-active {
    opacity:        1;
    z-index:        2;
    pointer-events: auto;
}

/* ── Slide card (visual box) ─────────────────────────────── */
.tlev-slide-card {
    overflow:       hidden;
    background:     var(--tlev-white);
    transition:     transform 0.32s ease, box-shadow 0.32s ease;
    border: 1px solid #C2C8D0;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0px 4px 6px -1px rgba(10, 16, 25, 0.1);
}

.tlev-slide.is-active .tlev-slide-card {
    /*box-shadow: 0 8px 48px rgba(0, 0, 0, 0.32);*/
}

/* ── Slide image wrapper ──────────────────────────────────── */
.tlev-slide-img-wrap {
    position:    relative;
    width:       100%;
    aspect-ratio: 16 / 9;
    overflow:    hidden;
    background:  #1c1c1c;
    border-radius: 12px;
}

.tlev-slide-img-wrap img {
    position:   absolute;
    inset:      0;
    width:      100%;
    height:     100%;
    object-fit: cover;
    display:    block;
    transition: transform 0.36s ease;
}

.tlev-slide.is-active:hover .tlev-slide-img-wrap img {
    transform: scale(1.03);
}

/* Overlay pseudo-element (colour set via Elementor) */
.tlev-slide-img-wrap::after {
    content:    '';
    position:   absolute;
    inset:      0;
    pointer-events: none;
    transition: background 0.28s ease;
}

/* ── Slide date badge ────────────────────────────────────── */
.tlev-slide-date {
    position:       absolute;
    bottom:         14px;
    left:           16px;
    font-size:      0.65rem;
    font-weight:    700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color:          var(--tlev-white);
    background:     rgba(0, 0, 0, 0.58);
    padding:        4px 10px;
    border-radius:  4px;
    pointer-events: none;
}

/* ── Slide body ──────────────────────────────────────────── */
.tlev-slide-body {
    padding:        22px 24px 26px;
    background:     var(--tlev-white);
    display:        flex;
    flex-direction: column;
    gap:            10px;
}

/* ── Slide title ─────────────────────────────────────────── */
.tlev-slide-title {
    font-size:   1.1rem;
    font-weight: 700;
    line-height: 1.3;
    color:       var(--tlev-text);
    margin:      0;
}

/* ── Slide venue ─────────────────────────────────────────── */
.tlev-slide-venue {
    display:     flex;
    align-items: center;
    gap:         6px;
    font-size:   0.8rem;
    font-weight: 500;
    color:       var(--tlev-teal);
    margin:      0;
}

/* ── Slide description ───────────────────────────────────── */
.tlev-slide-desc {
    font-size:             0.83rem;
    line-height:           1.6;
    color:                 var(--tlev-muted);
    margin:                0;
    display:               -webkit-box;
    -webkit-box-orient:    vertical;
    -webkit-line-clamp:    3;
    overflow:              hidden;
}

/* ── Navigation arrows ───────────────────────────────────── */
.tlev-slider-prev,
.tlev-slider-next {
    position:       absolute;
    top:            40%;
    transform:      translateY(-50%);
    z-index:        10;
    width:          44px;
    height:         44px;
    border-radius:  50%;
    background:     rgba(255, 255, 255, 0.08);
    color:          var(--tlev-white);
    display:        flex;
    align-items:    center;
    justify-content: center;
    transition:     background 0.22s ease, color 0.22s ease, opacity 0.22s ease;
    opacity:        0.7;
}

.tlev-slider-prev { left:  20px; }
.tlev-slider-next { right: 20px; }

.tlev-slider-prev:hover,
.tlev-slider-next:hover {
    background: var(--tlev-gold);
    color:      var(--tlev-dark);
    opacity:    1;
}

.tlev-slider-prev svg,
.tlev-slider-next svg {
    pointer-events: none;
}

/* ── Dot indicators ──────────────────────────────────────── */
.tlev-slider-dots {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             8px;
    margin-top:      24px;
    padding:         0 16px;
    flex-wrap:       wrap;
}

.tlev-slider-dot {
    width:           8px;
    height:          8px;
    border-radius:   50%;
    background:      rgba(255, 255, 255, 0.28);
    transition:      width 0.24s ease, background 0.24s ease, border-radius 0.24s ease;
    flex-shrink:     0;
}

.tlev-slider-dot.is-active {
    width:           24px;
    background:      var(--tlev-gold);
    border-radius:   4px;
}

/* ── Slider skeleton ─────────────────────────────────────── */
.tlev-slider-skel {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             16px;
    padding:         0 6vw;
    min-height:      380px;
}

.tlev-slider-skel__center,
.tlev-slider-skel__side {
    border-radius: 14px;
    flex-shrink:   0;
    background:    linear-gradient(
            90deg,
            var(--tlev-shimmer-from) 0%,
            var(--tlev-shimmer-to)   50%,
            var(--tlev-shimmer-from) 100%
    );
    background-size: 200% 100%;
    animation:       tlev-shimmer 1.4s infinite linear;
}

.tlev-slider-skel__center {
    width:  56%;
    height: 420px;
}

.tlev-slider-skel__side {
    width:  20%;
    height: 340px;
    opacity: 0.45;
}

/* ============================================================
 * GRID SECTION
 * ============================================================ */
.tlev-grid-section {
    background: var(--tlev-white);
    padding:    56px 0 72px;
}

.tlev-grid-inner {
    width:   100%;
    /*padding: 0 6vw;*/
}

/* ── Grid layout ─────────────────────────────────────────── */
.tlev-events-grid {
    display:               grid;
    grid-template-columns: repeat(2, 1fr);
    gap:                   28px;
    list-style:            none;
    margin:                0;
    padding:               0;
}

/* ── Equal-height grid ────────────────────────────────────
   When JS adds this class, all cards in a row stretch to the
   same height. The card body uses flex so the CTA button always
   sits at the bottom regardless of content length.           */
.tlev-events-grid.tlev-events-grid--equal-height {
    align-items: stretch;
}

.tlev-events-grid.tlev-events-grid--equal-height .tlev-event-card {
    display:        flex;
    flex-direction: column;
    height:         100%;
}

.tlev-events-grid.tlev-events-grid--equal-height .tlev-event-card__body {
    flex:           1 1 auto;
    display:        flex;
    flex-direction: column;
}

/* Push CTA buttons to the bottom of the card body */
.tlev-events-grid.tlev-events-grid--equal-height .tlev-event-card__body .tlev-btn {
    margin-top: auto;
}

/* ── Card ────────────────────────────────────────────────── */
.tlev-event-card {
    background:    var(--tlev-white);
    border:        1px solid var(--tlev-border);
    border-radius: var(--tlev-card-radius);
    overflow:      hidden;
    transition:    transform 280ms ease, box-shadow 280ms ease;
    box-shadow:    0 2px 8px rgba(0, 0, 0, 0.06);
}

.tlev-event-card:hover {
    transform:  translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.13);
}

/* ── Card image ──────────────────────────────────────────── */
.tlev-event-card__img-link {
    display: block;
}

.tlev-event-card__img {
    position:   relative;
    width:      100%;
    height:     210px;
    overflow:   hidden;
    background: #e5e7eb;
}

.tlev-event-card__img img {
    position:   absolute;
    inset:      0;
    width:      100%;
    height:     100%;
    object-fit: cover;
    display:    block;
    transition: transform 0.32s ease;
}

.tlev-event-card:hover .tlev-event-card__img img {
    transform: scale(1.04);
}

/* Overlay pseudo-element (colour set via Elementor) */
.tlev-event-card__img::after {
    content:    '';
    position:   absolute;
    inset:      0;
    pointer-events: none;
    transition: background 0.28s ease;
}

.tlev-event-card__img-placeholder {
    width:      100%;
    height:     100%;
    background: #d1d5db;
}

/* ── Card date badge ─────────────────────────────────────── */
.tlev-event-card__date {
    position:       absolute;
    bottom:         10px;
    left:           12px;
    font-size:      0.62rem;
    font-weight:    700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color:          var(--tlev-white);
    background:     rgba(0, 0, 0, 0.52);
    padding:        4px 10px;
    border-radius:  4px;
    pointer-events: none;
}

.tlev-event-card__date--inline {
    position:  static;
    display:   inline-block;
    margin-bottom: 4px;
}

/* ── Card body ───────────────────────────────────────────── */
.tlev-event-card__body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap:     8px;
}

/* ── Card title ──────────────────────────────────────────── */
.tlev-event-card__title {
    font-size:   1rem;
    font-weight: 700;
    line-height: 1.35;
    color:       var(--tlev-text);
    margin:      0;
}

.tlev-event-card__title a {
    color:           inherit;
    text-decoration: none;
    transition:      color 0.2s ease;
}

.tlev-event-card__title a:hover {
    color: var(--tlev-teal);
}

/* ── Card venue ──────────────────────────────────────────── */
.tlev-event-card__venue {
    display:     flex;
    align-items: center;
    gap:         5px;
    font-size:   0.78rem;
    font-weight: 500;
    color:       var(--tlev-teal);
    margin:      0;
}
.tlev-event-card__venue svg{
min-width:24px;
}

/* ── Card description ────────────────────────────────────── */
.tlev-event-card__desc {
    font-size:             0.83rem;
    line-height:           1.6;
    color:                 var(--tlev-muted);
    margin:                0;
    display:               -webkit-box;
    -webkit-box-orient:    vertical;
    -webkit-line-clamp:    3;
    overflow:              hidden;
}

/* ── No events message ───────────────────────────────────── */
.tlev-no-events {
    grid-column: 1 / -1;
    text-align:  center;
    color:       var(--tlev-muted);
    padding:     40px 0;
    font-size:   0.9rem;
}

/* ============================================================
 * STATUS BADGES
 * ============================================================ */
.tlev-event-status {
    display:        inline-block;
    font-size:      0.65rem;
    font-weight:    700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding:        3px 9px;
    border-radius:  999px;
    width:          fit-content;
}

.tlev-status--open   { background: #dcfce7; color: #166534; }
.tlev-status--closed { background: #fee2e2; color: #991b1b; }
.tlev-status--done   { background: #e0e7ff; color: #3730a3; }
.tlev-status--cancel { background: #f3f4f6; color: #6b7280; }

/* ============================================================
 * CTA BUTTONS
 * ============================================================ */
.tlev-btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    font-size:       0.82rem;
    font-weight:     600;
    letter-spacing:  0.04em;
    text-decoration: none;
    padding:         10px 20px;
    border-radius:   6px;
    border:          1.5px solid transparent;
    cursor:          pointer;
    transition:      background 0.22s ease,
    color 0.22s ease,
    border-color 0.22s ease,
    transform 0.16s ease;
    width:           100%;
    text-align:      center;
}

.tlev-btn:hover { transform: translateY(-1px); }
.tlev-btn:active { transform: translateY(0); }

/* Outline style (grid cards) */
.tlev-btn--outline {
    background:   transparent;
    color:        var(--tlev-text);
    border-color: var(--tlev-border);
}

.tlev-btn--outline:hover {
    background:   var(--tlev-text);
    color:        var(--tlev-white);
    border-color: var(--tlev-text);
}

/* Gold style (slider cards) */
.tlev-btn--gold {
    background:   transparent;
    color:        var(--tlev-text);
    border-color: var(--tlev-border);
}

.tlev-btn--gold:hover {
    background:   var(--tlev-text);
    color:        var(--tlev-white);
    border-color: var(--tlev-text);
}

/* Register Now style */
.tlev-btn--register {
    background:   var(--tlev-gold);
    color:        var(--tlev-dark);
    border-color: var(--tlev-gold);
    font-weight:  700;
}

.tlev-btn--register:hover {
    background:   var(--tlev-gold-dark);
    border-color: var(--tlev-gold-dark);
}

/* ============================================================
 * LOADING SPINNER
 * ============================================================ */
.tlev-events-loading {
    display:         flex;
    justify-content: center;
    align-items:     center;
    padding:         40px 0;
}

.tlev-dot-spinner {
    display:  inline-flex;
    position: relative;
    width:    40px;
    height:   40px;
}

.tlev-dot-spinner span {
    position:      absolute;
    width:         6px;
    height:        6px;
    border-radius: 50%;
    background:    var(--tlev-gold);
    background:   linear-gradient(180deg, #E2C68F, #BB9757);;

    animation:     tlev-spin-dot 1.2s infinite ease-in-out both;
}

.tlev-dot-spinner span:nth-child(1) { top: 0;    left: 17px; animation-delay: 0s;     }
.tlev-dot-spinner span:nth-child(2) { top: 5px;  left: 29px; animation-delay: -1.0s;  }
.tlev-dot-spinner span:nth-child(3) { top: 17px; left: 34px; animation-delay: -0.833s;}
.tlev-dot-spinner span:nth-child(4) { top: 29px; left: 29px; animation-delay: -0.667s;}
.tlev-dot-spinner span:nth-child(5) { top: 34px; left: 17px; animation-delay: -0.5s;  }
.tlev-dot-spinner span:nth-child(6) { top: 29px; left: 5px;  animation-delay: -0.333s;}

@keyframes tlev-spin-dot {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40%            { transform: scale(1); opacity: 1;   }
}

/* ============================================================
 * SHIMMER SKELETON ANIMATION
 * ============================================================ */
@keyframes tlev-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.tlev-shimmer {
    background: linear-gradient(
            90deg,
            var(--tlev-shimmer-from) 0%,
            var(--tlev-shimmer-to)   50%,
            var(--tlev-shimmer-from) 100%
    );
    background-size: 200% 100%;
    animation: tlev-shimmer 1.4s infinite linear;
}

/* ── Skeleton grid cards ──────────────────────────────────── */
.tlev-event-card--skel {
    pointer-events: none;
    overflow:       hidden;
}

.tlev-event-card--skel .tlev-event-card__img {
    background: none;
}

.tlev-skel-line {
    height:        12px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.tlev-skel-line--title { height: 18px; width: 80%; }
.tlev-skel-line--meta  { height: 12px; width: 55%; }
.tlev-skel-line--short { height: 12px; width: 65%; }

.tlev-skel-btn {
    height:        38px;
    border-radius: 6px;
    margin-top:    8px;
    width:         100%;
}

/* ============================================================
 * SCROLL SENTINEL
 * ============================================================ */
.tlev-scroll-sentinel {
    height:  4px;
    margin:  16px 0 0;
    display: block;
}

/* ============================================================
 * RESPONSIVE — TABLET (≤ 900px)
 * ============================================================ */
@media (max-width: 900px) {
    /* Elementor controls override --tlev-slides-per-view and --tlev-slide-gap
       for this breakpoint via inline styles. The values below are CSS fallbacks
       only — they apply when Elementor inline styles have not been set.         */
    .tlev-events-wrap {
        --tlev-slides-per-view: 1.2;
        --tlev-slide-gap:       16px;
    }

    .tlev-events-grid {
        grid-template-columns: 1fr;
    }

    .tlev-slider-skel__center { width: 72%; height: 340px; }
    .tlev-slider-skel__side   { width: 12%; height: 270px; }

    .tlev-section-heading { font-size: 0.7rem; padding: 0 4vw; }

    .tlev-grid-inner { padding: 0 4vw; }

    .tlev-slider-section { padding: 36px 0 52px; }
    .tlev-grid-section   { padding: 40px 0 56px; }
}

/* ============================================================
 * RESPONSIVE — MOBILE (≤ 600px)
 * ============================================================ */
@media (max-width: 600px) {
    /* CSS fallbacks — Elementor responsive controls override these
       at the mobile breakpoint via inline styles.                   */
    .tlev-events-wrap {
        --tlev-slides-per-view: 1.1;
        --tlev-slide-gap:       12px;
    }

    .tlev-events-grid { gap: 20px; }

    .tlev-event-card__img { height: 180px; }

    .tlev-slider-skel__center { width: 84%; height: 300px; }
    .tlev-slider-skel__side   { width: 8%;  height: 230px; }

    .tlev-slider-prev { left:  10px; }
    .tlev-slider-next { right: 10px; }

    .tlev-slider-prev,
    .tlev-slider-next { width: 36px; height: 36px; }

    .tlev-section-heading { font-size: 0.68rem; padding: 0 5vw; }

    .tlev-grid-inner { padding: 0 5vw; }

    .tlev-slider-section { padding: 28px 0 40px; }
    .tlev-grid-section   { padding: 32px 0 48px; }

    .tlev-slider-dots { gap: 6px; margin-top: 16px; }
    .tlev-slider-dot  { width: 7px; height: 7px; }
    .tlev-slider-dot.is-active { width: 20px; }
}

.tlev-slider-section .e-con-inner {
    max-width: 960px;
    width: 100%;
    margin-bottom: 20px;
}
/* Slider empty: hide heading only, message shows in viewport */
.tlev-slider--empty .tlev-section-heading,.tlev-slider--empty .elementor-element { display: none; }

/* Grid empty: always hide the section */
.tlev-grid--empty { display: none; }
