/* =================================================================
   CLEANED & ORGANIZED HOMEPAGE STYLING
   ================================================================= */

/* --- 0. CORE & GENERAL STYLING --- */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}

.homepage-section {
    padding: 80px 0;
}

.light-bg-section,
.app-categories-section /* Merged */ {
    background-color: #f8fafc;
}

.homepage-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    margin-bottom: 50px;
}

.section-subtitle {
    max-width: 600px;
    margin: -20px auto 40px;
    text-align: center;
    color: #475569;
}

/* --- 1. HERO SECTION --- */
.apk-hero-section {
    position: relative;
    padding: 100px 0;
    text-align: center;
    background-color: #0f172a;
}

.apk-hero-overlay {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(#334155 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.1;
}

.apk-hero-content {
    position: relative;
    z-index: 2;
}

.apk-hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: 45px;
    font-weight: 700;
    margin: 0 0 15px;
    color: #fff;
}

.apk-hero-title .text-golden {
    color: #f59e0b;
}

.apk-hero-subtitle {
    font-size: 16px;
    color: #cbd5e1;
    max-width: 550px;
    margin: 0 auto 40px auto;
    padding: 0 20px;
    line-height: 1.6;
}

.hero-stats-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.7);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid #334155;
    text-align: center;
    min-width: 150px;
}

.stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.stat-label {
    font-size: 12px;
    color: #94a3b8;
}

/* --- 2. WHY TRUST US SECTION --- */
.why-trust-us-section {
    padding: 60px 0;
    background-color: #ffffff; /* <<< UPDATED: Background is now white */
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.trust-card {
    text-align: center;
}

.trust-card i { /* This likely needs to be an icon class e.g., .fa */
    font-size: 28px;
    color: #f59e0b;
    margin-bottom: 15px;
}

.trust-card h4 {
    font-size: 18px;
    color: #0f172a;
    margin-bottom: 5px;
}

.trust-card p {
    font-size: 15px;
    color: #334155;
    line-height: 1.6;
}

/* --- 3. FEATURED APPS (GRID LAYOUT) --- */
.featured-apps-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.featured-card-large {
    grid-row: span 2;
}

.featured-small-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.featured-card {
    position: relative;
    display: block;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    aspect-ratio: 1 / 1;
}

.featured-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.featured-card:hover img {
    transform: scale(1.08);
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 80%);
}

.card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    color: #fff;
    z-index: 2;
    box-sizing: border-box;
}

.featured-card-large .card-title {
    font-size: 24px;
    padding: 5px;
}

.featured-badge-new {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 3;
    background: #f59e0b;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
}

/* --- 4. REUSABLE & DETAILED APP CARDS (Recent, Trending, etc.) --- */
/* Common Grid */
.apps-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Simple App Card */
.app-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.app-card.risk-low-risk:hover { border-color: #16a34a; }
.app-card.risk-high-risk:hover { border-color: #ef4444; }
.app-card a { text-decoration: none; }

.app-card-icon {
    padding: 20px;
    text-align: center;
}

.app-card-icon img {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: block;
    margin: 0 auto;
}

.app-card-info {
    padding: 15px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
}

.app-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 10px;
}

.app-card-meta {
    display: flex;
    justify-content: space-around;
    font-size: 12px;
    color: #64748b;
}

/* =================================================================
   UNIVERSAL APP CARD & GRID STYLING (FINAL VERSION)
   ================================================================= */

/* --- 1. Universal Grid Layout --- */
.universal-apps-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* 6 columns on desktop */
    gap: 20px;
}

/* --- 2. Card Structure --- */
.app-card-detailed {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}
.app-card-detailed:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.07);
}
.app-card-detailed .card-main-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- 3. Image Wrapper (Smaller Icon) --- */
.card-image-wrapper {
    aspect-ratio: 1 / 1;
    background-color: #f8fafc;
    padding: 25px;
}
.card-image-wrapper .app-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
}

/* --- 4. Content Area (Centered) --- */
.card-content-wrapper {
    padding: 15px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
    line-height: 1.3;
    text-shadow: none;
}

/* --- 5. Star Rating (Centered) --- */
.card-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}
/* --- 6. Meta Info (Vertical Stack Fix) --- */
.card-meta {
    margin-top: auto; /* Pushes to the bottom */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
    margin-top: 10px;
}
.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.meta-item i {
    color: #94a3b8;
}

/* --- 7. Responsive Grid --- */
@media (max-width: 1200px) { .universal-apps-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px) { .universal-apps-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .universal-apps-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; } }


/* --- 5. PREMIUM FEATURED APP CARD --- */
.apps-grid-featured {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.app-card-featured {
    position: relative;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    padding: 25px 20px;
}
.app-card-featured:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: #f59e0b;
}
.card-main-link-featured {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.featured-ribbon {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 80px;
    height: 80px;
    overflow: hidden;
}

.featured-ribbon span {
    position: absolute;
    display: block;
    width: 120px;
    padding: 8px 0;
    background-color: #f59e0b;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    right: -30px;
    top: 20px;
    transform: rotate(45deg);
}

.card-image-wrapper-featured {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
}

.app-icon-featured {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 22px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.card-title-featured {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px;
    line-height: 1.3;
}

.card-rating-featured {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.rating-text-featured {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
}

.card-meta-featured {
    margin-top: auto;
    background-color: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.meta-item-featured i {
    color: #f59e0b;
    margin-right: 5px;
}


/* --- 6. STAR RATING & META (Shared) --- */
.stars-outer {
    position: relative;
    display: inline-block;
    font-size: 14px;
}

.stars-outer::before {
    content: '★★★★★';
    color: #e2e8f0;
}

.stars-inner {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
    width: 0; /* Updated via JS/inline style */
}

.stars-inner::before {
    content: '★★★★★';
    color: #f59e0b;
}

.rating-text {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}


/* =================================================================
   HOMEPAGE COMPARISON TOOL
   ================================================================= */

.comparison-tool-home-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    max-width: 900px;
    margin: 0 auto;
}

.comparison-inputs-wrapper {
    display: flex;
    gap: 50px;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.compare-box {
    flex: 1;
    position: relative;
}

.compare-search-input {
    width: 100%;
    height: 48px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 15px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.compare-search-input:focus {
    border-color: #f59e0b;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.compare-btn-home {
    height: 48px;
    padding: 0 40px;
    border: none;
    background: #f59e0b;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.compare-btn-home:hover {
    background: #1d4ed8;
}

.comparison-placeholder {
    color: #64748b;
    font-size: 15px;
}

/* Rich Search Dropdown for Comparison */
.compare-box .search-results-list {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.compare-box .search-results-list ul {
    list-style: none;
    margin: 0;
    padding: 8px;
}
.compare-box .search-results-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}
.compare-box .search-results-list li:hover {
    background: #f1f5f9;
}
.compare-box .search-results-list img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.compare-box .search-results-list .app-title {
    font-weight: 600;
    color: #0f172a;
    font-size: 15px;
}
.compare-box .search-results-list .app-rating {
    font-size: 12px;
    color: #64748b;
}
.compare-box .search-results-list .app-rating .fa-star {
    color: #f59e0b;
    margin-right: 3px;
}


/* --- 8. CATEGORIES SECTION --- */
/* --- 9. CTA SECTION --- */
.cta-section {
    background-color: #ffffff;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.cta-content h2 {
    color: #0f172a;
}

.cta-content p {
    color: #334155;
    max-width: 500px;
    margin: 0 auto 25px;
}

.cta-btn {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    padding: 12px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}


/* =================================================================
   HOMEPAGE CATEGORIES GRID STYLING
   ================================================================= */

.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    justify-content: center;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 30px 25px;
    border-radius: 24px;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 200px;
}

.category-card:hover {
    transform: translateY(-8px);
    border-color: #f59e0b;
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
}

.category-icon {
    font-size: 24px;
    color: #f59e0b;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #fffbeb;
    margin-bottom: 20px;
}

.category-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 10px;
}

.category-count {
    font-size: 14px;
    color: #64748b;
    background-color: #f1f5f9;
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-block;
}


/* =================================================================
   RESPONSIVE FIXES
   ================================================================= */

/* --- Tablets (max-width: 1024px) --- */
@media (max-width: 1024px) {
    .apps-grid-featured {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Tablets (max-width: 991px) --- */
@media (max-width: 991px) {
    .trust-grid,
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .apps-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Mobiles (max-width: 767px) --- */
@media (max-width: 767px) {
    .container {
        padding: 0 15px;
    }
    .homepage-section {
        padding: 60px 0;
    }
    .homepage-section-title {
        font-size: 28px;
    }
    .apk-hero-title {
        font-size: 34px;
        line-height: 1.2;
    }
    .apk-hero-subtitle {
        font-size: 15px;
    }
    .hero-stats-cards {
        gap: 10px;
    }
    .stat-card {
        flex: 1;
        padding: 10px;
        min-width: auto;
    }
    .stat-value {
        font-size: 18px;
    }
    .trust-grid {
        grid-template-columns: 1fr;
    }
    .comparison-inputs-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    .compare-box {
        width: 100%;
        max-width: 400px;
    }

    /* Featured Apps Mobile View */
    .featured-apps-grid {
        grid-template-columns: 1fr;
    }
    .featured-card-large {
        grid-row: auto;
    }
    .featured-small-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    .featured-card-large .card-title {
        font-size: 20px;
    }

    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* --- Small Mobiles (max-width: 600px) --- */
@media (max-width: 600px) {
    .apps-grid-featured,
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}