/**
 * DAMP AdSense Styles
 * Discrete advertising integration that matches DAMP design system
 */

/* ==========================================================================
   AdSense Base Styles
   ========================================================================== */

.damp-ad-container {
    position: relative;
    margin: 60px auto;
    padding: 0;
    max-width: 100%;
    text-align: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 10;
}

.damp-ad-container.loaded {
    opacity: 1;
}

/* Ad unit styling */
.damp-ad-unit {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 212, 255, 0.1);
    transition: all 0.3s ease;
}

.damp-ad-unit:hover {
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.15);
    transform: translateY(-2px);
}

/* Ad label styling */
.damp-ad-label {
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    opacity: 0.7;
}

/* ==========================================================================
   Placement-Specific Styles
   ========================================================================== */

/* Homepage placements */
.damp-ad-after-hero {
    margin: 80px auto 60px;
    max-width: 728px;
}

.damp-ad-between-features {
    margin: 100px auto;
    max-width: 300px;
}

.damp-ad-before-testimonials {
    margin: 80px auto 60px;
    max-width: 728px;
}

/* Product page placements */
.damp-ad-after-specifications {
    margin: 60px auto;
    max-width: 300px;
}

.damp-ad-before-cta {
    margin: 80px auto 40px;
    max-width: 728px;
}

/* Content page placements */
.damp-ad-mid-content {
    margin: 60px auto;
    max-width: 300px;
    float: right;
    margin-left: 30px;
    margin-right: 0;
}

.damp-ad-before-footer {
    margin: 80px auto 40px;
    max-width: 728px;
    clear: both;
}

/* E-commerce placements */
.damp-ad-cart-sidebar {
    margin: 30px 0;
    max-width: 300px;
    position: sticky;
    top: 20px;
}

.damp-ad-success-celebration {
    margin: 40px auto;
    max-width: 300px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Desktop (1200px+) */
@media (min-width: 1200px) {
    .damp-ad-container {
        margin: 80px auto;
    }
    
    .damp-ad-between-features {
        position: relative;
        margin: 120px auto;
    }
    
    .damp-ad-mid-content {
        margin-right: -50px;
    }
}

/* Tablet (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    .damp-ad-container {
        margin: 60px auto;
    }
    
    .damp-ad-after-hero,
    .damp-ad-before-testimonials,
    .damp-ad-before-cta,
    .damp-ad-before-footer {
        max-width: 728px;
    }
    
    .damp-ad-mid-content {
        float: none;
        margin: 40px auto;
        max-width: 300px;
    }
}

/* Mobile (up to 767px) */
@media (max-width: 767px) {
    .damp-ad-container {
        margin: 40px auto;
        padding: 0 20px;
    }
    
    .damp-ad-unit {
        border-radius: 8px;
        max-width: 320px;
        margin: 0 auto;
    }
    
    .damp-ad-label {
        font-size: 0.65rem;
        margin-bottom: 8px;
    }
    
    /* Mobile-specific placements */
    .damp-ad-after-hero,
    .damp-ad-between-features,
    .damp-ad-before-testimonials,
    .damp-ad-after-specifications,
    .damp-ad-before-cta,
    .damp-ad-mid-content,
    .damp-ad-before-footer {
        max-width: 320px;
        float: none;
        margin: 30px auto;
    }
    
    .damp-ad-cart-sidebar {
        position: static;
        margin: 20px auto;
        max-width: 320px;
    }
}

/* ==========================================================================
   Safe Area Support (for notched devices)
   ========================================================================== */

@supports (padding: max(0px)) {
    .damp-ad-container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .damp-ad-unit {
        background: rgba(20, 20, 20, 0.9);
        border-color: rgba(0, 212, 255, 0.2);
        color: #fff;
    }
    
    .damp-ad-label {
        color: #aaa;
    }
    
    .damp-ad-unit:hover {
        box-shadow: 0 8px 24px rgba(0, 212, 255, 0.25);
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .damp-ad-container,
    .damp-ad-unit {
        transition: none;
    }
    
    .damp-ad-unit:hover {
        transform: none;
    }
}

/* Focus states for accessibility */
.damp-ad-unit:focus-within {
    outline: 2px solid var(--primary-color, #00d4ff);
    outline-offset: 4px;
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* Lazy loading states */
.damp-ad-container:not(.loaded) {
    min-height: 90px;
    background: linear-gradient(90deg, 
        rgba(0, 212, 255, 0.05) 0%, 
        rgba(0, 255, 136, 0.05) 50%, 
        rgba(0, 212, 255, 0.05) 100%);
    border-radius: 12px;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

/* ==========================================================================
   Error States
   ========================================================================== */

.damp-ad-container.error {
    display: none;
}

.damp-ad-container.blocked {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.damp-ad-container.blocked::after {
    content: "Ad blocked - Support DAMP by whitelisting our site!";
    font-size: 0.8rem;
    color: #856404;
    font-style: italic;
}