/**
 * FIXES.CSS - Comprehensive styling fixes
 * Addresses: centering, contrast, background, ads, professional appearance
 */

/* ============================================
   FIX 1: BACKGROUND & HORIZONTAL SCROLL
   ============================================ */

html, body {
    /* Prevent horizontal scroll */
    overflow-x: hidden;
    max-width: 100vw;
    /* Fix background duplication */
    background-attachment: fixed;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
}

body {
    /* Remove width: 100% that causes overflow */
    width: 100vw;
}

/* Ensure no child elements cause horizontal scroll */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* ============================================
   FIX 2: HEADER CONTRAST & READABILITY
   ============================================ */

.header-text {
    /* Subtle text shadow + outline for readability */
    text-shadow:
        1px 1px 3px rgba(0, 0, 0, 0.8),
        -1px -1px 1px rgba(0, 0, 0, 0.6);
    /* Add subtle white outline for better contrast against any background */
    -webkit-text-stroke: 0.5px rgba(255, 255, 255, 0.3);
}

.header-subtext {
    /* Subtle text shadow for readability */
    text-shadow:
        1px 1px 2px rgba(0, 0, 0, 0.8),
        -1px -1px 1px rgba(0, 0, 0, 0.5);
    /* Add subtle white outline */
    -webkit-text-stroke: 0.3px rgba(255, 255, 255, 0.2);
}

#above-menu-background {
    /* Keep original semi-transparent background - no changes */
}

/* ============================================
   FIX 3: WRAPPER & CONTENT CENTERING
   ============================================ */

/* Wrapper centering */
#wrapper {
    max-width: 100vw;
    overflow-x: hidden;
    margin: 0 auto;
}

/* Content area centering */
#content {
    max-width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
}

/* Body wrapper improvements */
.body-wrapper {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0 auto;
}

/* Main box centering - ensure all boxes are centered */
.main-box {
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 970px;
    display: block !important;
}

/* Fix for category boxes and content sections */
.category-box,
.main-container,
div[style*="width"],
.body-wrapper > div,
#content > div {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Fix for box1 class (used on homepage for category boxes) */
.box1 {
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
    max-width: 970px;
}

/* Ensure all text content is centered within containers */
.center,
.text-center {
    text-align: center !important;
    margin: 0 auto !important;
}

/* ============================================
   FIX 4: ANIMAL PAGE CONTENT CENTERING
   ============================================ */

/* Main container for animal pages */
.main-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0;
}

/* Animal page content wrapper */
.animal-page-content {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 2.5rem;
    margin: 1rem auto;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 100%;
    text-align: left;
}

/* Ensure page introduction is properly styled */
.page-introduction {
    font-size: 1.15em;
    line-height: 1.7;
    color: #2c3e50;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #fff3e0 100%);
    border-left: 5px solid #FF6B6B;
    border-radius: 8px;
}

/* ============================================
   FIX 5: IMPROVED TYPOGRAPHY & SPACING
   ============================================ */

.animal-page-content p {
    font-size: 1.05em;
    line-height: 1.8;
    margin-bottom: 1.3rem;
    color: #2c3e50;
}

.animal-page-content h2 {
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.8em;
    color: #2c3e50;
}

/* Feature list (Cool Facts) */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.feature-list li {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-left: 6px solid #4ECDC4;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.feature-list li:hover {
    transform: translateX(8px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    border-left-color: #FF6B6B;
}

.feature-list li strong {
    color: #FF6B6B;
    font-size: 1.1em;
}

/* ============================================
   FIX 6: STRATEGIC AD PLACEMENTS
   ============================================ */

/* Ad container styles - professional and non-intrusive */
.ad-container {
    margin: 2.5rem auto;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 2px dashed #95a5a6;
    border-radius: 12px;
    text-align: center;
    max-width: 728px;
    position: relative;
    overflow: hidden;
}

.ad-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #FF6B6B, #4ECDC4, #FFE66D);
}

.ad-label {
    font-size: 0.75em;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Top of page ad - after introduction */
.ad-top {
    margin: 2rem auto;
}

/* Middle of content ad - between sections */
.ad-middle {
    margin: 3rem auto;
}

/* Bottom of page ad - after content */
.ad-bottom {
    margin: 2.5rem auto 1.5rem;
}

/* Sidebar ad (for wider screens) */
.ad-sidebar {
    position: sticky;
    top: 20px;
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Ad placeholder (for Google AdSense/similar) */
.ad-placeholder {
    min-height: 250px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
    font-style: italic;
}

/* ============================================
   FIX 7: RESPONSIVE AD LAYOUT
   ============================================ */

@media (min-width: 1200px) {
    /* Two-column layout for large screens */
    .content-with-sidebar {
        display: grid;
        grid-template-columns: 1fr 300px;
        gap: 2rem;
        max-width: 1400px;
        margin: 0 auto;
    }

    .main-content {
        min-width: 0; /* Prevent grid blowout */
    }
}

@media (max-width: 768px) {
    /* Stack ads vertically on mobile */
    .ad-sidebar {
        position: static;
        margin: 2rem auto;
    }

    .ad-container {
        max-width: 100%;
        padding: 1rem;
    }

    .animal-page-content {
        padding: 1.5rem;
    }
}

/* ============================================
   FIX 8: SOCIAL MEDIA BUTTONS CENTERING
   ============================================ */

.social-buttons {
    text-align: center !important;
    margin: 0 auto !important;
    display: block !important;
    width: 100% !important;
}

.a2a_kit {
    display: inline-block !important;
    margin: 0 auto !important;
}

/* ============================================
   FIX 9: NAVIGATION IMPROVEMENTS
   ============================================ */

/* Keep original navigation styling - only minor improvements */
nav li a {
    /* Slightly better text shadow for readability - subtle improvement */
    text-shadow:
        1px 1px 3px rgba(0, 0, 0, 0.8),
        0 0 5px rgba(0, 0, 0, 0.5);
}

/* ============================================
   FIX 10: PROFESSIONAL POLISH
   ============================================ */

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Better focus states for accessibility */
*:focus-visible {
    outline: 3px solid #FFE66D;
    outline-offset: 3px;
    border-radius: 4px;
}

/* Main box improvements */
.main-box {
    margin: 2rem auto !important;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.2),
        0 5px 15px rgba(0, 0, 0, 0.15) !important;
}

/* Keep original page title styling - no changes */
/* Keep original page sub-titles styling - no changes */

/* ============================================
   FIX 11: QUICK FACTS BOX CENTERING
   ============================================ */

.quick-facts-box {
    max-width: 600px;
    margin-left: auto !important;
    margin-right: auto !important;
}

.quick-facts-table {
    width: 100%;
    margin: 0 auto;
}

/* ============================================
   FIX 12: IN-CONTENT AD STYLING
   ============================================ */

/* In-content ads that blend with article flow */
.ad-in-content {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe9e9 100%);
    border: 2px solid #ffd700;
    margin: 2rem 0;
}

.ad-context {
    font-size: 0.9em;
    color: #555;
    font-style: italic;
    margin-bottom: 0.5rem;
}

/* Ad slot wrapper */
.ad-slot {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 6px;
    padding: 1rem;
}

/* Responsive ad sizes */
@media (max-width: 768px) {
    .ad-container {
        margin: 1.5rem 0;
        padding: 1rem;
    }

    .ad-slot {
        min-height: 200px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .ad-slot {
        min-height: 280px;
    }
}

/* Ad loading state */
.ad-slot:empty::after {
    content: 'Loading advertisement...';
    color: #95a5a6;
    font-style: italic;
    font-size: 0.9em;
}

/* ============================================
   FIX 13: PRINT & ACCESSIBILITY
   ============================================ */

@media print {
    .ad-container,
    .ad-sidebar {
        display: none !important;
    }

    .animal-page-content {
        box-shadow: none;
        background: white;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .header-text,
    .header-subtext {
        background: rgba(0, 0, 0, 0.9);
    }

    .animal-page-content {
        border: 3px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}
