/**
 * Online Digital Directory - 2026 Glassmorphism Design
 * Mobile-first, Apple device optimized
 * Auto dark/light mode
 */

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

/* ==================== CSS VARIABLES ==================== */
:root {
    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;

    /* Light Mode Colors - Clean with Yellow Accents */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-gradient: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);

    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-bg-strong: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --glass-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.15);

    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-tertiary: #666666;
    --text-inverse: #ffffff;

    --accent-primary: #FFD700;
    --accent-secondary: #FFA500;
    --accent-gradient: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    --accent-glow: rgba(255, 215, 0, 0.5);

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --premium-gold: #FFD700;
    --premium-gradient: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;

    /* Blur */
    --blur-sm: 8px;
    --blur-md: 16px;
    --blur-lg: 24px;
    --blur-xl: 40px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-index layers */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 500;
    --z-splash: 1000;
    --z-toast: 1100;

    /* Safe areas for iOS */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* Light mode only - no dark mode */

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== SPLASH SCREEN ==================== */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: var(--z-splash);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    transition: opacity 0.8s ease, visibility 0.8s ease, transform 0.8s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.05);
}

.splash-bg-blur {
    position: absolute;
    inset: 0;
    background: inherit;
    filter: blur(60px) saturate(1.5);
    transform: scale(1.2);
}

.splash-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: var(--space-xl);
    max-width: 100%;
    width: 100%;
}

.splash-logo {
    margin-bottom: var(--space-xl);
}

.splash-logo .logo-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: var(--space-md);
    animation: float 3s ease-in-out infinite;
}

.splash-logo h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 800;
    color: var(--text-inverse);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.02em;
}

.splash-logo .tagline {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: var(--space-sm);
    font-weight: 500;
}

/* Splash Ads Grid */
.splash-ads-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    max-width: 600px;
    margin: 0 auto var(--space-xl);
    padding: 0 var(--space-md);
}

@media (min-width: 640px) {
    .splash-ads-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }
}

.splash-ad-tile {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--space-md);
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    cursor: pointer;
}

.splash-ad-tile:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.splash-ad-tile .tile-image {
    width: 100%;
    height: 60%;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    background-size: cover;
    background-position: center;
}

.splash-ad-tile .ad-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-inverse);
    text-align: center;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Splash Loader */
.splash-loader {
    width: 200px;
    max-width: 80%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    margin: 0 auto;
    overflow: hidden;
}

.loader-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6, #60a5fa);
    background-size: 200% 100%;
    border-radius: var(--radius-full);
    animation: loaderProgress 3s ease-out forwards, shimmerBg 1s linear infinite;
}

@keyframes loaderProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ==================== APP CONTAINER ==================== */
.app-container {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

/* ==================== HEADER ==================== */
.header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-container {
    flex: 1;
    max-width: 500px;
}

.results-count {
    font-size: 0.9rem;
    color: #666666;
    white-space: nowrap;
}

.results-count strong {
    color: #FFA500;
    font-weight: 700;
}

@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }

    .header-content {
        gap: 12px;
    }

    .logo span {
        display: none;
    }

    .search-container {
        flex: 1;
        max-width: none;
    }
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    transition: opacity var(--transition-fast);
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    font-size: 1.5rem;
}

/* SVG Logo Styling */
.logo-icon-svg {
    width: 80px;
    height: 80px;
    display: block;
    margin: 0 auto var(--space-md);
    filter: drop-shadow(0 8px 24px rgba(255, 165, 0, 0.5));
    animation: float 3s ease-in-out infinite;
}

.logo-icon-svg-small {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 8px rgba(255, 165, 0, 0.4));
}

/* Search Box */
.search-box {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #999999;
    pointer-events: none;
    font-size: 1rem;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: #ffffff;
    border: 2px solid #FFD700;
    border-radius: 25px;
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--text-primary);
    transition: all var(--transition-base);
    outline: none;
}

.search-box input::placeholder {
    color: #999999;
}

.search-box input:focus {
    border-color: #FFA500;
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.3);
}

.results-count strong {
    color: var(--accent-primary);
    font-weight: 600;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    padding: var(--space-lg) var(--space-md);
    padding-bottom: calc(var(--space-3xl) + var(--safe-bottom));
    background-color: #f7f7f7;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='150'%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' font-family='Inter,Arial,sans-serif' font-size='12' font-weight='600' fill='%23FFD700' fill-opacity='0.15' transform='rotate(-20 150 75)'%3EOnline Digital Directory%3C/text%3E%3C/svg%3E");
    background-size: 300px 150px;
    background-repeat: repeat;
}

/* ==================== FEED CONTAINER ==================== */
.feed-container {
    max-width: 1400px;
    margin: 0 auto;
}

.feed-content {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: 10px;
    grid-auto-flow: dense;
    column-gap: var(--space-lg);
    align-items: start;
    /* Allow 3D transforms to overflow */
    overflow: visible;
}

@media (min-width: 640px) {
    .feed-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .feed-content {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==================== FEED ITEMS ==================== */
.feed-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.feed-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 3D perspective for ad cards */
.feed-item.feed-ad {
    perspective: 1000px;
}

/* Staggered animation */
.feed-item:nth-child(3n+1) { transition-delay: 0ms; }
.feed-item:nth-child(3n+2) { transition-delay: 50ms; }
.feed-item:nth-child(3n+3) { transition-delay: 100ms; }

/* ==================== LISTING CARDS (FREE/UNPAID) ==================== */
.feed-listing {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.feed-listing:hover {
    border-color: #cccccc;
}

/* ==================== AD CARDS (PAID) - PREMIUM WITH GLOW & 3D ==================== */

.feed-ad {
    background: #ffffff;
    border: 3px solid #FFA500;
    border-radius: 20px;
    padding: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 20px rgba(255, 165, 0, 0.4),
        0 0 40px rgba(255, 165, 0, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.1);
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.feed-ad:hover {
    transform: rotate3d(1, 1, 0, 12deg) translateZ(10px);
    box-shadow:
        0 0 40px rgba(255, 165, 0, 0.7),
        0 0 80px rgba(255, 165, 0, 0.4),
        0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Shine effect on hover */
.feed-ad::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
    z-index: 2;
}

.feed-ad:hover::after {
    left: 150%;
}

/* ==================== CONTACT BUTTONS ON CARD FACE ==================== */
.ad-contact-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 20px 20px;
    background: linear-gradient(to top, rgba(255,165,0,0.08) 0%, transparent 100%);
    border-top: 1px solid rgba(255,165,0,0.15);
    border-radius: 0 0 17px 17px;
}

.ad-contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border: 2px solid #FFA500;
    border-radius: 50%;
    text-decoration: none;
    color: #FFA500;
    font-size: 1.25rem;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    transform: translateY(0) scale(1);
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.2);
    position: relative;
}

.ad-contact-btn:hover {
    transform: translateY(-12px) scale(1.2);
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    color: #ffffff;
    box-shadow: 0 20px 40px rgba(255, 165, 0, 0.6);
}

/* Contact button SVG icons */
.ad-contact-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Tooltip for contact buttons */
.ad-contact-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: #1a1a1a;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ad-contact-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(5px);
}

/* Stagger animation for contact buttons on card hover */
.feed-ad:hover .ad-contact-btn:nth-child(1) { transition-delay: 0ms; }
.feed-ad:hover .ad-contact-btn:nth-child(2) { transition-delay: 50ms; }
.feed-ad:hover .ad-contact-btn:nth-child(3) { transition-delay: 100ms; }
.feed-ad:hover .ad-contact-btn:nth-child(4) { transition-delay: 150ms; }

/* Push all buttons up slightly on card hover */
.feed-ad:hover .ad-contact-btn {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 12px 25px rgba(255, 165, 0, 0.4);
}

.feed-ad:hover .ad-contact-btn:hover {
    transform: translateY(-18px) scale(1.25);
    box-shadow: 0 25px 50px rgba(255, 165, 0, 0.7);
}

/* Mobile adjustments for 3D effects */
@media (max-width: 768px) {
    .feed-ad:hover {
        transform: rotate3d(1, 1, 0, 6deg);
    }

    .ad-contact-buttons {
        gap: 10px;
        padding: 12px 16px;
    }

    .ad-contact-btn {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .ad-contact-btn svg {
        width: 18px;
        height: 18px;
    }

    .feed-ad:hover .ad-contact-btn {
        transform: translateY(-5px) scale(1.02);
    }

    .feed-ad:hover .ad-contact-btn:hover {
        transform: translateY(-10px) scale(1.15);
    }

    /* Hide tooltips on mobile - use touch */
    .ad-contact-btn::after {
        display: none;
    }
}

/* Touch device optimization */
@media (hover: none) {
    .feed-ad {
        /* Less aggressive 3D on touch devices */
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .feed-ad:active {
        transform: rotate3d(1, 1, 0, 5deg) scale(0.98);
    }

    .ad-contact-btn:active {
        transform: translateY(-10px) scale(1.15);
        background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
        color: #ffffff;
        box-shadow: 0 15px 30px rgba(255, 165, 0, 0.5);
    }
}

.listing-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.listing-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.listing-category {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    background: var(--accent-gradient);
    color: var(--text-inverse);
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.listing-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.listing-address {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xs);
}

.listing-address::before {
    content: '📍';
    font-size: 0.8rem;
    flex-shrink: 0;
}

.listing-phone {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.listing-phone::before {
    content: '📞';
    font-size: 0.8rem;
}

.listing-distance {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.8rem;
    margin-top: var(--space-sm);
}

.listing-distance::before {
    content: '🚗';
    margin-right: var(--space-xs);
}

/* Ad card styles moved to top - PAID ADS section */

/* Sponsored Badge */
.sponsored-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a1a;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.5);
    z-index: 10;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 165, 0, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 6px 25px rgba(255, 165, 0, 0.7);
        transform: scale(1.05);
    }
}

/* Ad Inner - Premium Content Area */
.display-ad-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 17px;
    overflow: hidden;
    background: #ffffff;
}

.display-ad-inner.featured {
    border: 2px solid rgba(255, 165, 0, 0.5);
}

/* Ad Image */
.ad-image-container,
.ad-image {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 120px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #f5f5f5;
    border-radius: 17px 17px 0 0;
}

/* Ad image aspect ratios per ad size - match AI generated image dimensions */
/* 3:2 landscape (1536x1024) */
.ad-1col-25h .ad-image,
.ad-2col-25h .ad-image,
.ad-2col-50h .ad-image,
.ad-2col-75h .ad-image,
.ad-2col-100h .ad-image,
.ad-3col-25h .ad-image,
.ad-3col-50h .ad-image,
.ad-3col-75h .ad-image,
.ad-3col-100h .ad-image {
    aspect-ratio: 3 / 2;
    flex: none;
}
/* 3:2 landscape for 1col-50h */
.ad-1col-50h .ad-image {
    aspect-ratio: 3 / 2;
    flex: none;
}
/* 1:1 square (1024x1024) */
.ad-1col-75h .ad-image {
    aspect-ratio: 1 / 1;
    flex: none;
}
/* 2:3 portrait (1024x1536) */
.ad-1col-100h .ad-image {
    aspect-ratio: 2 / 3;
    flex: none;
}

.ad-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Full Image Card Mode — image fills entire card, no footer */
.full-image-card {
    position: relative;
}

.full-image-card .ad-image-full {
    border-radius: 17px;
}

/* Button overlay positions for full-image cards */
.ad-buttons-overlay {
    position: absolute;
    display: flex;
    justify-content: center;
    gap: 12px;
    z-index: 3;
    /* Default: bottom center */
    bottom: 12px;
    left: 0;
    right: 0;
    flex-direction: row;
    padding: 0 16px;
}

.ad-buttons-overlay.btns-top {
    top: 12px;
    bottom: auto;
    left: 0;
    right: 0;
    flex-direction: row;
    padding: 0 16px;
}

.ad-buttons-overlay.btns-left {
    left: 12px;
    right: auto;
    top: 0;
    bottom: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 16px 0;
}

.ad-buttons-overlay.btns-right {
    right: 12px;
    left: auto;
    top: 0;
    bottom: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 16px 0;
}

/* Bigger buttons for left/right side placement */
.ad-buttons-overlay.btns-left .ad-contact-btn,
.ad-buttons-overlay.btns-right .ad-contact-btn {
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
}

.ad-buttons-overlay.btns-left .ad-contact-btn svg,
.ad-buttons-overlay.btns-right .ad-contact-btn svg {
    width: 26px;
    height: 26px;
}

/* Tooltip appears to the right for left-side buttons */
.ad-buttons-overlay.btns-left .ad-contact-btn::after {
    bottom: auto;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(0);
}

.ad-buttons-overlay.btns-left .ad-contact-btn:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

/* Tooltip appears to the left for right-side buttons */
.ad-buttons-overlay.btns-right .ad-contact-btn::after {
    bottom: auto;
    right: calc(100% + 8px);
    left: auto;
    top: 50%;
    transform: translateY(-50%) translateX(0);
}

.ad-buttons-overlay.btns-right .ad-contact-btn:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(-4px);
}

/* Override vertical hover transforms for side-placed buttons */
.feed-ad:hover .ad-buttons-overlay.btns-left .ad-contact-btn,
.feed-ad:hover .ad-buttons-overlay.btns-right .ad-contact-btn {
    transform: translateY(0) scale(1.05);
}

.feed-ad:hover .ad-buttons-overlay.btns-left .ad-contact-btn:hover,
.feed-ad:hover .ad-buttons-overlay.btns-right .ad-contact-btn:hover {
    transform: translateY(0) scale(1.25);
}

.ad-buttons-overlay .ad-contact-btn {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 165, 0, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.ad-buttons-overlay .ad-contact-btn:hover {
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    color: #ffffff;
    box-shadow: 0 8px 25px rgba(255, 165, 0, 0.6);
}

/* Ad Content */
.ad-content {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.ad-business {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.3;
}

.ad-tagline {
    font-size: 0.9rem;
    color: #555555;
    margin-bottom: 16px;
    line-height: 1.5;
    flex: 1;
}

.ad-phone, .ad-address {
    font-size: 0.85rem;
    color: #666666;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.ad-phone::before { content: '📞'; }
.ad-address::before { content: '📍'; }

/* Ad Size Variations */
.feed-ad.ad-2col-25h,
.feed-ad.ad-2col-50h,
.feed-ad.ad-2col-75h,
.feed-ad.ad-2col-100h {
    grid-column: span 1;
}

.feed-ad.ad-3col-25h,
.feed-ad.ad-3col-50h,
.feed-ad.ad-3col-75h,
.feed-ad.ad-3col-100h {
    grid-column: 1 / -1;
}

@media (min-width: 640px) {
    .feed-ad.ad-2col-25h,
    .feed-ad.ad-2col-50h,
    .feed-ad.ad-2col-75h,
    .feed-ad.ad-2col-100h {
        grid-column: span 2;
    }
}

/* Min heights for ad sizes */
.feed-ad.ad-1col-25h { min-height: 180px; }
.feed-ad.ad-1col-50h { min-height: 280px; }
.feed-ad.ad-1col-75h { min-height: 380px; }
.feed-ad.ad-1col-100h { min-height: 480px; }
.feed-ad.ad-2col-25h { min-height: 200px; }
.feed-ad.ad-2col-50h { min-height: 320px; }
.feed-ad.ad-2col-75h { min-height: 440px; }
.feed-ad.ad-2col-100h { min-height: 560px; }
.feed-ad.ad-3col-25h { min-height: 220px; }
.feed-ad.ad-3col-50h { min-height: 380px; }
.feed-ad.ad-3col-75h { min-height: 540px; }
.feed-ad.ad-3col-100h { min-height: 700px; }

/* Featured/Premium Ad Styling */
.feed-ad.featured {
    border-color: var(--premium-gold);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, var(--glass-bg-strong) 100%);
}

.feed-ad.featured::before {
    background: var(--premium-gradient);
}

/* Generated ad styling */
.display-ad-inner.generated-ad {
    background: linear-gradient(135deg, var(--glass-bg) 0%, var(--glass-bg-strong) 100%);
    border-style: dashed;
    border-color: var(--text-tertiary);
}

/* ==================== PREMIUM AD ANIMATIONS ==================== */

/* GLOW Animation */
.feed-ad.anim-glow,
.display-ad-inner.anim-glow {
    animation: adGlow 2s ease-in-out infinite;
}

@keyframes adGlow {
    0%, 100% {
        box-shadow:
            0 0 20px var(--ad-border-color, var(--accent-primary)),
            0 0 40px var(--ad-border-color, var(--accent-primary)),
            var(--glass-shadow);
    }
    50% {
        box-shadow:
            0 0 30px var(--ad-border-color, var(--accent-primary)),
            0 0 60px var(--ad-border-color, var(--accent-primary)),
            0 0 80px var(--ad-border-color, var(--accent-primary)),
            var(--glass-shadow);
    }
}

/* PULSE Animation */
.feed-ad.anim-pulse,
.display-ad-inner.anim-pulse {
    animation: adPulse 2s ease-in-out infinite;
}

@keyframes adPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--ad-border-color, rgba(99, 102, 241, 0.6));
    }
    50% {
        transform: scale(1.015);
        box-shadow: 0 0 0 15px transparent;
    }
}

/* RAINBOW Animation */
.feed-ad.anim-rainbow,
.display-ad-inner.anim-rainbow {
    border: 3px solid transparent;
    background:
        linear-gradient(var(--glass-bg-strong), var(--glass-bg-strong)) padding-box,
        linear-gradient(var(--rainbow-angle, 0deg),
            #ff0080, #ff8c00, #40e0d0, #7b68ee, #ff0080) border-box;
    animation: rainbowRotate 3s linear infinite;
}

@keyframes rainbowRotate {
    0% { --rainbow-angle: 0deg; }
    100% { --rainbow-angle: 360deg; }
}

@property --rainbow-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* NEON Animation */
.feed-ad.anim-neon,
.display-ad-inner.anim-neon {
    animation: adNeon 1.5s ease-in-out infinite;
}

@keyframes adNeon {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        box-shadow:
            0 0 5px var(--ad-border-color, #00ff88),
            0 0 10px var(--ad-border-color, #00ff88),
            0 0 20px var(--ad-border-color, #00ff88),
            0 0 40px var(--ad-border-color, #00ff88),
            inset 0 0 10px rgba(0, 255, 136, 0.1);
    }
    20%, 24%, 55% {
        box-shadow: none;
    }
}

/* SHIMMER Animation */
.feed-ad.anim-shimmer,
.display-ad-inner.anim-shimmer {
    overflow: hidden;
}

.feed-ad.anim-shimmer::after,
.display-ad-inner.anim-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: shimmerMove 2.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
}

@keyframes shimmerMove {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* BREATHE Animation */
.feed-ad.anim-breathe,
.display-ad-inner.anim-breathe {
    animation: adBreathe 4s ease-in-out infinite;
}

@keyframes adBreathe {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: var(--glass-shadow);
    }
    50% {
        transform: scale(1.02);
        opacity: 0.95;
        box-shadow: var(--glass-shadow-lg);
    }
}

/* FLOAT Animation - NEW */
.feed-ad.anim-float,
.display-ad-inner.anim-float {
    animation: adFloat 3s ease-in-out infinite;
}

@keyframes adFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* PREMIUM SHINE Animation - NEW */
.feed-ad.anim-premium-shine,
.display-ad-inner.anim-premium-shine {
    overflow: hidden;
}

.feed-ad.anim-premium-shine::after,
.display-ad-inner.anim-premium-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 215, 0, 0.2) 50%,
        transparent 60%
    );
    animation: premiumShine 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
}

@keyframes premiumShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* ==================== CATEGORY HEADERS IN FEED ==================== */
.feed-category-header {
    grid-column: 1 / -1;
    padding: var(--space-lg) 0 var(--space-md);
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: var(--space-md);
}

.category-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.category-title::before {
    content: '';
    width: 4px;
    height: 1.2em;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
}

.category-count {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 400;
    margin-left: var(--space-sm);
}

/* ==================== LOADING INDICATOR ==================== */
.loading-indicator {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    gap: var(--space-md);
}

.loading-indicator.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-indicator span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Feed End */
.feed-end {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.feed-end.hidden {
    display: none;
}

/* ==================== LOCATION MODAL ==================== */
.location-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(var(--blur-sm));
    -webkit-backdrop-filter: blur(var(--blur-sm));
    padding: var(--space-lg);
}

.location-modal.hidden {
    display: none;
}

.location-modal-content {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--blur-xl));
    -webkit-backdrop-filter: blur(var(--blur-xl));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-2xl);
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--glass-shadow-lg);
}

.location-icon-large {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    animation: float 3s ease-in-out infinite;
}

.location-icon-large-svg {
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-lg);
    filter: drop-shadow(0 8px 24px rgba(255, 165, 0, 0.5));
    animation: float 3s ease-in-out infinite;
}

.location-modal-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.location-modal-content p {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

.location-btn {
    display: block;
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-bottom: var(--space-sm);
}

.location-btn.primary {
    background: var(--accent-gradient);
    color: var(--text-inverse);
}

.location-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--accent-glow);
}

.location-btn.secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.location-btn.secondary:hover {
    background: var(--glass-bg-strong);
}

.location-status {
    margin-top: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.location-status.error {
    color: var(--error);
}

/* ==================== AD OVERLAY/MODAL ==================== */
.ad-overlay-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    padding: var(--space-lg);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.ad-overlay-modal.active {
    display: flex;
    opacity: 1;
}

.ad-expanded {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--blur-xl));
    -webkit-backdrop-filter: blur(var(--blur-xl));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--glass-shadow-lg);
    animation: modalSlideUp var(--transition-base) ease-out;
}

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

.ad-expanded-header {
    position: relative;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.ad-expanded-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ad-expanded-close:hover {
    background: var(--error);
    color: var(--text-inverse);
    border-color: var(--error);
}

.ad-expanded-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
}

/* Full image expanded: show full AI ad without cropping */
.ad-expanded-image-full {
    aspect-ratio: auto;
    min-height: 300px;
    max-height: 80vh;
    background-size: contain;
    background-repeat: no-repeat;
}

.ad-expanded-content {
    padding: var(--space-xl);
}

.ad-expanded-business {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.ad-expanded-description {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-xl);
}

.ad-expanded-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.ad-expanded-info-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.ad-expanded-info-item:hover {
    background: var(--glass-bg-strong);
}

.ad-expanded-info-icon {
    font-size: 1.5rem;
}

.ad-expanded-info-text {
    color: var(--text-primary);
}

.ad-expanded-info-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.ad-expanded-info-link:hover {
    text-decoration: underline;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-3xl);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state-text {
    color: var(--text-secondary);
}

/* ==================== UTILITIES ==================== */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==================== SCROLLBAR STYLING ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .splash-screen,
    .header,
    .location-modal,
    .ad-overlay-modal {
        display: none !important;
    }

    body {
        background: white;
    }

    .feed-item {
        break-inside: avoid;
    }
}
