/**
 * Mobile-Responsive Advertisement Styles
 * HUA Media Advertisement System
 */

/* Base ad container styles */
.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

/* Leaderboard ads - responsive behavior */
.ad-leaderboard {
    max-width: 728px;
    height: 90px;
}

@media (max-width: 768px) {
    .ad-leaderboard {
        max-width: 320px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .ad-leaderboard {
        max-width: 300px;
        height: 50px;
    }
}

/* Rectangle ads - responsive sizing */
.ad-rectangle {
    width: 300px;
    height: 250px;
    max-width: 100%;
}

@media (max-width: 768px) {
    .ad-rectangle {
        width: 300px;
        height: 250px;
    }
}

@media (max-width: 320px) {
    .ad-rectangle {
        width: 280px;
        height: 225px;
    }
}

/* Sidebar ads - hide on mobile, stack on tablet */
.ad-sidebar {
    width: 300px;
    height: 600px;
    position: sticky;
    top: 20px;
}

@media (max-width: 1024px) {
    .ad-sidebar {
        width: 300px;
        height: 250px;
        position: static;
        margin: 20px auto;
    }
}

@media (max-width: 768px) {
    .ad-sidebar {
        display: none; /* Hide sidebar ads on mobile */
    }
}

/* Mobile sticky ads */
.ad-mobile-sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: none; /* Hidden by default */
}

@media (max-width: 768px) {
    .ad-mobile-sticky {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 50px;
        padding: 8px;
    }
    
    /* Add padding to body when sticky ad is present */
    body.has-sticky-ad {
        padding-bottom: 70px;
    }
}

/* In-feed native ads - responsive behavior */
.ad-native {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
}

@media (max-width: 768px) {
    .ad-native {
        max-width: 100%;
        margin: 16px 0;
    }
}

/* Hero sponsorship badge - responsive positioning */
.ad-hero-sponsor {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
    .ad-hero-sponsor {
        top: 10px;
        right: 10px;
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* Pre-footer banner - responsive behavior */
.ad-pre-footer {
    width: 100%;
    max-width: 970px;
    height: 250px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .ad-pre-footer {
        max-width: 728px;
        height: 90px;
    }
}

@media (max-width: 768px) {
    .ad-pre-footer {
        max-width: 320px;
        height: 50px;
    }
}

/* Loading states - responsive */
.ad-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.ad-loading .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
    .ad-loading .loading-spinner {
        width: 24px;
        height: 24px;
        border-width: 2px;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive image handling */
.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.ad-image-container {
    overflow: hidden;
    border-radius: 8px;
    position: relative;
}

/* Responsive typography in ads */
.ad-title {
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
    color: #111827;
}

@media (max-width: 768px) {
    .ad-title {
        font-size: 16px;
        line-height: 1.3;
    }
}

.ad-description {
    font-size: 14px;
    line-height: 1.5;
    color: #6b7280;
}

@media (max-width: 768px) {
    .ad-description {
        font-size: 13px;
        line-height: 1.4;
    }
}

/* Responsive call-to-action buttons */
.ad-cta {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    background-color: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.2s;
}

.ad-cta:hover {
    background-color: #2563eb;
}

@media (max-width: 768px) {
    .ad-cta {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Sponsored labels - responsive */
.ad-sponsored-label {
    display: inline-block;
    background-color: #fef3c7;
    color: #d97706;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .ad-sponsored-label {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* Responsive grid layouts for multiple ads */
.ads-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

@media (max-width: 768px) {
    .ads-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Accessibility improvements */
.ad-container:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 8px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .ad-loading .loading-spinner {
        animation: none;
    }
    
    .ad-image {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ad-container {
        border: 2px solid currentColor;
    }
    
    .ad-sponsored-label {
        border: 1px solid currentColor;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ad-loading {
        background-color: #374151;
        border-color: #4b5563;
    }
    
    .ad-title {
        color: #f9fafb;
    }
    
    .ad-description {
        color: #d1d5db;
    }
    
    .ad-mobile-sticky {
        background: #1f2937;
        border-top-color: #4b5563;
    }
}