/* ==========================================================================
   Zency Behandler Grid — Styles v1.2.0

   TEST

   Specificity strategy: all card child selectors are scoped under
   .zbg-wrapper to beat Elementor defaults without !important.
   Row alignment: uses CSS subgrid on .zbg-grid so cards share row tracks.
   ========================================================================== */

.zbg-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    font-family: inherit;
}

/* ---------- Top bar (toggle + sort) ---------- */
.zbg-wrapper .zbg-topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.zbg-wrapper .zbg-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.zbg-wrapper .zbg-filter-toggle:hover,
.zbg-wrapper .zbg-filter-toggle:focus,
.zbg-wrapper .zbg-filter-toggle:active,
.zbg-wrapper .zbg-filter-toggle.is-active {
    border-color: var(--e-global-color-c91a498, #4a6741);
    background: #f7faf6;
    color: #333;
}

.zbg-wrapper .zbg-filter-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.zbg-wrapper .zbg-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--e-global-color-c91a498, #4a6741);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.zbg-wrapper .zbg-topbar__sort {
    margin-left: auto;
    flex: 0 0 200px;
}

/* ---------- Collapsible filter panel ---------- */
.zbg-wrapper .zbg-filter-panel {
    margin-bottom: 24px;
    overflow: hidden;
    animation: zbg-panel-open 0.25s ease;
}

.zbg-wrapper .zbg-filter-panel[hidden] {
    display: none;
}

@keyframes zbg-panel-open {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.zbg-wrapper .zbg-filter-panel__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
    padding: 20px 24px;
    background: var(--e-global-color-0ce50db);
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.zbg-wrapper .zbg-filter-group {
    flex: 1 1 220px;
    min-width: 200px;
}

.zbg-wrapper .zbg-filter-group.zbg-filter-distance {
    flex: 1 1 320px;
    min-width: 260px;
}

/* ---------- Common filter styles ---------- */
.zbg-wrapper .zbg-filter-label {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 10px;
}

/* Slider */
.zbg-wrapper .zbg-slider-wrap {
    position: relative;
}

.zbg-wrapper .zbg-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--e-global-color-c91a498, #4a6741), #8faa58);
    outline: none;
    cursor: pointer;
}

.zbg-wrapper .zbg-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--e-global-color-c91a498, #4a6741);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.zbg-wrapper .zbg-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.zbg-wrapper .zbg-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--e-global-color-c91a498, #4a6741);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}

.zbg-wrapper .zbg-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: #888;
}

.zbg-wrapper .zbg-slider-value {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--e-global-color-c91a498, #4a6741);
    margin-top: 4px;
}

/* Select */
.zbg-wrapper .zbg-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.zbg-wrapper .zbg-select:focus {
    border-color: var(--e-global-color-c91a498, #4a6741);
}

/* ---------- Grid with subgrid ---------- */
.zbg-wrapper .zbg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    transition: opacity 0.2s ease;
}

.zbg-wrapper .zbg-grid.is-loading {
    opacity: 0.4;
    pointer-events: none;
}

/* ---------- Card (subgrid rows) ---------- */

/*
 * Card uses subgrid to align all children across a row.
 * Row tracks:  image | name | trustpilot | address | next-slot | price | book | more
 */
.zbg-wrapper .zbg-card {
    background: #F4F4F4;
    border-radius: 25px;
    padding: 30px 20px 22px;
    text-align: center;
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 8;
    row-gap: 0;
    align-items: center;
    justify-items: center;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.zbg-wrapper .zbg-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* --- Group 1: Identity (image + name + trustpilot) — tight spacing --- */

.zbg-wrapper .zbg-card__image {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #e8e8e8;
    margin-bottom: 2px;
}

.zbg-wrapper .zbg-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.zbg-wrapper .zbg-card__name {
    font-family: var(--e-global-typography-058cb46-font-family), Sans-serif;
    font-size: var(--e-global-typography-058cb46-font-size);
    font-weight: var(--e-global-typography-058cb46-font-weight);
    line-height: var(--e-global-typography-058cb46-line-height);
    letter-spacing: var(--e-global-typography-058cb46-letter-spacing);
    color: var(--e-global-color-primary);
    margin: 0 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zbg-wrapper .zbg-card__trustpilot {
    display: inline-block;
    line-height: 0;
    margin-bottom: 20px; /* gap between identity group and info group */
}

.zbg-wrapper .zbg-card__trustpilot img {
    display: block;
    width: 110px;
    height: auto;
}

/* --- Group 2: Info (address + next slot + price) — moderate spacing --- */

.zbg-wrapper .zbg-card__address {
    font-family: var(--e-global-typography-f089df3-font-family), Sans-serif;
    font-size: var(--e-global-typography-f089df3-font-size);
    font-weight: var(--e-global-typography-f089df3-font-weight);
    line-height: var(--e-global-typography-f089df3-line-height);
    letter-spacing: var(--e-global-typography-f089df3-letter-spacing);
    color: var(--e-global-color-c2e974d);
    margin: 0 0 16px;
    display: flex;
    align-items: flex-start;
    align-self: start;
    justify-content: center;
    gap: 5px;
}

.zbg-wrapper .zbg-card__address .zbg-icon-car {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
    margin-top: 5px;
}

/* Next available slot */
.zbg-wrapper .zbg-card__next-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0 0 4px;
}

.zbg-wrapper .zbg-card__next-slot-label {
    font-family: var(--e-global-typography-f089df3-font-family), Sans-serif;
    font-size: var(--e-global-typography-f089df3-font-size);
    font-weight: var(--e-global-typography-f089df3-font-weight);
    line-height: var(--e-global-typography-f089df3-line-height);
    letter-spacing: var(--e-global-typography-f089df3-letter-spacing);
    color: var(--e-global-color-c2e974d);
    white-space: nowrap;
}

.zbg-wrapper .zbg-card__next-slot-label .zbg-mobile-br {
    display: none;
}

.zbg-wrapper .zbg-card__next-slot-time {
    display: inline-block;
    font-family: var(--e-global-typography-f089df3-font-family), Sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: #333;
    background: #e8e8e8;
    padding: 6px 14px;
    border-radius: 6px;
}

.zbg-wrapper .zbg-card__price {
    font-family: var(--e-global-typography-f089df3-font-family), Sans-serif;
    font-size: var(--e-global-typography-f089df3-font-size);
    font-weight: var(--e-global-typography-f089df3-font-weight);
    line-height: var(--e-global-typography-f089df3-line-height);
    letter-spacing: var(--e-global-typography-f089df3-letter-spacing);
    color: var(--e-global-color-c2e974d);
    margin: 24px 0 5px; /* gap between info group and action group */
}

/* --- Group 3: Actions (book + more) --- */

.zbg-wrapper .zbg-card__book {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 40px;
    padding: 0;
    background: var(--e-global-color-c91a498, #4a6741);
    color: #fff;
    border: none;
    border-radius: 25px;
    font-family: var(--e-global-typography-7eee398-font-family), Sans-serif;
    font-size: var(--e-global-typography-7eee398-font-size);
    font-weight: var(--e-global-typography-7eee398-font-weight);
    text-transform: var(--e-global-typography-7eee398-text-transform);
    line-height: var(--e-global-typography-7eee398-line-height);
    letter-spacing: var(--e-global-typography-7eee398-letter-spacing);
    cursor: pointer;
    transition: background 0.2s;
    align-self: end;
}

.zbg-wrapper .zbg-card__book:hover,
.zbg-wrapper .zbg-card__book:focus,
.zbg-wrapper .zbg-card__book:active {
    background: var(--e-global-color-5bfe8c5);
}

.zbg-wrapper .zbg-card__book .zbg-book-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    fill: #fff;
}

.zbg-wrapper .zbg-card__more {
    display: inline-block;
    margin-top: 10px;
    font-size: 16px;
    color: #333;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
    align-self: start;
}

.zbg-wrapper .zbg-card__more:hover,
.zbg-wrapper .zbg-card__more:focus,
.zbg-wrapper .zbg-card__more:active {
    color: var(--e-global-color-c91a498, #4a6741);
}

/* ---------- Loading ---------- */
.zbg-wrapper .zbg-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.zbg-wrapper .zbg-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--e-global-color-c91a498, #4a6741);
    border-radius: 50%;
    animation: zbg-spin 0.7s linear infinite;
}

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

/* ---------- Empty ---------- */
.zbg-wrapper .zbg-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    font-size: 15px;
    color: #888;
}

/* ---------- Modal ---------- */
.zbg-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    justify-content: flex-end;
}

.zbg-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    animation: zbg-fade-in 0.25s ease;
}

@keyframes zbg-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.zbg-modal__panel {
    position: relative;
    width: 75%;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.2);
    animation: zbg-slide-in 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

@keyframes zbg-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.zbg-modal__close {
    position: absolute;
    top: 40px;
    right: 20px;
    width: 32px;
    height: 32px;
    background: var(--e-global-color-c91a498, #4a6741);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
    padding: 0;
}

.zbg-modal__close:hover,
.zbg-modal__close:active,
.zbg-modal__close:focus {
    background: var(--e-global-color-5bfe8c5, #3a5233);
}

.zbg-modal__body {
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-top: 20px;
}

.zbg-modal__body iframe[src*=".zency.dk/"][src*="/book-"] {
    display: block;
    width: 100%;
    border: 0;
    height: 135dvh;
    min-height: 135dvh;
}

/* ---------- Responsive (Elementor breakpoints) ---------- */

/* Laptop — up to 1366px */
@media (max-width: 1366px) {
    .zbg-modal__panel { width: 80%; }
}

/* Tablet landscape — up to 1200px */
@media (max-width: 1200px) {
    .zbg-wrapper .zbg-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .zbg-modal__panel { width: 85%; }
}

/* Tablet portrait — up to 1024px */
@media (max-width: 1024px) {
    .zbg-modal__panel { width: 90%; }
}

/* Mobile landscape — up to 880px */
@media (max-width: 880px) {
    .zbg-wrapper .zbg-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .zbg-wrapper .zbg-topbar {
        flex-direction: column;
        align-items: stretch;
    }
    .zbg-wrapper .zbg-topbar__sort {
        margin-left: 0;
        flex: 1 1 100%;
    }
    .zbg-wrapper .zbg-filter-panel__inner {
        flex-direction: column;
        gap: 14px;
        padding: 16px;
    }
    .zbg-wrapper .zbg-filter-group,
    .zbg-wrapper .zbg-filter-group.zbg-filter-distance {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }
    .zbg-modal__panel { width: 100%; }
    .zbg-modal__body iframe[src*=".zency.dk/"][src*="/book-"] {
        height: 100dvh;
        min-height: 100dvh;
    }
}

/* Mobile portrait — up to 767px */
@media (max-width: 767px) {
    .zbg-wrapper .zbg-card {
        padding: 24px 16px 18px;
    }
    .zbg-wrapper .zbg-card__image,
    .zbg-wrapper .zbg-card__trustpilot img {
        width: 100%;
    }
    .zbg-wrapper .zbg-card__image {
        height: auto;
        aspect-ratio: 1;
    }
    .zbg-wrapper .zbg-card__next-slot-label {
        white-space: normal;
        text-align: center;
    }
    .zbg-wrapper .zbg-card__next-slot-label .zbg-mobile-br {
        display: inline;
    }
    
    .zbg-wrapper .zbg-card__book {
        font-size: 16px;
    }
    .zbg-wrapper .zbg-card__book .zbg-book-icon {
        width: 16px;
        height: 16px;
    }
}
