/* SKELETON LOADING ANIMATION */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(to right, #eff1f3 4%, #e2e2e2 25%, #eff1f3 36%);
    background-size: 1000px 100%;
    background-color: #eff1f3; /* Fallback color */
    
    /* Ensure it has shape even if image hasn't loaded */
    min-height: 16px; 
    min-width: 16px;
    display: inline-block;
}

/* Specific styling for the skeleton images to prevent layout shift */
.resultContainer .skeleton, 
.videoContainer .skeleton {
    border-radius: 4px; /* Soft corners */
}


html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* Critical for full height layout */
    overflow: hidden; /* Prevent body scroll, we scroll inner divs instead */
    font-family: Arial, sans-serif;
    color: #545454;
}
a { text-decoration: none; color: #000; }
/* 1. FLEX WRAPPER - Holds Header + Content */
.wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Occupy full screen height */
}

/* Index Page */
.indexPage { align-items: center; justify-content: center; }
.indexPage .searchContainer { margin-top: 20px; text-align: center; }
.indexPage .searchBox { width: 500px; padding: 10px; border-radius: 20px; border: 1px solid #ddd; outline: none; }
.indexPage .searchButton { margin-top: 20px; padding: 10px 20px; border: none; background: #f8f9fa; cursor: pointer; color: #5f6368; border-radius: 4px; }

/* Header & Tabs */
/* 2. HEADER SECTION (Static/Fixed) */
.header {
    flex: 0 0 auto; /* Don't grow, don't shrink, fit content */
    background-color: #fafafa;
    border-bottom: 1px solid #ebebeb;
    padding: 20px 20px 0;
    z-index: 100;
}
.headerContent { display: flex; align-items: center; }
.header .searchBox { width: 500px; padding: 10px; border: 1px solid #ddd; border-radius: 20px; margin-left: 20px; }
.tabsContainer { margin-left: 130px; margin-top: 15px; }
.tabList { padding: 0; margin: 0; list-style-type: none; display: flex; }
.tabList li { margin-right: 20px; padding-bottom: 10px; color: #5f6368; font-size: 13px; }
.tabList li.active { border-bottom: 3px solid #1a73e8; color: #1a73e8; font-weight: bold; }
.tabList li a { color: inherit; }

/* 3. CONTENT AREA (Holds Results + Preview) */
.contentContainer {
    display: flex; /* Makes Results and Preview sit side-by-side */
    flex: 1; /* Takes up all remaining vertical space */
    overflow: hidden; /* Prevents overflow here */
    position: relative;
}

/* Results */
/* LEFT COLUMN: Main Results */
.mainResultsSection {
    flex: 1; /* Take up all width by default */
    overflow-y: auto; /* ENABLE SCROLLING HERE */
    padding: 20px 20px 20px 150px; /* Adjust padding as needed */
    transition: flex 0.3s ease; /* Smooth transition when resizing */
}
.resultsCount { font-size: 13px; color: #808080; margin-bottom: 20px; }
.resultContainer { display: flex; flex-direction: column; margin-bottom: 25px; }
.resultContainer .title a { color: #1a0dab; font-size: 18px; font-weight: 400; }
.resultContainer .title a:hover { text-decoration: underline; }
.resultContainer .url { color: #006621; font-size: 14px; margin-bottom: 2px; }
.resultContainer .description { font-size: 14px; line-height: 1.5; color: #545454; }

/* Image Grid */
.imageResults { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.gridItem img { max-width: 100%; height: auto; border-radius: 4px; }
.gridItem .details { /*visibility: hidden;*/ font-size: 12px; color: #555; }
.gridItem:hover .details { visibility: visible; }

/* Video Results */
.videoContainer { display: flex; margin-bottom: 20px; }
.videoContainer .thumbnail { margin-right: 15px; width: 120px; }
.videoContainer .thumbnail img { width: 100%; border-radius: 4px; }
.videoContainer .details h3 { margin: 0 0 5px; font-size: 16px; }
.videoContainer .details p { font-size: 13px; color: #555; }
/* VIDEO THUMBNAIL DURATION OVERLAY */
.videoContainer .thumbnail {
    position: relative; /* Essential for absolute positioning of duration */
    display: inline-block; /* Wraps tightly around image */
}

.durationBadge {
    position: absolute;
    bottom: 15px;
    right: auto;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent black */
    color: white;
    padding: 2px 4px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 4px;
    pointer-events: none; /* Allows clicks to pass through to the image */
}

/* Pagination */
.paginationContainer { margin-left: 150px; margin-bottom: 40px; }
.pageNumberContainer { display: inline-block; margin-right: 5px; }
.pageNumber { color: #4285f4; font-size: 14px; cursor: pointer; }
.pageNumber.active { color: #000; font-weight: bold; cursor: default; }



/* RIGHT COLUMN: Image Preview */
#imagePreviewContainer {
    display: none; /* Hidden by default */
    width: 450px; /* Fixed width for preview (like YouTube sidebar) */
    flex: 0 0 auto; /* Don't shrink below 450px */
    background-color: #111;
    overflow-y: auto; /* ENABLE SCROLLING HERE */
    border-left: 1px solid #333;
    padding: 20px;
    box-sizing: border-box;
    /* Remove fixed position styles from previous version */
}

.previewContent {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.previewHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.closePreview {
    font-size: 30px;
    color: #9aa0a6;
    cursor: pointer;
}
.closePreview:hover { color: #fff; }

.previewImageSection {
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    margin-bottom: 20px;
}

#previewImage {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.previewDetails h3 {
    color: #e8eaed;
    font-family: sans-serif;
    margin: 0 0 10px 0;
}

.previewDetails p {
    color: #9aa0a6;
    font-size: 14px;
    word-break: break-all;
}

/* Action Buttons */
.actionButtons {
    display: flex;
    gap: 10px;
}

.visitBtn, .shareBtn {
    padding: 8px 16px;
    background-color: #303134;
    color: #8ab4f8;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-family: arial, sans-serif;
    border: 1px solid #3c4043;
}

.visitBtn:hover, .shareBtn:hover {
    background-color: #3c4043;
}

/* VIDEO PREVIEW SPECIFIC */
#previewVideoContainer iframe, 
#previewVideoContainer video {
    border-radius: 8px;
    background: #000;
}



/* SAFESEARCH DROPDOWN */
.safeSearchContainer {
    position: absolute;
    top: 25px;
    right: 20px;
    z-index: 200;
}
.safeSearchSelect {
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: #fff;
    color: #5f6368;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}
.safeSearchSelect:hover {
    background: #f8f9fa;
    color: #000;
}

/* BLUR EFFECT FOR ADULT CONTENT */
.blur-content {
    filter: blur(15px);
    transition: filter 0.3s ease;
    cursor: pointer;
}
.blur-content:hover {
    filter: blur(0);
}

/* Optional: Add a badge for adult content */
.adult-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 4px;
    z-index: 10;
    pointer-events: none;
}





/* Make it full screen on mobile */
/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    
    /* 1. Adjust Layout Direction */
    .wrapper {
        height: 100vh; /* Ensure full viewport height */
    }
    
    .contentContainer {
        flex-direction: column; /* Stack vertically */
        position: relative; /* Needed for absolute positioning of preview */
    }

    /* 2. Header Adjustments */
    .header {
        padding: 10px;
    }
    .headerContent {
        flex-direction: column; /* Stack logo and search bar */
        align-items: stretch;
    }
    .logoContainer {
        text-align: center;
        margin-bottom: 10px;
    }
    .header .searchBox {
        width: 100%; /* Full width search bar */
        margin-left: 0;
        box-sizing: border-box; /* Include padding in width */
    }
    .tabsContainer {
        margin-left: 0; /* Reset margin */
        margin-top: 10px;
        overflow-x: auto; /* Allow scrolling tabs if they overflow */
        white-space: nowrap;
    }
    .tabList {
        justify-content: center; /* Center tabs */
        padding-left: 0;
    }

    /* 3. Results Section */
    .mainResultsSection {
        padding: 10px 15px; /* Reduce padding */
        width: 100%;
        box-sizing: border-box;
    }
    .resultContainer {
        margin-bottom: 20px;
    }
    .resultContainer .title a {
        font-size: 16px; /* Slightly smaller font */
    }
    .paginationContainer {
        margin-left: 0; /* Remove left margin */
        text-align: center; /* Center pagination */
    }

    /* 4. Image Grid on Mobile */
    .imageResults {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
        gap: 10px;
    }
    .gridItem img {
        height: 150px; /* Fixed height for consistency */
        width: 100%;
        object-fit: cover;
    }

    /* 5. Image Preview Panel (Mobile Overlay) */
    #imagePreviewContainer {
        width: 100%; /* Full width */
        height: 80%; /* Takes up 80% of screen height */
        position: absolute; /* Overlay on top of results */
        bottom: 0; /* Stick to bottom */
        left: 0;
        border-left: none;
        border-top: 2px solid #333; /* Visual separation */
        border-radius: 15px 15px 0 0; /* Rounded top corners */
        background-color: #111;
        z-index: 1000; /* Ensure it's on top */
        box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
        padding: 15px;
    }

    /* Make the image in preview smaller on mobile so scrolling isn't crazy */
    #previewImage {
        max-height: 250px; 
    }

    /* Adjust Close Button */
    .previewHeader {
        margin-bottom: 10px;
    }
    .closePreview {
        font-size: 35px;
        padding: 0 10px;
    }
}