<?php
@include "/home/www.itlive.nl/public_html/subdomains/public/sites.itlive.nl/CLIENTS/preview-basepath.php";
if (!isset($base)) { $host = $_SERVER["HTTP_HOST"] ?? ""; $base = (stripos($host, "sites.itlive.nl") !== false) ? "/CLIENTS/slimbadkamer" : ""; }
$page_title = "Klantbeoordelingen — echte Google reviews";
$page_desc  = "Alle reviews zijn openbaar geverifieerd via Google. Geen gefilterde selectie — de echte ervaringen van onze klanten.";
$og_image   = '/assets/gallery/6-full-renovation.jpg';
$og_url     = 'https://slimbadkamer.nl/reviews.php';
$canonical  = 'https://slimbadkamer.nl/reviews.php';
include __DIR__ . "/_shared/header.php";

$google_rating   = 4.9;
$google_total    = 8;
$google_url      = 'https://maps.google.com/maps?cid=15087006234538180167';
$google_place_id = 'ChIJzYfGGSVvxkcRR54r-lHzZNE';

// Cached reviews — data/ map (bereikbaar voor webserver)
$cached_path  = __DIR__ . '/data/google-reviews.json';
$live_reviews = [];
if (is_file($cached_path)) {
    $j = json_decode((string)file_get_contents($cached_path), true);
    if (!empty($j['reviews'])) {
        $live_reviews        = $j['reviews'];
        $google_rating       = $j['place']['rating']    ?? $google_rating;
        $google_total        = $j['place']['total']     ?? $google_total;
        $google_url          = $j['place']['google_url'] ?? $google_url;
        $google_place_id     = $j['place']['place_id']  ?? $google_place_id;
    }
}

// Helper: render star row (supports half-star display)
function bh_stars(float $rating): string {
    $full  = (int) floor($rating);
    $half  = ($rating - $full) >= 0.25 && ($rating - $full) < 0.75 ? 1 : 0;
    $empty = 5 - $full - $half;
    return str_repeat('<span class="bh-rv-star bh-rv-star--full">★</span>', $full)
         . ($half ? '<span class="bh-rv-star bh-rv-star--half">★</span>' : '')
         . str_repeat('<span class="bh-rv-star bh-rv-star--empty">★</span>', $empty);
}
?>

<style>
/* ── Slim Badkamer reviews page — bh-rv- prefix ── */

/* HERO */
.bh-rv-hero {
    position: relative;
    background: linear-gradient(135deg, #1a0e0b 0%, #3a3228 100%);
    color: #fff;
    padding: clamp(3.5rem, 8vw, 6rem) 0;
    overflow: hidden;
}
.bh-rv-hero__bg {
    position: absolute;
    inset: 0;
    background-image: url('<?= $base ?>/assets/gallery/6-full-renovation.jpg');
    background-size: cover;
    background-position: center;
    opacity: .18;
    pointer-events: none;
}
.bh-rv-hero__inner {
    position: relative;
    max-width: 760px;
    padding: 0 1.25rem;
    margin: 0 auto;
}
.bh-rv-eyebrow {
    display: block;
    color: #c9b598;
    letter-spacing: .28em;
    text-transform: uppercase;
    font-size: .78rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.bh-rv-hero__h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2.2rem, 4.8vw, 3.6rem);
    font-weight: 400;
    line-height: 1.15;
    margin: 0 0 1rem;
    color: #fff;
}
.bh-rv-hero__h1 em {
    color: #c9b598;
    font-style: italic;
}
.bh-rv-hero__lead {
    color: #cbbfa8;
    font-size: 1.05rem;
    line-height: 1.75;
    max-width: 600px;
    margin: 0 0 2rem;
}
.bh-rv-hero__ctas {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

/* BUTTONS */
.bh-rv-btn {
    display: inline-block;
    padding: .75rem 1.6rem;
    font-size: .9rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s;
}
.bh-rv-btn--dark {
    background: #c9b598;
    color: #1a0e0b;
    border: 2px solid #c9b598;
}
.bh-rv-btn--dark:hover {
    background: #b8a386;
    border-color: #b8a386;
    color: #1a0e0b;
}
.bh-rv-btn--outline {
    background: transparent;
    color: #fff;
    border: 2px solid #c9b598;
}
.bh-rv-btn--outline:hover {
    background: rgba(201,181,152,.12);
    color: #c9b598;
}
.bh-rv-btn--brown {
    background: #3a3228;
    color: #fff;
    border: 2px solid #3a3228;
}
.bh-rv-btn--brown:hover {
    background: #2a2420;
    border-color: #2a2420;
}
.bh-rv-btn--gold {
    background: #c9b598;
    color: #1a0e0b;
    border: 2px solid #c9b598;
}
.bh-rv-btn--gold:hover {
    background: #b8a386;
    border-color: #b8a386;
}
.bh-rv-btn--ghost-dark {
    background: transparent;
    color: #c9b598;
    border: 2px solid rgba(201,181,152,.5);
}
.bh-rv-btn--ghost-dark:hover {
    border-color: #c9b598;
    background: rgba(201,181,152,.08);
}

/* STARS */
.bh-rv-stars {
    display: inline-flex;
    gap: .06em;
    font-size: inherit;
    line-height: 1;
}
.bh-rv-star { color: #c0a96b; }
.bh-rv-star--half { opacity: .55; }
.bh-rv-star--empty { color: #d6c9b5; opacity: .4; }

/* RATING SECTION */
.bh-rv-rating-section {
    background: #f5efe4;
    padding: 4rem 0;
}
.bh-rv-rating-section__inner {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1.25rem;
}
.bh-rv-card {
    background: #fff;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 2px 18px rgba(58,50,40,.07);
}
.bh-rv-card__logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}
.bh-rv-card__label {
    font-size: .72rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: #6b5745;
    font-weight: 700;
    margin-bottom: .3rem;
}
.bh-rv-card__score {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 3rem;
    font-weight: 500;
    color: #3a3228;
    line-height: 1;
    margin-bottom: .25rem;
}
.bh-rv-card__score-stars {
    font-size: 1.5rem;
    margin-bottom: .4rem;
}
.bh-rv-card__meta {
    color: #8c7763;
    font-size: .92rem;
    margin-bottom: 1.4rem;
}
.bh-rv-card__cta {
    text-align: center;
}

/* LIVE REVIEWS SECTION */
.bh-rv-live-section {
    background: #fff;
    padding: 4.5rem 0;
}
.bh-rv-live-section__inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.25rem;
}
.bh-rv-section-header {
    text-align: center;
    margin-bottom: 2.8rem;
}
.bh-rv-section-header__h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 400;
    color: #3a3228;
    margin: .6rem 0 .5rem;
}
.bh-rv-section-header__h2 em {
    color: #8c7763;
    font-style: italic;
}
.bh-rv-section-header__sub {
    color: #8c7763;
    font-size: .82rem;
    margin: 0;
}
.bh-rv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.4rem;
}
.bh-rv-review-card {
    background: #f5efe4;
    padding: 1.6rem 1.4rem;
    border-left: 3px solid #c9b598;
    display: flex;
    flex-direction: column;
}
.bh-rv-review-card__stars {
    font-size: 1rem;
    margin-bottom: .6rem;
}
.bh-rv-review-card__quote {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    color: #3a3228;
    font-size: 1.06rem;
    line-height: 1.72;
    margin: 0 0 1rem;
    flex: 1;
}
.bh-rv-review-card__author {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .84rem;
    color: #6b5745;
    margin-top: auto;
}
.bh-rv-review-card__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.bh-rv-review-card__name {
    font-weight: 600;
    display: block;
    color: #3a3228;
}
.bh-rv-review-card__time {
    display: block;
    font-size: .78rem;
    color: #8c7763;
    margin-top: .1rem;
}

/* FALLBACK SECTION */
.bh-rv-fallback-section {
    background: #fff;
    padding: 4.5rem 0;
}
.bh-rv-fallback-section__inner {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 1.25rem;
    text-align: center;
}
.bh-rv-fallback-section__h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 400;
    color: #3a3228;
    margin: .6rem 0 1rem;
}
.bh-rv-fallback-section__h2 em {
    color: #8c7763;
    font-style: italic;
}
.bh-rv-fallback-section__body {
    color: #6b5745;
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 1.8rem;
}

/* CTA SECTION */
.bh-rv-cta-section {
    background: linear-gradient(135deg, #3a3228 0%, #1a0e0b 100%);
    color: #fff;
    padding: 4rem 0;
    text-align: center;
}
.bh-rv-cta-section__inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1.25rem;
}
.bh-rv-cta-section__h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.8rem, 3.2vw, 2.4rem);
    font-weight: 400;
    color: #fff;
    margin: 0 0 .75rem;
}
.bh-rv-cta-section__h2 em {
    color: #c9b598;
    font-style: italic;
}
.bh-rv-cta-section__sub {
    color: #cbbfa8;
    font-size: 1rem;
    line-height: 1.7;
    max-width: 480px;
    margin: 0 auto 1.8rem;
}
.bh-rv-cta-section__ctas {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: center;
}

/* GOOGLE LOGO SVG wrapper */
.bh-rv-google-logo {
    flex-shrink: 0;
}
</style>

<!-- HERO -->
<section class="bh-rv-hero">
    <div class="bh-rv-hero__bg" role="presentation" aria-hidden="true"></div>
    <div class="bh-rv-hero__inner">
        <span class="bh-rv-eyebrow">Klantbeoordelingen</span>
        <h1 class="bh-rv-hero__h1">Wat klanten <em>zeggen</em></h1>
        <p class="bh-rv-hero__lead">Alle reviews zijn openbaar verifieerbaar op Google Maps. Geen gefilterde selectie — de echte ervaringen van bezoekers van onze showroom.</p>
        <div class="bh-rv-hero__ctas">
            <a href="<?= htmlspecialchars($google_url) ?>" target="_blank" rel="noopener" class="bh-rv-btn bh-rv-btn--dark">Lees reviews op Google</a>
            <a href="<?= $base ?>/contact.php" class="bh-rv-btn bh-rv-btn--outline">Direct contact</a>
        </div>
    </div>
</section>

<!-- RATING OVERZICHT -->
<section class="bh-rv-rating-section">
    <div class="bh-rv-rating-section__inner">
        <div class="bh-rv-card">
            <div class="bh-rv-card__logo-row">
                <!-- Google G logo inline SVG -->
                <svg class="bh-rv-google-logo" width="52" height="52" viewBox="0 0 48 48" aria-label="Google" role="img">
                    <path fill="#4285F4" d="M45.12 24.5c0-1.56-.14-3.06-.4-4.5H24v8.51h11.84c-.51 2.75-2.06 5.08-4.39 6.64v5.52h7.11c4.16-3.83 6.56-9.47 6.56-16.17z"/>
                    <path fill="#34A853" d="M24 46c5.94 0 10.92-1.97 14.56-5.33l-7.11-5.52c-1.97 1.32-4.49 2.1-7.45 2.1-5.73 0-10.58-3.87-12.31-9.07H4.34v5.7C7.96 41.07 15.4 46 24 46z"/>
                    <path fill="#FBBC05" d="M11.69 28.18C11.25 26.86 11 25.45 11 24s.25-2.86.69-4.18v-5.7H4.34C2.85 17.09 2 20.45 2 24c0 3.55.85 6.91 2.34 9.88l7.35-5.7z"/>
                    <path fill="#EA4335" d="M24 10.75c3.23 0 6.13 1.11 8.41 3.29l6.31-6.31C34.91 4.18 29.93 2 24 2 15.4 2 7.96 6.93 4.34 14.12l7.35 5.7c1.73-5.2 6.58-9.07 12.31-9.07z"/>
                </svg>
                <div>
                    <p class="bh-rv-card__label">Google Reviews</p>
                    <p class="bh-rv-card__score"><?= number_format($google_rating, 1, ',', '') ?></p>
                    <p class="bh-rv-card__score-stars">
                        <span class="bh-rv-stars"><?= bh_stars($google_rating) ?></span>
                    </p>
                </div>
            </div>
            <p class="bh-rv-card__meta"><?= (int)$google_total ?> beoordelingen &middot; De Huyzen Interior, Zeist</p>
            <div class="bh-rv-card__cta">
                <a href="<?= htmlspecialchars($google_url) ?>" target="_blank" rel="noopener" class="bh-rv-btn bh-rv-btn--brown">Lees alle reviews op Google &rarr;</a>
            </div>
        </div>
    </div>
</section>

<?php if ($live_reviews): ?>
<!-- LIVE REVIEWS GRID -->
<section class="bh-rv-live-section">
    <div class="bh-rv-live-section__inner">
        <div class="bh-rv-section-header">
            <span class="bh-rv-eyebrow" style="color:#8c7763">Recente reviews</span>
            <h2 class="bh-rv-section-header__h2">Live vanaf <em>Google Maps</em></h2>
            <p class="bh-rv-section-header__sub">Dagelijks ververst &middot; bron: openbaar profiel</p>
        </div>
        <div class="bh-rv-grid">
            <?php foreach ($live_reviews as $rv): ?>
            <article class="bh-rv-review-card">
                <div class="bh-rv-review-card__stars">
                    <span class="bh-rv-stars"><?= bh_stars((float)($rv['rating'] ?? 5)) ?></span>
                </div>
                <blockquote class="bh-rv-review-card__quote">&ldquo;<?= htmlspecialchars(mb_substr((string)($rv['text'] ?? ''), 0, 320)) ?><?= mb_strlen((string)($rv['text'] ?? '')) > 320 ? '&hellip;' : '' ?>&rdquo;</blockquote>
                <div class="bh-rv-review-card__author">
                    <?php if (!empty($rv['profile_photo'])): ?>
                        <img class="bh-rv-review-card__avatar" src="<?= htmlspecialchars($rv['profile_photo']) ?>" alt="" loading="lazy">
                    <?php endif; ?>
                    <div>
                        <span class="bh-rv-review-card__name"><?= htmlspecialchars((string)($rv['author'] ?? '')) ?></span>
                        <span class="bh-rv-review-card__time"><?= htmlspecialchars((string)($rv['time'] ?? '')) ?></span>
                    </div>
                </div>
            </article>
            <?php endforeach; ?>
        </div>
    </div>
</section>
<?php else: ?>
<!-- FALLBACK — geen live data beschikbaar -->
<section class="bh-rv-fallback-section">
    <div class="bh-rv-fallback-section__inner">
        <span class="bh-rv-eyebrow" style="color:#8c7763">Transparantie</span>
        <h2 class="bh-rv-fallback-section__h2">Echte reviews &mdash; <em>geen selectie</em></h2>
        <p class="bh-rv-fallback-section__body">Wij tonen uitsluitend openbaar verifieerbare Google-reviews. Bezoek onze pagina direct om alle <?= (int)$google_total ?> beoordelingen te lezen.</p>
        <a href="<?= htmlspecialchars($google_url) ?>" target="_blank" rel="noopener" class="bh-rv-btn bh-rv-btn--gold">Bekijk op Google (<?= (int)$google_total ?> reviews)</a>
    </div>
</section>
<?php endif; ?>

<!-- CTA: SCHRIJF EEN REVIEW -->
<section class="bh-rv-cta-section">
    <div class="bh-rv-cta-section__inner">
        <h2 class="bh-rv-cta-section__h2">Bent u klant? <em>Deel uw ervaring</em></h2>
        <p class="bh-rv-cta-section__sub">Uw review helpt anderen bij hun keuze &mdash; en ons om te blijven verbeteren.</p>
        <div class="bh-rv-cta-section__ctas">
            <a href="https://search.google.com/local/writereview?placeid=<?= htmlspecialchars($google_place_id) ?>" target="_blank" rel="noopener" class="bh-rv-btn bh-rv-btn--gold">Schrijf een review op Google</a>
            <a href="<?= $base ?>/contact.php" class="bh-rv-btn bh-rv-btn--ghost-dark">Direct contact</a>
        </div>
    </div>
</section>

<?php include __DIR__ . "/_shared/footer.php"; ?>
