/**
 * Hiro Advertising Styles
 * Responsive advertisement styling for all placements
 */

/* ============================================
   BANNER ADVERTISEMENTS
   ============================================ */

/* Base ad container styles */
.ad-container {
    position: relative;
    overflow: hidden;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    transition: opacity 0.3s ease-in;
}

.ad-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
    font-family: Arial, sans-serif;
    text-align: center;
}

/* Ad placeholder styles */
.ad-placeholder {
    width: 100%;
    background-color: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
    font-family: Arial, sans-serif;
}

/* ============================================
   BANNER PLACEMENTS
   ============================================ */

/* Header Banner */
[data-ad-placement="header"] {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: block;
}

[data-ad-placement="header"] .ad-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Top Content Banner */
[data-ad-placement="top-content"] {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 10px;
    display: block;
}

[data-ad-placement="top-content"] .ad-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Sidebar Banner (Desktop only) */
[data-ad-placement="sidebar"] {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99;
    width: 160px;
}

[data-ad-placement="sidebar"] .ad-container {
    width: 160px;
    height: 600px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Footer Banner */
[data-ad-placement="footer"] {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 10px;
    display: block;
}

[data-ad-placement="footer"] .ad-container {
    max-width: 100%;
    margin: 0 auto;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    [data-ad-placement="sidebar"] {
        display: none !important;
    }

    [data-ad-placement="header"],
    [data-ad-placement="top-content"],
    [data-ad-placement="footer"] {
        padding: 10px;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    [data-ad-placement="sidebar"] {
        display: none !important;
    }

    [data-ad-placement="header"],
    [data-ad-placement="top-content"],
    [data-ad-placement="footer"] {
        padding: 5px 10px;
        margin: 10px auto;
    }

    [data-ad-placement="header"] .ad-container,
    [data-ad-placement="top-content"] .ad-container,
    [data-ad-placement="footer"] .ad-container {
        max-width: 100%;
    }
}

/* ============================================
   INTERSTITIAL ADVERTISEMENT
   ============================================ */

#interstitial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease-in;
}

#interstitial-overlay.active {
    opacity: 1;
}

#interstitial-overlay .interstitial-content {
    background-color: white;
    padding: 40px;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90%;
    position: relative;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: interstitialSlideIn 0.4s ease-out;
}

@keyframes interstitialSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#interstitial-overlay .interstitial-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    transition: color 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#interstitial-overlay .interstitial-close:hover {
    color: #333;
}

#interstitial-overlay .interstitial-ad {
    min-width: 300px;
    min-height: 250px;
    background-color: #f8f9fa;
    border: 2px dashed #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 18px;
    font-family: Arial, sans-serif;
    border-radius: 4px;
}

#interstitial-overlay .interstitial-countdown {
    margin-top: 20px;
    color: #666;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

/* Mobile interstitial adjustments */
@media (max-width: 768px) {
    #interstitial-overlay .interstitial-content {
        padding: 30px 20px;
        max-width: 95%;
        max-height: 95%;
    }

    #interstitial-overlay .interstitial-ad {
        min-width: 250px;
        min-height: 200px;
        font-size: 16px;
    }

    #interstitial-overlay .interstitial-close {
        top: 5px;
        right: 10px;
        font-size: 28px;
    }
}

/* Full-screen interstitial on mobile */
@media (max-width: 768px) {
    #interstitial-overlay.fullscreen .interstitial-content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Slide in animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ============================================
   LOADING STATES
   ============================================ */

.ad-loading {
    position: relative;
}

.ad-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   ERROR STATES
   ============================================ */

.ad-error {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.ad-error .ad-content {
    color: #856404;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* GPU acceleration for animations */
.ad-container,
#interstitial-overlay,
#interstitial-overlay .interstitial-content {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .ad-container,
    #interstitial-overlay,
    #interstitial-overlay .interstitial-content {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Screen reader only text for ads */
.ad-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for interactive ad elements */
.ad-container:focus,
#interstitial-overlay .interstitial-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ============================================
   TESTING MODE
   ============================================ */

body.testing-mode [data-ad-placement] {
    border: 2px solid #007bff;
    background-color: #e7f3ff;
}

body.testing-mode .ad-container {
    border: 2px solid #28a745;
    background-color: #d4edda;
}

body.testing-mode #interstitial-overlay {
    border: 5px solid #007bff;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Text alignment utilities */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}