/**
 * Sphere Volume Formula - Advertisement Management System Stylesheet
 * Responsive, Lightweight, Zero-Framework CSS3
 */

/* ==========================================================================
   1. Base Ad Containers & Wrappers
   ========================================================================== */
.ad-unit-wrapper {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    text-align: center;
    overflow: hidden;
    clear: both;
    line-height: 1.2;
}

.ad-unit-wrapper * {
    box-sizing: border-box;
    max-width: 100%;
}

.ad-unit-inner {
    display: inline-block;
    max-width: 100%;
    vertical-align: middle;
    overflow: hidden;
    margin: 0 auto;
}

/* Alignments */
.ad-align-center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}
.ad-align-left {
    text-align: left;
    margin-left: 0;
    margin-right: auto;
}
.ad-align-right {
    text-align: right;
    margin-left: auto;
    margin-right: 0;
}

/* ==========================================================================
   2. Advertisement Label
   ========================================================================== */
.ad-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 6px;
    user-select: none;
}
.ad-label-top,
.ad-label-center {
    text-align: center;
}
.ad-label-left {
    text-align: left;
}
.ad-label-right {
    text-align: right;
}

/* ==========================================================================
   3. Top Header Leaderboard Placement
   ========================================================================== */
.ad-placement-top_header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 10px;
    margin: 0 auto;
}

.ad-placement-below_header {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px;
    margin: 0 auto;
}

/* ==========================================================================
   4. Post Cover Ad System (Positions: Below, Above, Between, Overlay)
   ========================================================================== */
.ad-placement-post_cover {
    margin: 18px 0;
}

.ad-placement-post_cover.ad-pos-below_image {
    margin-top: 14px;
    margin-bottom: 24px;
}

.ad-placement-post_cover.ad-pos-above_image {
    margin-bottom: 16px;
}

.ad-placement-post_cover.ad-pos-between_title_image {
    margin: 12px 0 18px;
}

/* Post Cover: Overlay Mode */
.featured-image-container-with-overlay {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.ad-placement-post_cover[data-overlay="1"] {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    padding: 12px 16px;
    max-height: 40%;
    z-index: 10;
    backdrop-filter: blur(4px);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Close Button */
.ad-close-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    transition: background 0.15s ease;
}
.ad-close-btn:hover {
    background: #ef4444;
}

/* ==========================================================================
   5. Banner & Sponsor Units
   ========================================================================== */
.ad-banner-link {
    display: inline-block;
    max-width: 100%;
    text-decoration: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.ad-banner-link:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}
.ad-banner-img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}
.ad-sponsor-badge {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 4px;
    margin-bottom: 6px;
}
.ad-sponsor-desc {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 6px;
}

/* ==========================================================================
   6. Placeholders & Preview Boxes
   ========================================================================== */
.ad-placeholder-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    color: #475569;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
}
.ad-placeholder-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: #0f172a;
}
.ad-placeholder-sub {
    font-size: 0.78rem;
    color: #64748b;
}

/* ==========================================================================
   7. Mobile Sticky Bottom & Top
   ========================================================================== */
.ad-placement-mobile_sticky_bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    padding: 6px 12px;
    background: rgba(255,255,255,0.98);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.12);
    z-index: 9990;
    border-top: 1px solid #e2e8f0;
}

.ad-placement-mobile_sticky_top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    padding: 6px 12px;
    background: rgba(255,255,255,0.98);
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    z-index: 9990;
    border-bottom: 1px solid #e2e8f0;
}

/* Desktop Sticky */
.ad-placement-desktop_sticky {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 320px;
    margin: 0;
    z-index: 9980;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 12px;
}

/* Floating Ad */
.ad-placement-floating {
    position: fixed;
    bottom: 20px;
    left: 20px;
    max-width: 280px;
    margin: 0;
    z-index: 9980;
    background: #ffffff;
    box-shadow: 0 4px 18px rgba(0,0,0,0.12);
    border-radius: 8px;
    padding: 10px;
}

/* ==========================================================================
   8. Popup & Exit Intent Modal Layer
   ========================================================================== */
.ad-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.ad-modal-backdrop.ad-modal-active {
    opacity: 1;
    visibility: visible;
}
.ad-modal-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    text-align: center;
}

/* ==========================================================================
   9. Protection: Never block calculator controls or navigation
   ========================================================================== */
.calculator-card,
.calc-container,
.interactive-calc-box,
.site-header,
.desktop-nav {
    position: relative;
    z-index: 50;
}

/* ==========================================================================
   10. Responsive Media Queries
   ========================================================================== */
@media (max-width: 768px) {
    .ad-placement-top_header {
        padding: 8px 6px;
    }
    .ad-placement-desktop_sticky {
        display: none !important;
    }
    .ad-placement-post_cover[data-overlay="1"] {
        padding: 8px 12px;
        max-height: 50%;
    }
}

@media (min-width: 769px) {
    .ad-placement-mobile_sticky_bottom,
    .ad-placement-mobile_sticky_top {
        display: none !important;
    }
}
