/* JanitorAI Style Frontend Home CSS */

/* Main Container */
.home-main-container {
    max-width: 1400px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 20px 24px 80px 24px;
    overflow-x: hidden;
}

/* Navbar Extension Styles */
.frontend-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
    max-width: 100%;
    transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, padding 0.25s ease, border-radius 0.25s ease;
}

/* Floating Navbar when scrolled outside offset */
.frontend-navbar.scrolled-floating {
    position: fixed;
    top: 6px;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: calc(100% - 48px);
    max-width: 1350px;
    border-radius: 14px;
    background: rgba(12, 13, 18, 0.92);
    border: 1px solid rgba(212, 163, 42, 0.35);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 163, 42, 0.15);
    padding: 10px 28px;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    animation: navFloatIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes navFloatIn {
    0% {
        opacity: 0.6;
        transform: translateY(-12px) scale(0.985);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.brand-logo-link {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand-glow {
    background: linear-gradient(135deg, #d4a32a 0%, #f3c64d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-search {
    flex: 1;
    max-width: 480px;
    margin: 0 30px;
}

.search-form {
    position: relative;
    display: flex;
    align-items: center;
}

.search-form input {
    width: 100%;
    padding: 10px 40px 10px 42px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.search-form input:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(212, 163, 42, 0.2);
}

.search-icon {
    position: absolute;
    left: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.clear-search {
    position: absolute;
    right: 15px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}
.clear-search:hover { color: #fff; }

.nav-user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #e5e7eb;
    font-weight: 500;
}

.nav-logout-btn {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    padding: 8px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.nav-logout-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
}

/* Hero Section */
.hero-banner {
    position: relative;
    background: linear-gradient(135deg, rgba(212, 163, 42, 0.12) 0%, rgba(109, 40, 217, 0.15) 50%, rgba(10, 10, 15, 0.9) 100%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    margin-bottom: 35px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    max-width: 100%;
}

.hero-banner::after {
    content: '';
    position: absolute;
    right: -50px;
    top: -50px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(212, 163, 42, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.hero-badge {
    display: inline-block;
    background: rgba(212, 163, 42, 0.15);
    border: 1px solid rgba(212, 163, 42, 0.4);
    color: #d4a32a;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-content h1 {
    font-size: 2.4rem;
    font-weight: 800;
    margin: 0 0 12px 0;
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    word-break: break-word;
}

.hero-content p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 680px;
    margin: 0;
    line-height: 1.6;
    word-break: break-word;
}

/* Category Bar */
.category-bar {
    margin-bottom: 35px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.category-filter-group,
.category-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    max-width: 100%;
    box-sizing: border-box;
}

.cat-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.25s ease;
    flex-shrink: 0;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cat-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.cat-pill.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(212, 163, 42, 0.35);
}

@media (max-width: 640px) {
    .category-filter-group,
    .category-pills {
        flex-wrap: wrap;
        gap: 8px;
        padding-bottom: 5px;
    }
}

/* Section Title */
.section-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.section-title-wrap h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0;
    color: #fff;
    word-break: break-word;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Featured Section */
.featured-section {
    margin-bottom: 45px;
    max-width: 100%;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.featured-grid.layout-col-1 { grid-template-columns: minmax(0, 1fr); }
.featured-grid.layout-col-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.featured-grid.layout-col-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.featured-grid.layout-col-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.featured-grid.layout-col-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.featured-card {
    text-decoration: none;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    height: 240px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 0 !important;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

.featured-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 12px 35px rgba(212, 163, 42, 0.25);
}

.featured-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
}

.featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 10, 15, 0.95) 0%, rgba(10, 10, 15, 0.4) 60%, transparent 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chat-count-badge {
    align-self: flex-end;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #d4a32a;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
}

.featured-info h3 {
    margin: 0 0 6px 0;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}

.featured-info p {
    margin: 0 0 12px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.btn-chat-now {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

/* JanitorAI Main Card Grid */
.janitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.janitor-grid.layout-col-1 { grid-template-columns: minmax(0, 1fr); }
.janitor-grid.layout-col-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.janitor-grid.layout-col-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.janitor-grid.layout-col-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.janitor-grid.layout-col-5 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.janitor-grid.layout-col-6 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.janitor-grid.layout-col-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.janitor-card {
    background: rgba(18, 18, 24, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.janitor-card:hover {
    transform: translateY(-6px);
    border-color: rgba(212, 163, 42, 0.5);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(212, 163, 42, 0.15);
}

.card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #050508;
}

.card-avatar {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.janitor-card:hover .card-avatar {
    transform: scale(1.06);
}

.card-badge-row {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}

.chats-badge {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.janitor-card:hover .card-hover-overlay {
    opacity: 1;
}

.start-chat-btn {
    background: var(--accent);
    color: #000;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.janitor-card:hover .start-chat-btn {
    transform: translateY(0);
}

.card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    margin: 0 0 6px 0;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}

.card-desc {
    margin: 0 0 14px 0;
    color: var(--text-muted);
    font-size: 0.83rem;
    line-height: 1.45;
    flex: 1;
}

.card-footer-meta {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.creator-tag {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
}

/* Empty State */
.no-characters-state {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--glass-border);
    border-radius: 20px;
    margin-top: 20px;
}

.no-characters-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-characters-state h3 {
    margin: 0 0 8px 0;
    font-size: 1.4rem;
    color: #fff;
}

.no-characters-state p {
    color: var(--text-muted);
    margin: 0 0 20px 0;
}

.btn-reset-search {
    display: inline-block;
    background: var(--accent);
    color: #000;
    padding: 10px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Responsive Media Queries */
@media (max-width: 900px) {
    .home-main-container { padding: 20px 16px 60px 16px; }
    .nav-search { margin: 0 14px; max-width: 360px; }
    .hero-banner { padding: 25px 20px; border-radius: 18px; }
    .hero-content h1 { font-size: 1.8rem; }
    .hero-content p { font-size: 0.95rem; }
    .janitor-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
    .card-title { font-size: 1rem; }
    .card-desc { font-size: 0.78rem; }
    .featured-grid, .featured-grid.layout-col-1, .featured-grid.layout-col-2, .featured-grid.layout-col-3, .featured-grid.layout-col-4, .featured-grid.layout-col-auto { grid-template-columns: 1fr !important; }
    .featured-card { height: 200px; width: 100%; box-sizing: border-box; }
}

@media (max-width: 768px) {
    .frontend-navbar {
        flex-wrap: wrap;
        padding: 12px 18px;
        gap: 10px;
    }
    .nav-brand {
        order: 1;
    }
    .nav-user-menu {
        order: 2;
    }
    .nav-search {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        margin: 2px 0 0 0;
    }
    .frontend-navbar.scrolled-floating {
        width: calc(100% - 20px);
        top: 6px;
        padding: 10px 14px;
        border-radius: 14px;
    }
}

@media (max-width: 600px) {
    .frontend-navbar { padding: 10px 14px; }
    .brand-logo-link { font-size: 1.15rem; }
    .brand-logo-img { width: 30px !important; height: 30px !important; }
    .hero-banner { padding: 20px 15px; margin-bottom: 25px; }
    .hero-badge { font-size: 0.72rem; padding: 4px 10px; margin-bottom: 10px; }
    .hero-content h1 { font-size: 1.45rem; margin-bottom: 8px; }
    .hero-content p { font-size: 0.88rem; line-height: 1.5; }
    .section-title-wrap { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 16px; }
    .section-title-wrap h2 { font-size: 1.3rem; }
    .janitor-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
    .cat-pill { padding: 8px 14px; font-size: 0.82rem; }
    .card-content { padding: 12px; }
    .card-title { font-size: 0.92rem; }
    .card-desc { font-size: 0.75rem; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
}

@media (max-width: 420px) {
    .user-pill-name {
        max-width: 75px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .brand-text {
        display: none;
    }
}

@media (max-width: 380px) {
    .janitor-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   CENTRALIZED PAGINATION SYSTEM STYLING
   ========================================================================== */
.characters-pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 35px;
    margin-bottom: 20px;
    width: 100%;
}

.pagination-nav {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 6px 10px;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.pagination-list {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-list .page-item {
    display: inline-flex;
}

.pagination-list .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    min-width: 36px;
    height: 36px;
    border-radius: 18px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.25s ease;
    background: transparent;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
}

.pagination-list .page-link:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.1);
}

.pagination-list .page-item.active .page-link {
    background: linear-gradient(135deg, var(--accent, #d4a32a) 0%, #f3c64d 100%);
    color: #0f172a;
    font-weight: 800;
    box-shadow: 0 0 15px rgba(212, 163, 42, 0.4);
}

.pagination-list .page-item.disabled .page-link {
    color: #475569;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-list .page-item.ellipsis .page-link {
    cursor: default;
    color: #64748b;
}

/* Load More Button Styling */
.btn-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid var(--accent, #d4a32a);
    color: #f8fafc;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.25s ease;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.btn-load-more:hover {
    background: linear-gradient(135deg, var(--accent, #d4a32a) 0%, #f3c64d 100%);
    color: #0f172a;
    box-shadow: 0 0 20px rgba(212, 163, 42, 0.4);
    transform: translateY(-2px);
}

.infinite-scroll-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
}

/* ==========================================================================
   GRID FILTER ENTER & EXIT ANIMATIONS
   ========================================================================== */
@keyframes cardGridExit {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
        filter: blur(4px);
    }
}

@keyframes cardGridEnter {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

.janitor-grid.filter-exit,
.janitor-card.filter-exit {
    animation: cardGridExit 0.18s cubic-bezier(0.4, 0, 1, 1) forwards !important;
    pointer-events: none;
}

.janitor-grid.filter-enter {
    animation: cardGridEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.janitor-card.animate-card-in {
    animation: cardGridEnter 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
