/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    color: #ffffff;
    overflow-x: hidden;
    /* Performance optimizations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* Navbar Styles */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: #ffffff;
    font-size: 1rem;
    width: 300px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #4ecdc4;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
}

/* SVG search icon */
.icon-search {
    display: block;
}

/* Reset native button background for the search toggle */
.search-toggle {
    background: transparent;
    border: 0;
    padding: 0;
    color: rgba(255, 255, 255, 0.85);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.search-toggle:focus-visible {
    outline: 2px solid #4ecdc4;
    outline-offset: 2px;
}

/* Main Content */
.main-content {
    margin-top: 100px;
    padding: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

/* Card Styles */
.card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
    /* Performance optimizations */
    will-change: transform;
    contain: layout style paint;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(78, 205, 196, 0.3);
}

.card-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #ffffff;
    text-align: center;
    position: relative;
}

.card-content {
    max-height: 200px;
    overflow-y: auto;
}

/* Custom Scrollbar */
.card-content::-webkit-scrollbar {
    width: 6px;
}

.card-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.card-content::-webkit-scrollbar-thumb {
    background: rgba(78, 205, 196, 0.6);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.card-content::-webkit-scrollbar-thumb:hover {
    background: rgba(78, 205, 196, 0.8);
}

/* Site List Styles */
.site-list {
    list-style: none;
    padding: 0;
}

.site-list li {
    margin-bottom: 0.75rem;
}

.site-link {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    /* Performance optimizations */
    will-change: transform;
}

.site-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(78, 205, 196, 0.2), transparent);
    transition: left 0.5s ease;
}

.site-link:hover {
    color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(78, 205, 196, 0.3);
}

.site-link:hover::before {
    left: 100%;
}

/* Ad Card Styles */
.ad-card {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(78, 205, 196, 0.1));
    border-color: rgba(255, 107, 107, 0.3);
}

.ad-card .card-title {
    color: #ff6b6b;
    position: relative;
}

.ad-card .card-title::after {
    content: 'SPONSORED';
    position: absolute;
    top: -0.5rem;
    right: 0;
    font-size: 0.7rem;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.ad-content {
    text-align: center;
    padding: 1rem 0;
}

.ad-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.ad-content p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.ad-link {
    display: inline-block;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: #ffffff;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.ad-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* SEO Content Section - Hide on mobile but keep accessible to search engines */
.seo-content {
    display: block;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .cards-container {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0 1rem;
    }
    
    /* Compact header: title left, icon right, collapsed input by default */
    .search-container { flex: 1; display: flex; align-items: center; justify-content: flex-end; position: relative; }
    .search-container #searchForm { width: 100%; }
    .search-input {
        width: 0;
        max-width: none;
        opacity: 0;
        pointer-events: none;
        padding-left: 2.5rem;
        transition: width 0.25s ease, opacity 0.2s ease;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
    }
    .search-icon { position: relative; left: auto; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; }
    .search-icon:hover { background: rgba(255, 255, 255, 0.08); }

    /* Expanded state */
    body.search-open .nav-title { display: none; }
    body.search-open .search-input {
        width: min(100vw - 2rem, 520px);
        opacity: 1;
        pointer-events: auto;
        position: static;
        transform: none;
    }
    body.search-open .search-container { justify-content: stretch; }
    body.search-open .search-toggle { position: absolute; left: 0.75rem; }
    
    .main-content {
        padding: 1rem;
        margin-top: 120px;
    }
    
    .cards-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .nav-title { font-size: 1.3rem; }
    
    /* Hide SEO content section on mobile devices */
    .seo-content {
        display: none;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .card {
        padding: 0.75rem;
    }
    
    .card-title {
        font-size: 1.2rem;
    }
    
    .site-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
}

/* Mobile fixed bottom banner ad (hidden by default) */
.mobile-banner-ad {
    display: none;
}

@media (max-width: 768px) {
    /* Reserve space so bottom content isn't obscured by the banner */
    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-banner-ad {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2000;
        display: block;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(8px);
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        padding: 10px calc(12px + env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
    }

    .mobile-banner-ad .ad-inner {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        color: rgba(255, 255, 255, 0.85);
        font-size: 0.95rem;
    }

    .mobile-banner-ad .ad-link {
        display: inline-block;
        background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
        color: #ffffff;
        text-decoration: none;
        padding: 0.5rem 0.9rem;
        border-radius: 18px;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* Loading Animation - Optimized */
.card {
    animation: fadeInUp 0.4s ease-out;
    /* Performance optimization */
    animation-fill-mode: both;
}

.card.animate-in {
    animation: fadeInUp 0.4s ease-out;
}

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

/* GPU acceleration for animations */
.card,
.site-link,
.ad-link {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Search Results Highlighting */
.highlight {
    background: rgba(78, 205, 196, 0.3);
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}

/* Hidden class for search functionality - Optimized */
.hidden {
    display: none !important;
    /* Performance optimization */
    visibility: hidden;
    pointer-events: none;
}

/* Optimized search results */
.search-results-container {
    contain: layout style paint;
}

/* Reduce repaints during search */
.card-content {
    contain: layout style;
}

/* Ripple effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(78, 205, 196, 0.3);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}
