@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --priority-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    --targeting-gradient: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.18);
    --shadow-light: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --shadow-hover: 0 15px 35px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-radius: 20px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

.ad-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.ad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    perspective: 1000px;
}

/* Tablet layout - 2 columns */
@media (max-width: 1024px) and (min-width: 769px) {
    .ad-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Mobile layout - 1 column */
@media (max-width: 768px) {
    .ad-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .ad-container {
        padding: 1rem 0.75rem;
    }
}

.ad-card {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    transform-style: preserve-3d;
    cursor: pointer;
    box-shadow: var(--shadow-light);
    min-height: 320px;
    display: flex;
    flex-direction: column;
    opacity: 1;
}

.ad-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
    transition: var(--transition);
}

.ad-card:hover {
    transform: translateY(-12px) rotateX(5deg);
    box-shadow: var(--shadow-hover);
}

.ad-card:hover::before {
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
}

.ad-card:hover .ad-glow {
    opacity: 1;
    transform: scale(1.05);
}

.ad-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
    z-index: -1;
}

.ad-header {
    position: relative;
    padding: 1.25rem 1.25rem 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
}

.ad-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
}

.ad-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

.ad-badges {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 50px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.featured-badge {
    background: var(--secondary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.priority-badge {
    background: var(--priority-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.targeting-badge {
    background: var(--targeting-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(56, 178, 172, 0.3);
}

.plan-badge.yearly {
    background: var(--success-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.plan-badge.monthly {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

.plan-badge.weekly {
    background: var(--warning-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.3);
}

.ad-content {
    padding: 1.25rem;
    padding-top: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ad-title-section {
    margin-bottom: 1rem;
}

.ad-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.375rem;
    line-height: 1.3;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ad-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    font-weight: 400;
}

.ad-features {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    flex: 1;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-weight: 500;
}

.feature-item svg {
    color: #10b981;
    flex-shrink: 0;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 50%;
    padding: 2px;
    width: 18px;
    height: 18px;
}

.ad-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.875rem;
    margin-top: auto;
    flex-shrink: 0;
}

.earnings-highlight {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #d97706;
    backdrop-filter: blur(8px);
}

.earnings-highlight svg {
    color: #f59e0b;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.ad-button {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--primary-gradient);
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.ad-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.ad-button:hover::before {
    left: 100%;
}

.ad-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.ad-button svg {
    transition: transform 0.3s ease;
    width: 14px;
    height: 14px;
}

.ad-button:hover svg {
    transform: translateX(3px);
}

/* Featured card special styling */
.ad-card.featured {
    background: linear-gradient(135deg, rgba(245, 87, 108, 0.1) 0%, rgba(240, 147, 251, 0.1) 100%);
    border: 2px solid rgba(245, 87, 108, 0.2);
}

.ad-card.featured .ad-glow {
    background: radial-gradient(circle, rgba(245, 87, 108, 0.15) 0%, transparent 50%);
}

/* Fallback styling */
.ad-fallback {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    margin: 1.5rem 0;
    grid-column: 1 / -1;
}

.fallback-icon {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.ad-fallback h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.625rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ad-fallback p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0 0 1.5rem;
    line-height: 1.6;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--primary-gradient);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

.btn-primary svg {
    width: 14px;
    height: 14px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .ad-card {
        margin: 0 0.5rem;
        min-height: auto;
    }
    
    .ad-header {
        padding: 1rem 1rem 0;
    }
    
    .ad-content {
        padding: 1rem;
        padding-top: 0.75rem;
    }
    
    .ad-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.625rem;
    }
    
    .earnings-highlight {
        align-self: center;
    }
    
    .ad-button {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .ad-title {
        font-size: 1.125rem;
    }
    
    .ad-logo {
        width: 48px;
        height: 48px;
    }
    
    .ad-header {
        padding: 0.875rem 0.875rem 0;
    }
    
    .ad-content {
        padding: 0.875rem;
        padding-top: 0.5rem;
    }
}

/* Desktop specific improvements */
@media (min-width: 1025px) {
    .ad-container {
        padding: 2rem 1.5rem;
    }
    
    .ad-grid {
        gap: 1.75rem;
    }
    
    .ad-card {
        min-height: 340px;
    }
}

/* Large desktop */
@media (min-width: 1400px) {
    .ad-container {
        max-width: 1600px;
    }
    
    .ad-grid {
        grid-template-columns: repeat(3, minmax(360px, 1fr));
        gap: 2rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --glass-bg: rgba(0, 0, 0, 0.25);
        --glass-border: rgba(255, 255, 255, 0.1);
        --text-primary: #f7fafc;
        --text-secondary: #a0aec0;
        --shadow-light: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    }
    
    .ad-logo {
        background: rgba(0, 0, 0, 0.3);
    }
    
    .earnings-highlight {
        background: rgba(251, 191, 36, 0.2);
        color: #fbbf24;
    }
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.ad-card.featured {
    animation: float 6s ease-in-out infinite;
}

/* Loading animation */
.ad-card[data-aos] {
    opacity: 0;
    transform: translateY(20px);
}

.ad-card[data-aos].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

/* Rotation transition */
.ad-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}