@* Views/Shared/_AdUnit.cshtml *@
@{
    var position = ViewBag.AdPosition?.ToString() ?? "default";
    var slotId = ViewBag.AdSlotId?.ToString() ?? "default-slot";
    var adFormat = ViewBag.AdFormat?.ToString() ?? "auto";
    var adSize = ViewBag.AdSize?.ToString() ?? "";
    var publisherId = ViewBag.GoogleAdsPublisher?.ToString() ?? "pub-3475956393038764";
    var isEnabled = ViewBag.GoogleAdsEnabled ?? true;
    var cssClass = ViewBag.AdCssClass?.ToString() ?? "ad-container";
    var isSticky = ViewBag.IsSticky ?? false;
    var showOnMobile = ViewBag.ShowOnMobile ?? true;
    var showOnDesktop = ViewBag.ShowOnDesktop ?? true;
}

@if (isEnabled && !string.IsNullOrEmpty(publisherId) && publisherId != "pub-3475956393038764")
{
    <div class="@cssClass @(isSticky ? "ad-sticky" : "") @(!showOnMobile ? "d-none d-md-block" : "") @(!showOnDesktop ? "d-block d-md-none" : "")"
         data-ad-position="@position">

        <ins class="adsbygoogle"
             style="display:block@(adSize)"
             data-ad-client="@publisherId"
             data-ad-slot="@slotId"
             data-ad-format="@adFormat"
        @if (adFormat == "auto")
        {
            @Html.Raw("data-full-width-responsive=\"true\"")
        }></ins>

        @if (ViewBag.ShowAdLabel == true)
        {
            <small class="text-muted d-block text-center mt-1" style="font-size: 10px;">Publicidade</small>
        }
    </div>
}
else if (ViewBag.ShowPlaceholder == true)
{
    <!-- Placeholder para desenvolvimento -->
    <div class="@cssClass bg-light border rounded d-flex align-items-center justify-content-center"
         style="min-height: 90px; color: #6c757d;">
        <small>Anúncio: @position</small>
    </div>
}