/* assets/css/style.css */
:root {
    --primary-bg: #131921;
    --secondary-bg: #232f3e;
    --accent-color: #febd69;
    --text-on-dark: #ffffff;
    --body-bg: #f3f3f3;
}

/* DARK THEME */
.theme-dark {
    --primary-bg: #000000;
    --secondary-bg: #1a1a1a;
    --accent-color: #3b82f6;
    --body-bg: #0f172a;
}
.theme-dark .bg-white { background-color: #1e293b !important; color: white !important; }
.theme-dark .text-gray-800, .theme-dark .text-gray-900, .theme-dark .text-gray-700 { color: #f1f5f9 !important; }
.theme-dark .text-gray-600 { color: #94a3b8 !important; }
.theme-dark .border-gray-200, .theme-dark .border { border-color: #334155 !important; }

/* LUXURY GOLD */
.theme-luxury {
    --primary-bg: #1a1a1a;
    --secondary-bg: #2d2d2d;
    --accent-color: #d4af37;
    --body-bg: #fdfbf7;
}
.theme-luxury .text-blue-600 { color: #b8860b !important; }
.theme-luxury .bg-blue-600 { background-color: #d4af37 !important; }

/* OCEAN BLUE */
.theme-ocean {
    --primary-bg: #075985;
    --secondary-bg: #0ea5e9;
    --accent-color: #38bdf8;
    --body-bg: #f0f9ff;
}

/* MINIMAL WHITE */
.theme-minimal {
    --primary-bg: #ffffff;
    --secondary-bg: #f8fafc;
    --accent-color: #000000;
    --body-bg: #ffffff;
    --text-on-dark: #000000;
}
.theme-minimal header.amazon-header { border-bottom: 1px solid #e2e8f0; }
.theme-minimal .bg-white { border: 1px solid #f1f5f9; }

/* SHARED STYLES */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg) !important;
}

header.amazon-header { background-color: var(--primary-bg) !important; color: var(--text-on-dark) !important; }
header.amazon-header a { color: inherit !important; }
.bg-secondary { background-color: var(--secondary-bg) !important; color: var(--text-on-dark) !important; }
.text-accent { color: var(--accent-color) !important; }
.btn-accent { background-color: var(--accent-color) !important; color: black !important; }

.product-card {
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

/* ====== GPT MULTI-SIZE AD CONTAINER (Mobile Optimized) ====== */
.ad-container {
    background: #f8f8f8;
    margin: 20px auto;
    padding: 10px;
    text-align: center;
    border: 1px dashed #ddd;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 0.8rem;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    
    /* Flexible sizing to prevent layout breaks */
    max-width: 100%;
    width: 100%;
    height: auto;
}

/* Ad Slot Wrapper: Responsive Container */
.ad-slot-wrapper {
    max-width: 100%;
    overflow: hidden;
    margin: 1rem auto;
}

/* GPT Ad Unit: Allow dynamic sizing */
.gpt-ad-unit {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Mobile-Specific Ad Constraints */
@media (max-width: 768px) {
    .ad-container {
        max-width: 100vw !important;
        padding: 8px;
        min-height: 60px;
    }
    
    /* Prevent 336x280 from breaking mobile layout */
    .gpt-ad-unit {
        max-width: calc(100vw - 2rem);
        transform-origin: top center;
    }
    
    /* Scale down oversized ads gracefully */
    .gpt-ad-unit iframe,
    .gpt-ad-unit > div {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Sticky Footer Ad: Fixed Height */
#sticky-mobile-ad .ad-container {
    min-height: 50px;
    max-height: 100px;
    margin: 0;
    border-radius: 0;
}

/* Ad Skeleton Loader */
.ad-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Collapsed Empty Ads (GPT auto-collapse support) */
.ad-container:empty,
.ad-container[data-google-query-id=""][data-is-empty="true"] {
    display: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Fluid/Native Ad Styling */
.gpt-ad-unit[data-fluid="true"] {
    width: 100% !important;
    max-width: none !important;
}

/* Prevent Ad Layout Shift (Reserve Space) */
.ad-slot-wrapper[data-ad-size="300x250"] .ad-container { min-height: 250px; }
.ad-slot-wrapper[data-ad-size="336x280"] .ad-container { min-height: 280px; }
.ad-slot-wrapper[data-ad-size="320x50"] .ad-container { min-height: 50px; max-height: 50px; }
.ad-slot-wrapper[data-ad-size="320x100"] .ad-container { min-height: 100px; max-height: 100px; }

@media (max-width: 768px) {
    .ad-slot-wrapper[data-ad-size="336x280"] .ad-container {
        min-height: 260px; /* Slightly reduce for mobile */
    }
}

/* ====== GOOGLE ANCHOR ADS (GPT) ====== */
.gpt-anchor-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: white;
    border-top: 2px solid #e5e7eb;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 100px;
}

@media (min-width: 768px) {
    .gpt-anchor-container {
        display: none; /* Only show on mobile */
    }
}

/* Vignette Overlay Styling */
#google-vignette-overlay {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ====== IN-ARTICLE ADS ====== */
.in-article-ad-wrapper {
    margin: 2rem auto;
    max-width: 100%;
}

.in-article-slot {
    transition: all 0.3s ease;
}

.in-article-slot:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.in-article-native {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ====== LINK UNITS ====== */
.link-unit-wrapper {
    margin: 1rem 0;
}

.link-unit-container {
    transition: all 0.3s ease;
}

.link-unit-fallback a {
    padding: 0.5rem 0;
    transition: all 0.2s ease;
}

.link-unit-fallback a:hover {
    padding-left: 0.5rem;
}

@media (max-width: 768px) {
    .in-article-ad-wrapper {
        margin: 1.5rem auto;
    }
    
    .in-article-native {
        min-height: 250px;
    }
}
