/**
 * Google Ads Styles
 * Optimized for revenue generation and user experience
 */

/* Ad Zone Containers */
.ad-zone {
  margin: 20px 0;
  text-align: center;
  overflow: hidden;
  border-radius: 8px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
}

/* Header Ad Zone */
.ad-zone-header {
  margin: 0 0 20px 0;
  padding: 10px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: none;
  border-bottom: 2px solid #007cba;
}

/* Sidebar Ad Zone */
.ad-zone-sidebar {
  margin: 20px 0;
  padding: 15px;
  background: #ffffff;
  border: 1px solid #dee2e6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Before Footer Ad Zone */
.ad-zone-before-footer {
  margin: 40px 0 20px 0;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
}

/* Google Ad Base Styles */
.google-ad {
  display: block;
  margin: 0 auto;
  text-align: center;
  min-height: 90px;
  position: relative;
  overflow: hidden;
}

/* Header Ad */
.google-ad-header {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: 0 auto 20px auto;
}

/* Sidebar Ad */
.google-ad-sidebar {
  width: 100%;
  max-width: 300px;
  min-height: 250px;
  margin: 0 auto;
}

/* In-Content Ads */
.google-ad-in-content-1,
.google-ad-in-content-2,
.google-ad-in-content-3 {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: 30px auto;
  padding: 20px;
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Before Footer Ad */
.google-ad-before-footer {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: 0 auto;
}

/* Footer Ad */
.google-ad-footer {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: 20px auto 0 auto;
}

/* Mobile Ad */
.google-ad-mobile {
  width: 100%;
  max-width: 320px;
  min-height: 100px;
  margin: 20px auto;
}

/* AdSense Responsive */
.adsbygoogle {
  display: block !important;
  margin: 0 auto !important;
}

/* Ad Loading States */
.google-ad:empty::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Ad Placeholder */
.google-ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: inherit;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  color: #6c757d;
  font-size: 14px;
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
  .google-ad-header,
  .google-ad-in-content-1,
  .google-ad-in-content-2,
  .google-ad-in-content-3,
  .google-ad-before-footer,
  .google-ad-footer {
    max-width: 320px;
    min-height: 100px;
  }

  .google-ad-sidebar {
    max-width: 100%;
    min-height: 100px;
  }

  .ad-zone {
    margin: 15px 0;
    padding: 10px;
  }

  .ad-zone-header {
    margin: 0 0 15px 0;
    padding: 8px;
  }

  .ad-zone-before-footer {
    margin: 30px 0 15px 0;
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .google-ad-header,
  .google-ad-in-content-1,
  .google-ad-in-content-2,
  .google-ad-in-content-3,
  .google-ad-before-footer,
  .google-ad-footer {
    max-width: 300px;
    min-height: 100px;
  }

  .ad-zone {
    margin: 10px 0;
    padding: 8px;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .google-ad {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Print Styles */
@media print {
  .google-ad,
  .ad-zone {
    display: none !important;
  }
}

/* Accessibility */
.google-ad:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Ad Performance Optimization */
.google-ad {
  contain: layout style paint;
  will-change: transform;
}

/* Hover Effects for Better UX */
.ad-zone:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: box-shadow 0.3s ease;
}

/* Ad Loading Animation */
.google-ad.loading {
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.google-ad.loaded {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Ad Error States */
.google-ad.error {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  color: #c53030;
}

.google-ad.error::before {
  content: "Ad temporarily unavailable";
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: inherit;
  font-size: 14px;
  color: #c53030;
}

/* Ad Success States */
.google-ad.success {
  border: 1px solid #c6f6d5;
  background: #f0fff4;
}

/* Ad Analytics Tracking */
.google-ad[data-ad-status="loaded"] {
  border-color: #48bb78;
}

.google-ad[data-ad-status="error"] {
  border-color: #f56565;
}

/* Ad Viewability Optimization */
.google-ad {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.google-ad.hidden {
  visibility: hidden;
  opacity: 0;
}

/* Ad Refresh Controls */
.ad-refresh-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 12px;
  color: #6c757d;
}

.ad-refresh-button {
  background: #007cba;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s ease;
}

.ad-refresh-button:hover {
  background: #005a87;
}

/* Ad Performance Metrics */
.ad-performance {
  display: none;
  font-size: 11px;
  color: #6c757d;
  margin-top: 5px;
  text-align: center;
}

.ad-performance.show {
  display: block;
}

/* Ad A/B Testing */
.google-ad[data-test="variant-a"] {
  border-left: 4px solid #007cba;
}

.google-ad[data-test="variant-b"] {
  border-left: 4px solid #48bb78;
}

/* Ad Revenue Optimization */
.google-ad[data-revenue="high"] {
  border: 2px solid #f6ad55;
  background: #fffaf0;
}

.google-ad[data-revenue="medium"] {
  border: 2px solid #68d391;
  background: #f0fff4;
}

.google-ad[data-revenue="low"] {
  border: 2px solid #fc8181;
  background: #fff5f5;
}
