/* =========================================================
   Winkel Locator – Frontend stijlen
   Kleuren en lettertype worden overgenomen van het actieve thema.
   ========================================================= */

/*
 * Custom properties op .wl-wrap worden door PHP ingevuld op basis van
 * het actieve WordPress-thema (zie class-frontend.php, render_shortcode).
 * Hieronder staan de fallback-waarden als een thema geen eigen kleuren heeft.
 */
.wl-wrap {
    --wl-primary:       var(--wp--preset--color--primary,         #7d2240);
    --wl-primary-hover: var(--wp--preset--color--primary-dark,    #5e1a30);
    --wl-secondary:     var(--wp--preset--color--secondary,       #7d2240);
    --wl-accent:        var(--wp--preset--color--accent,          var(--wl-primary));
    --wl-bg:            var(--wp--preset--color--background,      #f5f0ee);
    --wl-surface:       var(--wp--preset--color--base,            #ffffff);
    --wl-text:          var(--wp--preset--color--foreground,      #202124);
    --wl-muted:         var(--wp--preset--color--tertiary,        #70757a);
    --wl-border:        var(--wp--preset--color--border,          #e0e0e0);
    --wl-map-height:    580px;
    --wl-shadow:        0 2px 8px rgba(0, 0, 0, .10);

    /* Lettertype volledig van thema erven */
    font-family: inherit;
    font-size:   inherit;
    line-height: inherit;
    color:       var(--wl-text);
    box-sizing:  border-box;
}

.wl-wrap *, .wl-wrap *::before, .wl-wrap *::after {
    box-sizing: inherit;
}

/* ----------------------------------------------------------
   Zoekbalk
   ---------------------------------------------------------- */
.wl-search-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    background: var(--wl-surface);
    border: 1px solid var(--wl-border);
    border-radius: 6px;
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: var(--wl-shadow);
}

.wl-search-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 220px;
    min-width: 200px;
}

.wl-label {
    font-size: .75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--wl-muted);
}

.wl-input-row {
    display: flex;
    gap: 8px;
}

.wl-input {
    flex: 1;
    height: 40px;
    padding: 0 12px;
    background: var(--wl-surface);
    border: 1px solid var(--wl-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: .9em;
    color: var(--wl-text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.wl-input:focus {
    border-color: var(--wl-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wl-primary) 15%, transparent);
}

.wl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 0 28px;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: .82em;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter .15s, transform .1s;
    white-space: nowrap;
    text-decoration: none;
}

.wl-btn:active { transform: scale(.97); }

.wl-btn-primary {
    background: var(--wl-primary);
    color: #ffffff;
}
.wl-btn-primary:hover { filter: brightness(.88); color: #ffffff; }

.wl-btn-secondary {
    background: var(--wl-primary);
    color: #ffffff;
}
.wl-btn-secondary:hover { filter: brightness(.88); color: #ffffff; }

.wl-btn-ghost {
    background: var(--wl-surface);
    color: var(--wl-primary);
    border: 2px solid var(--wl-primary);
}
.wl-btn-ghost:hover {
    background: var(--wl-primary);
    color: #ffffff;
}

.wl-divider {
    display: flex;
    align-items: center;
    align-self: center;
    padding-top: 20px;
    color: var(--wl-muted);
    font-size: .85em;
}

/* ----------------------------------------------------------
   Status berichten
   ---------------------------------------------------------- */
.wl-status {
    display: none;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: .9em;
    margin-bottom: 12px;
}

.wl-status--success {
    background: color-mix(in srgb, var(--wl-secondary) 12%, transparent);
    color: color-mix(in srgb, var(--wl-secondary) 70%, #000);
    border-left: 4px solid var(--wl-secondary);
}

.wl-status--warning {
    background: #fef7e0;
    color: #856404;
    border-left: 4px solid #fbbf24;
}

.wl-status--error {
    background: #fce8e6;
    color: #b31412;
    border-left: 4px solid #ea4335;
}

.wl-status--info {
    background: color-mix(in srgb, var(--wl-primary) 10%, transparent);
    color: color-mix(in srgb, var(--wl-primary) 80%, #000);
    border-left: 4px solid var(--wl-primary);
}

/* ----------------------------------------------------------
   Kaart + zijbalk
   ---------------------------------------------------------- */
.wl-content {
    display: flex;
    gap: 16px;
    height: var(--wl-map-height, 580px);
}

.wl-map {
    flex: 1 1 auto;
    border-radius: 0;
    overflow: hidden;
    border: 1px solid var(--wl-border);
    min-height: 400px;
}

.wl-sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--wl-border);
    border-radius: 0;
    background: var(--wl-surface);
    overflow: hidden;
}

.wl-sidebar-header {
    padding: 12px 16px;
    background: var(--wl-bg);
    border-bottom: 1px solid var(--wl-border);
    font-size: .8em;
    font-weight: 600;
    color: var(--wl-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.wl-list,
.wl-wrap ul.wl-list,
.wl-wrap .wl-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-y: auto;
    flex: 1;
}

.wl-list-item,
.wl-wrap ul.wl-list li,
.wl-wrap .wl-list .wl-list-item,
.wl-wrap li.wl-list-item {
    list-style: none !important;
    padding: 14px 16px;
    border-bottom: 1px solid var(--wl-border);
    cursor: pointer;
    transition: background .15s;
}

.wl-list-item:hover,
.wl-list-item--active {
    background: color-mix(in srgb, var(--wl-primary) 10%, transparent);
}

.wl-list-item--highlight {
    background: color-mix(in srgb, var(--wl-secondary) 10%, transparent);
}

.wl-list-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.wl-list-name {
    font-size: .9em;
    font-weight: 700;
    color: var(--wl-text);
    line-height: 1.3;
}

.wl-list-dist {
    font-size: .78em;
    font-weight: 700;
    color: var(--wl-secondary);
    white-space: nowrap;
}

.wl-list-address {
    font-size: .82em;
    color: var(--wl-muted);
    font-style: normal;
    line-height: 1.5;
    margin-bottom: 6px;
}

.wl-list-website {
    font-size: .78em;
    color: var(--wl-primary);
    text-decoration: none;
    font-weight: 600;
}
.wl-list-website:hover { text-decoration: underline; }

.wl-list-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--wl-muted);
    font-size: .88em;
}

/* Logo in de zijbalklijst */
.wl-list-item-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.wl-list-logo-wrap {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wl-bg);
    border: 1px solid var(--wl-border);
    border-radius: 4px;
    overflow: hidden;
}

.wl-list-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wl-list-body {
    flex: 1;
    min-width: 0;
}

/* ----------------------------------------------------------
   Info-window (Google Maps popup)
   ---------------------------------------------------------- */
.wl-info-window {
    min-width: 220px;
    max-width: 300px;
    font-family: inherit;
    font-size: var(--wl-tooltip-font-size, 14px);
    line-height: 1.6;
}

.wl-info-logo {
    display: block;
    max-width: 110px;
    max-height: 48px;
    object-fit: contain;
    margin-bottom: 10px;
}

.wl-info-name {
    display: block;
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--wl-text, #202124);
}

.wl-info-address {
    font-size: 1em;
    color: var(--wl-muted, #5f6368);
    font-style: normal;
    margin-bottom: 10px;
    line-height: 1.7;
}

.wl-info-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wl-info-link,
.wl-info-route {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .95em;
    font-weight: 600;
    text-decoration: none;
    color: var(--wl-primary, #7d2240);
}
.wl-info-link:hover,
.wl-info-route:hover { text-decoration: underline; }

.wl-info-route svg,
.wl-info-link svg {
    flex-shrink: 0;
}

/* ----------------------------------------------------------
   Foutmelding (geen API key)
   ---------------------------------------------------------- */
.wl-error {
    background: #fce8e6;
    color: #b31412;
    border: 1px solid #f28b82;
    border-radius: 4px;
    padding: 12px 16px;
    font-size: .9em;
}

/* ----------------------------------------------------------
   Responsief – tablet (≤ 900px)
   ---------------------------------------------------------- */
@media ( max-width: 900px ) {
    .wl-sidebar {
        width: 260px;
    }
}

/* ----------------------------------------------------------
   Responsief – mobiel (≤ 680px)
   ---------------------------------------------------------- */
@media ( max-width: 680px ) {

    /* Zoekbalk */
    .wl-search-bar {
        flex-direction: column;
        gap: 10px;
        padding: 14px 16px;
    }

    .wl-search-group {
        min-width: 100%;
        flex: 1 1 100%;
    }

    .wl-input-row {
        flex-direction: column;
        gap: 8px;
    }

    .wl-input {
        width: 100%;
    }

    .wl-btn {
        width: 100%;
        justify-content: center;
    }

    .wl-divider {
        width: 100%;
        padding: 4px 0;
        justify-content: center;
        border-top: 1px solid var(--wl-border);
    }

    /* Tab-balk (kaart / lijst) */
    .wl-tabs {
        display: flex;
        border-bottom: 2px solid var(--wl-border);
        margin-bottom: 0;
        background: var(--wl-surface);
    }

    .wl-tab-btn {
        flex: 1;
        padding: 11px 8px;
        border: none;
        background: transparent;
        font-family: inherit;
        font-size: .82em;
        font-weight: 700;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--wl-muted);
        cursor: pointer;
        border-bottom: 3px solid transparent;
        margin-bottom: -2px;
        transition: color .15s, border-color .15s;
    }

    .wl-tab-btn--active {
        color: var(--wl-primary);
        border-bottom-color: var(--wl-primary);
    }

    /* Kaart + zijbalk: stapel onder elkaar, tabs sturen zichtbaarheid */
    .wl-content {
        flex-direction: column;
        height: auto;
        gap: 0;
    }

    .wl-map {
        height: 340px;
        min-height: unset;
        border-left: none;
        border-right: none;
        border-top: none;
    }

    .wl-map--hidden {
        display: none;
    }

    .wl-sidebar {
        width: 100%;
        max-height: 420px;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--wl-border);
    }

    .wl-sidebar--hidden {
        display: none;
    }

    /* Sidebar-header telt mee als sticky teller */
    .wl-sidebar-header {
        position: sticky;
        top: 0;
        z-index: 1;
    }
}

/* ----------------------------------------------------------
   Responsief – klein mobiel (≤ 400px)
   ---------------------------------------------------------- */
@media ( max-width: 400px ) {
    .wl-search-bar {
        padding: 12px;
    }

    .wl-map {
        height: 280px;
    }

    .wl-sidebar {
        max-height: 360px;
    }

    .wl-btn {
        font-size: .78em;
        height: 42px;
        padding: 0 20px;
    }
}

/* Tab-balk verbergen op desktop */
.wl-tabs {
    display: none;
}
