/* ===============================================================================
   AnywhereCoin - Modular Dynamic Advertisement System Styles
   File: ads/ad-styles.css
   
   FEATURES:
   - Responsive ad containers (horizontal banners and perfect squares)
   - Beautiful animations (gradient shifts, pulses, waves, sparkles)
   - Light/dark theme support with smooth transitions
   - Professional placeholder design ready for Google Ads
   - Mobile-optimized with proper scaling
   
   =============================================================================== */

/* ===============================================================================
   BASE AD CONTAINER STYLES
   =============================================================================== */

/* Main ad container - adaptable to different sizes */
.dynamic-ad-container {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Hover effects for better interactivity */
.dynamic-ad-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}

/* Dark theme support */
[data-theme="night"] .dynamic-ad-container {
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
  border-color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="night"] .dynamic-ad-container:hover {
  border-color: #64748b;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* ===============================================================================
   AD TYPE SPECIFIC LAYOUTS
   =============================================================================== */

/* Horizontal ads (header leaderboard and footer) */
.ad-horizontal {
  min-height: 90px;
  width: 100%;
}

.ad-horizontal .ad-content {
  height: 100%;
  min-height: 90px;
}

/* Square ads (sidebar) */
.ad-square {
  aspect-ratio: 1 / 1;
  width: 100%;
  display: grid;
  place-items: center;
}

.ad-square .ad-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-square .ad-inner {
  flex-direction: column;
  text-align: center;
  gap: 1rem;
}

.ad-square .ad-brand {
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
}

/* ===============================================================================
   AD CONTENT STRUCTURE
   =============================================================================== */

/* Main content wrapper */
.ad-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 1.25rem;
  height: 100%;
  width: 100%;
}

/* Inner content layout */
.ad-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex: 1;
  gap: 1rem;
}

/* Brand section (logo + text) */
.ad-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

/* ===============================================================================
   ANIMATED LOGO SYSTEM
   =============================================================================== */

/* Logo container */
.ad-icon {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

/* Animated logo background */
.ad-logo {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899, #f59e0b, #10b981);
  background-size: 300% 300%;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: gradientFlow 6s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

/* Logo icon */
.ad-logo-icon {
  color: white;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  z-index: 2;
  position: relative;
}

/* Logo shine effect */
.ad-logo::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
  animation: logoShine 4s ease-in-out infinite;
  z-index: 1;
}

/* ===============================================================================
   TEXT CONTENT STYLING
   =============================================================================== */

/* Text container */
.ad-text {
  flex: 1;
  min-width: 0; /* Prevent text overflow */
}

.ad-square .ad-text {
  text-align: center;
}

/* Main title */
.ad-title {
  font-weight: 600;
  font-size: 1rem;
  color: #1e293b;
  margin-bottom: 0.25rem;
  transition: opacity 0.3s ease, color 0.3s ease;
  line-height: 1.3;
}

/* Subtitle */
.ad-subtitle {
  font-size: 0.85rem;
  color: #64748b;
  transition: opacity 0.3s ease, color 0.3s ease;
  line-height: 1.4;
}

/* Dark theme text colors */
[data-theme="night"] .ad-title {
  color: #f1f5f9;
}

[data-theme="night"] .ad-subtitle {
  color: #94a3b8;
}

/* ===============================================================================
   AD BADGE STYLING
   =============================================================================== */

/* Badge container */
.ad-badge {
  flex-shrink: 0;
}

/* Badge label */
.ad-label {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
  transition: all 0.3s ease;
}

.ad-label:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* ===============================================================================
   BACKGROUND ANIMATIONS
   =============================================================================== */

/* Animation container */
.ad-animation {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

/* Pulsing background effect */
.ad-pulse {
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 30%, transparent 70%);
  animation: pulseAnimation 4s ease-in-out infinite;
}

/* Wave effect */
.ad-wave {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(139, 92, 246, 0.1) 50%, transparent 100%);
  animation: waveAnimation 8s ease-in-out infinite;
}

/* Sparkle effects */
.ad-sparkle {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.3) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.3) 1px, transparent 1px),
    radial-gradient(circle at 60% 20%, rgba(236, 72, 153, 0.3) 1px, transparent 1px),
    radial-gradient(circle at 30% 80%, rgba(16, 185, 129, 0.3) 1px, transparent 1px);
  background-size: 50px 50px, 60px 60px, 40px 40px, 70px 70px;
  animation: sparkleAnimation 6s ease-in-out infinite;
  opacity: 0.6;
}

/* ===============================================================================
   KEYFRAME ANIMATIONS
   =============================================================================== */

/* Gradient flow animation for logo */
@keyframes gradientFlow {
  0%, 100% { 
    background-position: 0% 50%; 
    transform: scale(1);
  }
  25% { 
    background-position: 50% 0%; 
    transform: scale(1.05);
  }
  50% { 
    background-position: 100% 50%; 
    transform: scale(1);
  }
  75% { 
    background-position: 50% 100%; 
    transform: scale(1.05);
  }
}

/* Logo shine animation */
@keyframes logoShine {
  0% { 
    transform: translateX(-100%) translateY(-100%) rotate(45deg); 
  }
  50% { 
    transform: translateX(100%) translateY(100%) rotate(45deg); 
  }
  100% { 
    transform: translateX(200%) translateY(200%) rotate(45deg); 
  }
}

/* Pulse animation */
@keyframes pulseAnimation {
  0%, 100% { 
    transform: scale(0.8) rotate(0deg);
    opacity: 0;
  }
  50% { 
    transform: scale(1.2) rotate(180deg);
    opacity: 1;
  }
}

/* Wave animation */
@keyframes waveAnimation {
  0% { 
    left: -100%;
    opacity: 0;
  }
  25% { 
    opacity: 1;
  }
  75% { 
    opacity: 1;
  }
  100% { 
    left: 100%;
    opacity: 0;
  }
}

/* Sparkle animation */
@keyframes sparkleAnimation {
  0%, 100% { 
    opacity: 0.3;
    transform: scale(1) rotate(0deg);
  }
  50% { 
    opacity: 0.8;
    transform: scale(1.1) rotate(180deg);
  }
}

/* ===============================================================================
   RESPONSIVE DESIGN
   =============================================================================== */

/* Tablet adjustments */
@media (max-width: 992px) {
  .ad-content {
    padding: 1rem;
  }
  
  .ad-title {
    font-size: 0.95rem;
  }
  
  .ad-subtitle {
    font-size: 0.8rem;
  }
  
  .ad-icon {
    width: 32px;
    height: 32px;
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .ad-content {
    padding: 0.875rem;
  }
  
  .ad-title {
    font-size: 0.9rem;
  }
  
  .ad-subtitle {
    font-size: 0.75rem;
  }
  
  .ad-icon {
    width: 28px;
    height: 28px;
  }
  
  .ad-logo-icon {
    font-size: 14px;
  }
  
  .ad-brand {
    gap: 0.75rem;
  }
  
  .ad-square .ad-brand {
    gap: 0.5rem;
  }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
  .ad-horizontal {
    min-height: 80px;
  }
  
  .ad-horizontal .ad-content {
    min-height: 80px;
  }
  
  .ad-content {
    padding: 0.75rem;
  }
  
  .ad-inner {
    gap: 0.75rem;
  }
  
  .ad-label {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
  }
}

/* ===============================================================================
   LOADING AND ERROR STATES
   =============================================================================== */

/* Loading state */
.ad-loading .ad-content {
  opacity: 0.7;
}

.ad-loading .ad-logo {
  animation: gradientFlow 1s ease-in-out infinite, spin 2s linear infinite;
}

.ad-loading .ad-title,
.ad-loading .ad-subtitle {
  opacity: 0.5;
}

/* Error state */
.ad-error {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fecaca;
}

[data-theme="night"] .ad-error {
  background: linear-gradient(135deg, #441e1e 0%, #552626 100%);
  border-color: #7c2d2d;
}

.ad-error .ad-title {
  color: #dc2626;
}

.ad-error .ad-subtitle {
  color: #991b1b;
}

[data-theme="night"] .ad-error .ad-title {
  color: #f87171;
}

[data-theme="night"] .ad-error .ad-subtitle {
  color: #ef4444;
}

/* Spin animation for loading */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===============================================================================
   HIGH CONTRAST MODE SUPPORT
   =============================================================================== */

/* High contrast accessibility support */
@media (prefers-contrast: high) {
  .dynamic-ad-container {
    border-width: 2px;
    background: #ffffff;
  }
  
  [data-theme="night"] .dynamic-ad-container {
    background: #000000;
    border-color: #ffffff;
  }
  
  .ad-title {
    font-weight: 700;
  }
  
  .ad-label {
    background: #000000;
    color: #ffffff;
  }
  
  [data-theme="night"] .ad-label {
    background: #ffffff;
    color: #000000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .dynamic-ad-container,
  .ad-logo,
  .ad-label,
  .ad-title,
  .ad-subtitle {
    transition: none;
  }
  
  .ad-logo,
  .ad-pulse,
  .ad-wave,
  .ad-sparkle {
    animation: none;
  }
  
  .dynamic-ad-container:hover {
    transform: none;
  }
}