/**
 * Advertisement Styles
 * Responsive and user-friendly ad layouts
 */

/* Base ad container styles */
.ad-wrapper {
    margin: 20px 0;
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
}

.ad-container {
    display: inline-block;
    margin: 0 auto;
    position: relative;
}

/* Ad type specific styles */
.ad-banner-728x90 {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

.ad-rectangle-300x250 {
    width: 300px;
    height: 250px;
    max-width: 100%;
}

.ad-mobile-banner {
    width: 320px;
    height: 50px;
    max-width: 100%;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .ad-banner-728x90 {
        width: 320px;
        height: 50px;
    }
    
    .ad-rectangle-300x250 {
        width: 300px;
        height: 250px;
    }
    
    .ad-wrapper {
        margin: 15px 0;
        padding: 8px;
    }
}

@media (max-width: 320px) {
    .ad-banner-728x90,
    .ad-rectangle-300x250,
    .ad-mobile-banner {
        max-width: 280px;
    }
}

/* Header ad positioning */
.header + .ad-wrapper {
    margin-top: 25px;
    margin-bottom: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.header + .ad-wrapper::before {
    content: "📢 תמיכה באתר";
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
    opacity: 0.8;
}

/* Results section ad positioning */
.stats-grid + .ad-wrapper {
    margin: 30px 0;
    background: #e8f5e8;
    border-color: #c8e6c9;
}

.stats-grid + .ad-wrapper::before {
    content: "💼 מוצרים פיננסיים מומלצים";
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
    color: #2e7d32;
}

/* Transaction table ad positioning */
.filters-section .ad-wrapper {
    margin-bottom: 20px;
    background: #fff3e0;
    border-color: #ffcc02;
}

.filters-section .ad-wrapper::before {
    content: "🏦 כלים פיננסיים נוספים";
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
    color: #f57c00;
}

/* Mobile sticky banner */
.ad-mobile-banner.sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

/* Close button for sticky mobile ads */
.ad-mobile-banner.sticky::after {
    content: "✕";
    position: absolute;
    top: 2px;
    right: 5px;
    background: rgba(0,0,0,0.5);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    opacity: 0.7;
}

.ad-mobile-banner.sticky:hover::after {
    opacity: 1;
}

/* Ad loading states */
.ad-container.loading {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
}

.ad-container.loading::before {
    content: "טוען מודעה...";
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Ad error states */
.ad-container.error {
    background: #ffeaa7;
    color: #d63031;
    padding: 10px;
    font-size: 12px;
    text-align: center;
}

.ad-container.error::before {
    content: "⚠️ שגיאה בטעינת מודעה";
}

/* Hide ads when disabled */
.ads-disabled .ad-wrapper,
.ads-disabled .ad-container {
    display: none !important;
}

/* AdSense specific styles */
.adsbygoogle {
    display: block;
    margin: 0 auto;
}

/* Responsive ads */
.adsbygoogle[data-ad-format="auto"] {
    width: 100%;
}

/* Privacy-friendly styling */
.ad-wrapper.privacy-notice::after {
    content: "מודעה מוצגת לתמיכה באתר";
    display: block;
    font-size: 10px;
    color: #6c757d;
    margin-top: 5px;
    font-style: italic;
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
    .ad-wrapper {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .stats-grid + .ad-wrapper {
        background: #2f4f2f;
        border-color: #4a6741;
    }
    
    .filters-section .ad-wrapper {
        background: #4a3728;
        border-color: #8b6914;
    }
}

/* High DPI display optimization */
@media (-webkit-min-device-pixel-ratio: 2), 
       (min-resolution: 192dpi) {
    .ad-wrapper {
        border-width: 0.5px;
    }
}

/* Accessibility improvements */
.ad-wrapper:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* RTL (Hebrew) specific adjustments */
[dir="rtl"] .ad-wrapper::before {
    text-align: right;
}

[dir="rtl"] .ad-mobile-banner.sticky::after {
    right: auto;
    left: 5px;
}

/* Animation for ad appearance */
.ad-wrapper {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Prevent ads from breaking layout */
.ad-container img,
.ad-container iframe {
    max-width: 100%;
    height: auto;
}

/* Special spacing for specific locations */
.tabs + .ad-wrapper {
    margin-bottom: 30px;
}

.simulation-results .ad-wrapper {
    margin-top: 25px;
    background: #f3e5f5;
    border-color: #ce93d8;
}

.insights .ad-wrapper {
    margin: 20px 0;
    background: #fce4ec;
    border-color: #f48fb1;
}

/* Print media - hide ads */
@media print {
    .ad-wrapper,
    .ad-container {
        display: none !important;
    }
}
