
/* Instagram-like Explore Page Styles */
:root {
    --explore-bg: #000;
    --explore-border: #262626;
    --explore-text: #fafafa;
    --explore-text-muted: #8e8e8e;
    --explore-accent: #8240FF;
    --explore-accent-light: #D2B8FF;
}

.explore-page {
    background: var(--explore-bg);
    min-height: 100vh;
}

.explore-container {
    background: var(--explore-bg);
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Stories-style Horizontal Chat Bar */
.stories-bar {
    background: var(--explore-bg);
    padding: 12px 0;
}

.stories-list {
    display: flex;
    gap: 16px;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.stories-list::-webkit-scrollbar {
    display: none;
}

.stories-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 8px;
    color: var(--explore-text-muted);
}

/* Story Avatar Style */
.chat-thumb-container {
    flex: 0 0 auto;
    text-align: center;
}

.chat-thumb-card {
    width: 66px !important;
    height: 66px !important;
    border-radius: 50% !important;
    border: 2px solid transparent !important;
    background: linear-gradient(var(--explore-bg), var(--explore-bg)) padding-box,
                linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) border-box;
    padding: 3px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chat-thumb-card:hover {
    transform: scale(1.05);
}

.chat-thumb-card img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--explore-bg);
    z-index: 100;
    top: 56px;
}

@media (max-width: 991px) {
    .filter-bar {
        top: 50px;
    }
}

/* Tags Scroll */
.tags-scroll {
    display: flex;
    flex: 1;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 0;
}

.tags-scroll::-webkit-scrollbar {
    display: none;
}

.tags-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--explore-text-muted);
    font-size: 12px;
}

/* Query Tag Pills */
.query-tag {
    flex-shrink: 0;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    background: var(--explore-border);
    color: var(--explore-text);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.query-tag:hover {
    background: #363636;
}

.query-tag.active {
    background: var(--explore-text) !important;
    color: var(--explore-bg) !important;
}

/* Filter Icons */
.filter-icons {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.filter-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--explore-border);
    color: var(--explore-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.filter-icon-btn:hover,
.filter-icon-btn.active {
    background: var(--explore-text);
    color: var(--explore-bg);
}

.filter-dropdown {
    background: #262626;
    border: 1px solid #363636;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.filter-dropdown .dropdown-item {
    color: var(--explore-text);
    padding: 10px 16px;
    font-size: 14px;
}

.filter-dropdown .dropdown-item:hover {
    background: #363636;
}

.filter-dropdown .dropdown-divider {
    border-color: #363636;
}

/* Explore Grid Gallery */
.explore-gallery {
    padding: 8px;
}

.explore-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 4px;
}

@media (min-width: 576px) {
    .explore-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .explore-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1200px) {
    .explore-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1600px) {
    .explore-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Gallery Card - Instagram Style */
.gallery-card {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    background: #1a1a1a;
}

.gallery-card .card {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    height: 100%;
}

.gallery-card .gallery-image-wrapper {
    aspect-ratio: 1 !important;
    border-radius: 0 !important;
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.gallery-card:hover img {
    transform: scale(1.02);
}

/* Hover Overlay */
.gallery-card .card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    transition: background 0.2s ease;
    pointer-events: none;
}

.gallery-card:hover .card::after {
    background: rgba(0,0,0,0.3);
}

/* Card Overlay Content - Hidden by default, shown on hover */
.gallery-card .position-absolute.bottom-0 {
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.gallery-card:hover .position-absolute.bottom-0 {
    opacity: 1;
}

/* Hide bottom gradient by default */
.gallery-card .position-absolute[style*="gradient"] {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-card:hover .position-absolute[style*="gradient"] {
    opacity: 1;
}

/* Top badges always visible */
.gallery-card .position-absolute.top-0 {
    z-index: 10;
}

/* Multi-image indicator */
.gallery-card .multi-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    color: white;
    font-size: 18px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
    z-index: 5;
}

/* Video indicator */
.gallery-card .video-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 48px;
    opacity: 0.9;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    z-index: 5;
}

/* NSFW Blur - Only apply when gallery has blur-nsfw class */
.blur-nsfw .nsfw-content img {
    filter: blur(20px);
}

.blur-nsfw .nsfw-content:hover img {
    filter: blur(10px);
}

/* When user opts to show NSFW, no blur */
.nsfw-content img {
    transition: filter 0.3s ease;
}

/* Load More Area */
.load-more-area {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--explore-text-muted);
}

/* Spinner */
.spinner-border {
    color: var(--explore-text);
    border-color: var(--explore-text);
    border-right-color: transparent;
}

.text-purple {
    color: var(--explore-accent) !important;
}

/* Badge Styles */
.gallery-card .badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
}

/* Hidden elements for compatibility */
#selected-gender-text {
    display: none;
}

/* Override Bootstrap Grid for Gallery */
.explore-grid .gallery-card.col-6,
.explore-grid .gallery-card.col-sm-6,
.explore-grid .gallery-card.col-lg-3,
.explore-grid .gallery-card.col-xl-2 {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Responsive text */
@media (max-width: 576px) {
    .gallery-card h6 {
        font-size: 0.75rem !important;
    }
    
    .gallery-card .badge {
        font-size: 8px;
    }
    
    .filter-bar {
        padding: 8px 10px;
    }
    
    .query-tag {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    .filter-icon-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* Safe area for mobile */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .explore-gallery {
        padding-bottom: calc(env(safe-area-inset-bottom) + 60px);
    }
}

/* Touch feedback */
@media (hover: none) {
    .gallery-card:active {
        opacity: 0.7;
    }
    
    .query-tag:active {
        transform: scale(0.95);
    }
}

/* Gallery hover effects - preserve for compatibility */
.gallery-hover {
    transition: transform 0.3s ease;
}

.gallery-img {
    transition: opacity 0.3s ease;
}
/* ─── Banner Carousel ─────────────────────────────────────────────── */
.banner-carousel {
    position: relative;
    overflow: hidden;
    background: var(--explore-bg);
}

.banner-carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.banner-carousel-track::-webkit-scrollbar {
    display: none;
}

.banner-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    display: block;
    position: relative;
    cursor: pointer;
}

.banner-slide img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 150px;
}

@media (min-width: 768px) {
    .banner-slide img {
        max-height: 80vh;
        object-fit: cover;
    }
}

/* Carousel Dots */
.banner-carousel-dots {
    position: absolute;
    bottom: 9px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 2;
}

.banner-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--explore-text-muted);
    transition: all 0.3s ease;
    cursor: pointer;
}

.banner-dot.active {
    background: var(--explore-accent);
    width: 18px;
    border-radius: 3px;
}

/* ─── Character Cards Grid (GirlfriendGPT-style) ───────────────── */
.char-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
}

@media (min-width: 768px) {
    .char-cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        padding: 16px;
    }
}

@media (min-width: 1200px) {
    .char-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Character Card */
.char-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #1a1a1a;
    aspect-ratio: 3 / 4;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.char-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.char-card-image {
    position: absolute;
    inset: 0;
}

.char-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform 0.3s ease;
}

.char-card:hover .char-card-image img {
    transform: scale(1.05);
}

/* Card overlay gradient */
.char-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        transparent 40%,
        rgba(0, 0, 0, 0.85) 100%
    );
}

/* NSFW / SFW Tag */
.char-card-badges {
    display: flex;
    gap: 6px;
    padding: 10px;
}

.char-card-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    pointer-events: auto;
}

.char-card-tag.nsfw {
    background: #e74c8b;
    color: #fff !important;
}

.char-card-tag.sfw {
    background: #22c55e;
    color: #fff;
}

/* Card info at bottom */
.char-card-info {
    padding: 12px 14px 14px;
}

.char-card-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.char-card-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Stats row */
.char-card-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.char-card-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.char-card-stat i {
    font-size: 12px;
}

.char-card-stat i.bi-heart-fill {
    color: #e74c8b;
}

.char-card-stat i.bi-chat-dots-fill {
    color: #a78bfa;
}

.char-card-stat i.bi-coin {
    color: #fdcb6e;
}

.char-card-stat.coins-stat {
    color: #fdcb6e;
}

/* NSFW blur for char-cards */
.blur-nsfw .char-card.nsfw-content .char-card-image img {
    filter: blur(20px);
}

.blur-nsfw .char-card.nsfw-content:hover .char-card-image img {
    filter: blur(10px);
}

/* Loading items inside char-cards-grid */
.char-cards-grid .loading-grid {
    display: contents;
}

.char-cards-grid .loading-item,
.explore-grid .loading-item {
    aspect-ratio: 3 / 4;
    border-radius: 16px;
    background: linear-gradient(110deg, #1a1a1a 8%, #262626 18%, #1a1a1a 33%);
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

.explore-grid .loading-grid {
    display: contents;
}

@keyframes shimmer {
    to { background-position-x: -200%; }
}

/* Mobile adjustments */
@media (max-width: 576px) {
    .char-cards-grid {
        gap: 8px;
        padding: 8px;
    }

    .char-card-name {
        font-size: 13px;
    }

    .char-card-desc {
        font-size: 11px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .char-card-info {
        padding: 8px 10px 10px;
    }

    .char-card-tag {
        font-size: 10px;
        padding: 2px 8px;
    }

    .char-card-stats {
        gap: 8px;
    }

    .char-card-stat {
        font-size: 11px;
    }
}
