/* Character Profile Page Styles - Instagram-like Design */

:root {
    --ig-bg: var(--bg-primary, #0f0f0f);
    --ig-surface: var(--bg-secondary, #1a1a1a);
    --ig-border: var(--border-color, #262626);
    --ig-text: var(--text-primary, #fafafa);
    --ig-text-secondary: var(--text-secondary, #a8a8a8);
    --ig-accent: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    --ig-blue: #8240FF;
    --ig-purple: #8240FF;
    --ig-pink: #e1306c;
}

/* Override body for character page */
body:has(.ig-profile-header) {
    background: var(--bg-primary);
}

.profile-container {
    max-width: 100vw;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    min-height: 100vh;
}

/* Profile Header */
.ig-profile-header {
    background: var(--ig-bg);
}

.ig-profile-info {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 20px;
}

.ig-avatar-section {
    flex-shrink: 0;
}

.ig-avatar-ring {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    padding: 3px;
    background: var(--ig-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ig-avatar {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    border: 3px solid var(--ig-bg);
    object-fit: cover;
    object-position: top;
}

.ig-stats-row {
    display: flex;
    flex: 1;
    justify-content: space-around;
}

.ig-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ig-stat-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ig-text);
    line-height: 1.2;
}

.ig-stat-label {
    font-size: 0.75rem;
    color: var(--ig-text-secondary);
    margin-top: 2px;
}

/* Earnings Stat - Money Display */
.ig-stat-earnings {
    position: relative;
}

.ig-stat-earnings .ig-earnings-amount {
    color: #34d399;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.ig-stat-earnings .ig-earnings-label {
    color: #34d399;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Bio Section */
.ig-bio-section {
    padding: 0 16px 12px;
}

.ig-display-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ig-text);
    margin: 0 0 4px 0;
}

.ig-bio {
    font-size: 0.85rem;
    color: var(--ig-text);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Creator Info Bar */
.ig-creator-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 0 16px 8px;
    background: var(--ig-surface);
    border-radius: 12px;
    border: 1px solid var(--ig-border);
}

.ig-creator-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.ig-creator-link:hover .ig-creator-name {
    color: var(--ig-blue);
}

.ig-creator-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ig-border);
}

.ig-creator-name-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.ig-creator-label {
    font-size: 0.65rem;
    color: var(--ig-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ig-creator-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ig-text);
    transition: color 0.2s;
}

.ig-creator-follow-btn {
    flex-shrink: 0;
    padding: 5px 14px;
    border-radius: 8px;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--ig-blue);
    color: #fff;
}

.ig-creator-follow-btn:hover {
    opacity: 0.85;
}

.ig-creator-follow-btn.following {
    background: transparent;
    border: 1px solid var(--ig-border);
    color: var(--ig-text);
}

.ig-creator-follow-btn.following:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.ig-creator-dates {
    display: flex;
    gap: 16px;
    margin-left: auto;
    flex-shrink: 0;
}

.ig-creator-date {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.ig-creator-date-label {
    font-size: 0.6rem;
    color: var(--ig-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ig-creator-date-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ig-text);
}

/* Action Buttons Row */
.ig-action-row {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
}

.ig-chat-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #8240FF 0%, #a855f7 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(130, 64, 255, 0.3);
}

.ig-chat-btn:hover {
    background: linear-gradient(135deg, #9555FF 0%, #b366f7 100%);
    color: white;
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(130, 64, 255, 0.4);
}

.ig-chat-btn:active {
    transform: scale(0.98);
}

.ig-chat-btn i {
    font-size: 1.1rem;
}

/* Create Similar Influencer Button */
.ig-create-similar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #b45309 0%, #c2410c 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(180, 83, 9, 0.4);
    white-space: nowrap;
}

.ig-create-similar-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
    color: #fff;
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(180, 83, 9, 0.5);
}

.ig-create-similar-btn:active {
    transform: scale(0.98);
}

.ig-create-similar-btn i {
    font-size: 1rem;
}

.ig-secondary-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--ig-text);
    border: 1px solid var(--ig-border);
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ig-secondary-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Character favorite button - special styling */
.character-favorite-btn {
    position: relative;
}

.character-favorite-btn.favorited {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 193, 7, 0.15) 100%);
    border-color: rgba(255, 215, 0, 0.5);
    color: #FFD700;
}

.character-favorite-btn.favorited i {
    animation: starPulse 0.5s ease;
}

.character-favorite-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--ig-text);
}

.character-favorite-btn.favorited:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 193, 7, 0.25) 100%);
    border-color: #FFD700;
}

/* Character follow button - special styling */
.character-follow-btn {
    position: relative;
}

.character-follow-btn.following {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15) 0%, rgba(56, 142, 60, 0.15) 100%);
    border-color: rgba(76, 175, 80, 0.5);
    color: #4CAF50;
}

.character-follow-btn.following i {
    animation: bellRing 0.5s ease;
}

.character-follow-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--ig-text);
}

.character-follow-btn.following:hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.25) 0%, rgba(56, 142, 60, 0.25) 100%);
    border-color: #4CAF50;
}

@keyframes bellRing {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    50% {
        transform: rotate(10deg);
    }
    75% {
        transform: rotate(-10deg);
    }
}

@keyframes starPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Admin Floating Action Button */
.ig-admin-fab {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8240FF, #5a2dba);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(130, 64, 255, 0.4);
    z-index: 1000;
    cursor: pointer;
    transition: transform 0.2s;
}
.ig-admin-fab:active {
    transform: scale(0.92);
}

/* Admin Bottom Sheet */
.admin-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
}
.admin-sheet-overlay.open {
    display: block;
}
.admin-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(20, 20, 35, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    padding: 8px 16px 24px;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.admin-sheet.open {
    transform: translateY(0);
}
.admin-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.2);
    margin: 0 auto 12px;
}
.admin-sheet-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    padding: 0 4px 8px;
}
.admin-sheet-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.admin-sheet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 12px;
    border: none;
    background: transparent;
    color: #e8e8e8;
    font-size: 0.95rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}
.admin-sheet-item:active {
    background: rgba(255,255,255,0.08);
}
.admin-sheet-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* Tab Navigation */
.ig-tab-nav {
    display: flex;
    border-top: 1px solid var(--ig-border);
    background: var(--ig-bg);
}

.ig-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 0;
    background: none;
    border: none;
    color: var(--ig-text-secondary);
    font-size: 1.35rem;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.ig-tab.active {
    color: var(--ig-text);
}

.ig-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--ig-text);
}

.ig-tab:active {
    opacity: 0.7;
}

/* Tab Content Areas */
.tab-content {
    background: var(--ig-bg);
    min-height: 200px;
}

.tab-pane {
    background: var(--ig-bg);
}

/* Keep old styles but update for dark theme compatibility */
/* Profile Header - Legacy (hidden) */
.profile-header {
    display: none;
}

.profile-cover {
    display: none;
}

.profile-actions {
    display: none;
}

.profile-stats {
    display: none;
}

.content-tabs {
    display: none;
}

/* Loading State for Count Displays */
.ig-stat-number.count-loading,
#imagesCount.count-loading,
#videosCount.count-loading,
#messagesCount.count-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 1.5rem;
}

.ig-stat-number.count-loading .spinner-border,
#imagesCount.count-loading .spinner-border,
#videosCount.count-loading .spinner-border,
#messagesCount.count-loading .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
    color: var(--ig-text);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* Initial Grid */
.character-grid-initial .gallery-card{
    display: inline-block;
}

/* Media Grid - Instagram Dark Theme */
.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 0;
    background: var(--ig-bg);
}

.media-item {
    position: relative;
    overflow: hidden;
    background: var(--ig-surface);
    cursor: pointer;
    transition: opacity 0.2s ease;
    aspect-ratio: 1;
}

.media-item:active {
    opacity: 0.7;
}

.media-item img,
.media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    aspect-ratio: 1;
}

.media-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.media-item:hover .media-item-overlay {
    opacity: 1;
}

.media-item-info {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.media-item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: auto;
    z-index: 20;
}

.media-item:hover .media-item-actions {
    opacity: 1;
}

.media-action-btn {
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    font-weight: 600;
    pointer-events: auto;
    flex-shrink: 0;
    z-index: 30;
    backdrop-filter: blur(4px);
}

.media-action-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.media-action-btn.liked,
.media-action-btn.image-fav.liked {
    color: #ed4956;
}

.media-action-btn.admin-delete-image {
    color: #ff4444;
}

.media-action-btn.admin-delete-image:hover {
    background: rgba(255, 68, 68, 0.8);
    color: white;
}

/* Admin toggle button within media actions */
.media-action-btn.gallery-admin-toggle {
    color: #fbbf24;
    background: rgba(0, 0, 0, 0.5);
}

.media-action-btn.gallery-admin-toggle:hover {
    background: rgba(0, 0, 0, 0.75);
    color: #fcd34d;
}

/* Admin menu positioning within media-item */
.media-item .gallery-admin-menu {
    position: relative;
}

.video-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    color: white;
    font-size: 1.2rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* Multiple images indicator */
.media-item .multi-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    color: white;
    font-size: 1rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* View count overlay on hover */
.media-item .view-count {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
}

.media-item video {
    display: block;
    background: #000;
}

/* Similar Characters - Instagram Dark Theme */
.similar-section {
    padding: 20px 16px;
    border-top: 1px solid var(--ig-border);
    background: var(--ig-bg);
}

.similar-section h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ig-text);
    margin-bottom: 4px;
}

.similar-section .text-muted {
    font-size: 0.8rem;
    margin-bottom: 16px;
    color: var(--ig-text-secondary) !important;
}

.similar-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.similar-grid::-webkit-scrollbar {
    display: none;
}

.similar-card {
    flex-shrink: 0;
    text-align: center;
    text-decoration: none;
    color: inherit;
    width: 70px;
}

.similar-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 8px;
    display: block;
    border: 2px solid var(--ig-border);
    transition: all 0.2s ease;
}

.similar-card:active .similar-avatar {
    opacity: 0.7;
}

.similar-name {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--ig-text);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loading States - Dark Theme */
.loading-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 0;
    width: 100%;
    grid-column: 1 / -1;
}

.loading-item {
    aspect-ratio: 1;
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Character Details - Dark Theme */
.character-details {
    padding: 20px 16px;
    background: var(--ig-bg);
}

.character-details h5 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ig-text);
    margin-bottom: 10px;
    margin-top: 16px;
}

.character-details h5:first-child {
    margin-top: 0;
}

.character-details p {
    color: var(--ig-text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

/* Instagram-style About Container */
.ig-about-container {
    padding: 16px;
    background: var(--ig-bg);
}

.ig-attributes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.ig-attribute-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--ig-surface);
    border-radius: 12px;
    border: 1px solid var(--ig-border);
}

.ig-attribute-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ig-attribute-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ig-attribute-label {
    font-size: 0.7rem;
    color: var(--ig-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.ig-attribute-value {
    font-size: 0.85rem;
    color: var(--ig-text);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ig-nsfw-badge {
    color: #f59e0b;
}

.ig-section-card {
    background: var(--ig-surface);
    border-radius: 12px;
    border: 1px solid var(--ig-border);
    padding: 16px;
    margin-bottom: 16px;
}

.ig-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--ig-text);
    font-weight: 600;
    font-size: 0.9rem;
}

.ig-section-header i {
    color: var(--ig-blue);
    font-size: 1.1rem;
}

.ig-section-text {
    color: var(--ig-text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0;
}

.ig-tags-section {
    margin-top: 16px;
}

.ig-tags-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ig-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.ig-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ig-tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: var(--ig-surface);
    border: 1px solid var(--ig-border);
    border-radius: 20px;
    color: var(--ig-blue);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.ig-tag:active {
    background: rgba(0, 149, 246, 0.1);
}

.ig-tag i {
    font-size: 0.9rem;
    margin-right: 2px;
}

.character-personality-details {
    background-color: var(--ig-surface);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--ig-border);
}

.personality-section {
    border: none !important;
    border-radius: 8px;
    overflow: hidden;
    background: var(--ig-surface);
}

.accordion-button {
    background: var(--ig-surface);
    color: var(--ig-text);
    font-weight: 600;
    border: none;
}

.accordion-button:not(.collapsed) {
    background: var(--ig-surface);
    color: var(--ig-blue);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: var(--ig-border);
}

.section-title {
    color: var(--ig-text);
    padding: 12px 15px;
}

.accordion-body {
    padding: 15px;
    background-color: var(--ig-surface);
    color: var(--ig-text-secondary);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
}

.character-tag {
    background-color: var(--ig-surface);
    color: var(--ig-blue);
    border: 1px solid var(--ig-border);
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.character-tag:hover {
    background: var(--ig-blue);
    color: white !important;
}

.content-container {
    background: var(--ig-surface);
    border-radius: 6px;
    padding: 5px;
}

.btn.custom-gradient-bg {
    background: linear-gradient(90.9deg, #D2B8FF 2.74%, #8240FF 102.92%);
    border: none;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(130,64,255,0.25);
}

.btn.custom-gradient-bg:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(130,64,255,0.35);
}

/* Responsive adjustments for Instagram-style design */
@media (max-width: 1400px) {
    .media-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .loading-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

    .loading-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ig-profile-info {
        padding: 12px 16px;
        gap: 16px;
    }

    .ig-avatar-ring {
        width: 77px;
        height: 77px;
    }

    .ig-avatar {
        width: 70px;
        height: 70px;
    }

    .ig-stat-number {
        font-size: 1rem;
    }

    .ig-stat-label {
        font-size: 0.7rem;
    }

    .ig-display-name {
        font-size: 0.85rem;
    }

    .ig-bio {
        font-size: 0.8rem;
    }

    .ig-chat-btn {
        padding: 9px 16px;
        font-size: 0.85rem;
    }

    .media-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
        padding: 0;
    }

    .loading-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
        padding: 0;
    }

    .ig-tab {
        padding: 12px 0;
        font-size: 1.2rem;
    }

    .container-fluid.px-0 {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* Hide legacy elements */
    .profile-header,
    .profile-cover,
    .profile-actions,
    .profile-stats,
    .content-tabs {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .ig-top-bar {
        padding: 10px 12px;
    }

    .ig-username {
        font-size: 0.95rem;
    }

    .ig-profile-info {
        padding: 12px;
        gap: 12px;
    }

    .ig-avatar-ring {
        width: 70px;
        height: 70px;
    }

    .ig-avatar {
        width: 64px;
        height: 64px;
        border-width: 2px;
    }

    .ig-stats-row {
        gap: 4px;
    }

    .ig-stat-number {
        font-size: 0.95rem;
    }

    .ig-stat-label {
        font-size: 0.65rem;
    }

    .ig-bio-section {
        padding: 0 12px 10px;
    }

    .ig-display-name {
        font-size: 0.85rem;
    }

    .ig-bio {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }

    .ig-creator-bar {
        margin: 0 12px 6px;
        padding: 8px 10px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .ig-creator-avatar {
        width: 30px;
        height: 30px;
    }

    .ig-creator-label {
        font-size: 0.6rem;
    }

    .ig-creator-name {
        font-size: 0.75rem;
    }

    .ig-creator-follow-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
    }

    .ig-creator-dates {
        gap: 12px;
    }

    .ig-creator-date-label {
        font-size: 0.55rem;
    }

    .ig-creator-date-value {
        font-size: 0.7rem;
    }

    .ig-action-row {
        padding: 10px 12px;
        gap: 6px;
    }

    .ig-chat-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
        border-radius: 8px;
    }

    .ig-chat-btn i {
        font-size: 1rem;
    }

    .ig-create-similar-btn {
        padding: 8px 10px;
        font-size: 0.7rem;
        border-radius: 8px;
    }

    .ig-secondary-btn {
        width: 38px;
        height: 38px;
        border-radius: 8px;
        font-size: 1rem;
    }

    .ig-tab {
        padding: 10px 0;
        font-size: 1.1rem;
    }

    .media-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1px;
    }

    .loading-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1px;
    }

    .ig-attributes-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ig-attribute-card {
        padding: 12px;
    }

    .ig-attribute-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .similar-section {
        padding: 16px 12px;
    }

    .similar-grid {
        gap: 12px;
    }

    .similar-avatar {
        width: 56px;
        height: 56px;
    }

    .similar-card {
        width: 60px;
    }

    .similar-name {
        font-size: 0.65rem;
    }
}

/* Gallery Section */
.gallery-section {
    padding: 20px 0;
    background: var(--ig-bg);
}

.gallery-section h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.gallery-section .text-muted {
    text-align: center;
    margin-bottom: 20px;
}

/* Character Gallery for non-specific character pages */
.character-gallery {
    padding: 40px 20px;
    background: var(--bg-secondary);
}

.character-gallery h2 {
    text-align: center;
    margin-bottom: 30px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.category-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.category-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.category-card h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.character-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.character-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
}

.character-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
}

.character-card h5 {
    margin-bottom: 5px;
    color: var(--text-primary);
}

.character-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.sticky-bottom, .grid-control {
    display: none;
}

/* Load More Button Styling */
.load-more-container {
    display: flex;
    justify-content: center;
    padding: 24px 12px;
    grid-column: 1 / -1;
}

.load-more-btn {
    padding: 12px 32px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 28px;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.load-more-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.load-more-btn:active {
    transform: translateY(-1px);
}

.load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Spinner styling for load more button */
.load-more-btn .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
    color: white;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* Image Modal Styles - Full-Screen with Overlay Footer */

/* Override Bootstrap modal dialog for full-screen */
.modal.fade .modal-dialog.image-modal-dialog {
    margin: 0;
    width: 100%;
    height: calc(var(--vh, 1vh) * 100);
    height: 100dvh;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-content {
    background: #000;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    width: 100%;
    height: calc(var(--vh, 1vh) * 100);
    height: 100dvh;
    max-height: calc(var(--vh, 1vh) * 100);
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Image Body - Full viewport */
.image-modal-body {
    padding: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.image-modal-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0;
    display: block;
    background: #000;
}

/* Modal Header - Close Button Only */
.image-modal-header {
    background: none;
    color: inherit;
    padding: 0;
    border-bottom: none;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    position: fixed;
    top: 16px;
    right: 24px;
    z-index: 1055;
    width: auto;
    pointer-events: auto;
}

.image-modal-header .btn-close {
    background: linear-gradient(135deg, #D2B8FF 0%, #8240FF 100%);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.95;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(130, 64, 255, 0.4);
    flex-shrink: 0;
    cursor: pointer;
}

.image-modal-header .btn-close::after {
    content: '✕';
    position: absolute;
    font-size: 1.5rem;
    color: white;
    font-weight: 300;
    letter-spacing: 2px;
}

.image-modal-header .btn-close:hover {
    opacity: 1;
    box-shadow: 0 8px 28px rgba(130, 64, 255, 0.6);
    transform: scale(1.1);
}

.image-modal-header .btn-close:active {
    transform: scale(0.95);
}

/* Info Section - White Footer */
.image-modal-footer {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid #e5e7eb;
    padding: 5px 24px 5px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    width: 100%;
    max-height: auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.image-modal-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 16px;
}

.image-modal-title-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #1f2937;
    word-break: break-word;
    line-height: 1.5;
    letter-spacing: -0.3px;
    cursor: pointer;
    user-select: text;
    transition: all 0.3s ease;
}

.image-modal-title .title-toggle {
    font-size: 0.8rem;
    color: #9ca3af;
    font-weight: 500;
    margin-left: 4px;
    display: inline;
}

.image-modal-date {
    margin: 0;
    font-size: 0.8rem;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Action Buttons - Icon Only, Smaller */
.image-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    margin-bottom: 4px;
}

.image-modal-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 8px;
    border: none;
    background: transparent;
    color: #6b7280;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
}

.image-modal-action-btn i {
    font-size: 1.4rem;
    transition: all 0.3s ease;
    margin: 0;
}

.image-modal-action-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.image-modal-action-btn:active {
    transform: scale(0.95);
}

/* Like button - Simple Gray */
.image-modal-like-btn {
    background: transparent;
    color: #d1d5db;
}

.image-modal-like-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.image-modal-like-btn.liked {
    background: transparent;
    color: #ef4444;
}

.image-modal-like-btn.liked i {
    animation: heartBeat 0.6s ease-in-out;
}


/* Responsive design for full-width modals */
@media (max-width: 1024px) {
    .image-modal-content {
        height: calc(var(--vh, 1vh) * 100);
    height: 100dvh;
        border-radius: 0;
    }
    
    .modal.fade .modal-dialog.image-modal-dialog {
        height: calc(var(--vh, 1vh) * 100);
    height: 100dvh;
    }
    
    .image-modal-body {
        flex: 1;
        min-height: 55vh;
    }
    
    .image-modal-footer {
        padding: 24px 20px;
        gap: 20px;
    }
    
    .image-modal-title {
        font-size: 1rem;
    }
    
    .image-modal-action-btn {
        padding: 11px 20px;
        font-size: 0.85rem;
        min-width: 110px;
    }
}

@media (max-width: 1024px) {
    .image-modal-header .btn-close {
        width: 44px;
        height: 44px;
    }
    
    .image-modal-footer {
        padding: 50px 24px 24px 24px;
    }
    
    .image-modal-title {
        font-size: 1rem;
    }
    
    .image-modal-action-btn {
        padding: 11px 20px;
        font-size: 0.85rem;
        min-width: 110px;
    }
}

@media (max-width: 768px) {
    .image-modal-header {
        padding: 12px 16px;
    }
    
    .image-modal-header .btn-close {
        width: 40px;
        height: 40px;
        box-shadow: 0 4px 16px rgba(130, 64, 255, 0.35);
    }
    
    .image-modal-footer {
        padding: 40px 20px 20px 20px;
        gap: 16px;
    }
    
    .image-modal-title {
        font-size: 0.95rem;
    }
    
    .image-modal-date {
        font-size: 0.75rem;
    }
    
    .image-modal-action-btn {
        padding: 10px 18px;
        font-size: 0.8rem;
        min-width: 100px;
        gap: 8px;
    }
    
    .image-modal-action-btn i {
        font-size: 1.1rem;
    }
    
    .image-modal-actions {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .image-modal-header {
        padding: 10px 12px;
    }
    
    .image-modal-header .btn-close {
        width: 36px;
        height: 36px;
        box-shadow: 0 3px 12px rgba(130, 64, 255, 0.3);
    }
    
    .image-modal-footer {
        padding: 5px 16px 0px 16px;
        gap: 12px;
    }

    .image-modal-info {
        gap: 10px;
        padding-bottom: 12px;
    }
    
    .image-modal-title {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .image-modal-date {
        font-size: 0.7rem;
    }
    
    .image-modal-action-btn {
        padding: 8px 8px;
        font-size: 0.75rem;
        flex: 0 0 auto;
        min-width: auto;
        width: 32px;
        height: 32px;
    }
    
    .image-modal-action-btn i {
        font-size: 1.2rem;
    }
    
    .image-modal-actions {
        gap: 8px;
        flex-direction: row;
        margin-bottom: 2px;
    }
}

/* Empty State Styling for Dark Theme */
.empty-state,
.no-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--ig-text-secondary);
    grid-column: 1 / -1;
}

.empty-state i,
.no-content i {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--ig-text-secondary);
    opacity: 0.5;
}

.empty-state p,
.no-content p {
    font-size: 0.9rem;
    color: var(--ig-text-secondary);
    margin: 0;
}

/* Ensure text colors in character profile */
#characterProfilePage h1,
#characterProfilePage h2,
#characterProfilePage h3,
#characterProfilePage h4,
#characterProfilePage h5,
#characterProfilePage h6 {
    color: var(--ig-text);
}

#characterProfilePage p,
#characterProfilePage span,
#characterProfilePage small {
    color: var(--ig-text-secondary);
}

/* Override Bootstrap text utilities for dark theme */
#characterProfilePage .text-muted {
    color: var(--ig-text-secondary) !important;
}

#characterProfilePage .text-dark {
    color: var(--ig-text) !important;
}

/* Hide footer toolbar on character page */
#characterProfilePage ~ #footer-toolbar,
body:has(.ig-profile-header) #footer-toolbar {
    display: none !important;
}

/* Character Page Header Navigation Styling */
body:has(.ig-profile-header) #mainNav {
    background: transparent !important;
    backdrop-filter: none;
}

body:has(.ig-profile-header) .brand-logo i {
    color: var(--text-primary) !important;
}

body:has(.ig-profile-header) #avatarMenuBtn {
    width: 32px !important;
    height: 32px !important;
    border: 2px solid var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(130, 64, 255, 0.2) !important;
}

body:has(.ig-profile-header) .nav-icon-btn {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    width: 36px;
    height: 36px;
    border-radius: 50% !important;
}

body:has(.ig-profile-header) .nav-icon-btn:hover {
    background: rgba(130, 64, 255, 0.15) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-light) !important;
}

body:has(.ig-profile-header) .dropdown-toggle {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

body:has(.ig-profile-header) .dropdown-toggle::after {
    display: none;
}

body:has(.ig-profile-header) .dropdown-toggle:hover {
    background: rgba(130, 64, 255, 0.15) !important;
    border-color: var(--primary-color) !important;
}

/* ===== Image Preview Modal - TikTok-style Action Buttons ===== */
#characterImagePreviewModal .character-preview-actions {
    position: absolute;
    right: 16px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 1000;
}

#characterImagePreviewModal .character-preview-actions .tiktok-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#characterImagePreviewModal .character-preview-actions .tiktok-action-btn .action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

#characterImagePreviewModal .character-preview-actions .tiktok-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

#characterImagePreviewModal .character-preview-actions .tiktok-action-btn:active {
    transform: scale(0.95);
}

/* Heart button specific styling */
#characterImagePreviewModal .character-preview-actions .heart-btn {
    background: rgba(255, 0, 110, 0.15);
    border-color: rgba(255, 0, 110, 0.3);
}

#characterImagePreviewModal .character-preview-actions .heart-btn:hover {
    background: rgba(255, 0, 110, 0.25);
}

#characterImagePreviewModal .character-preview-actions .heart-btn.liked .action-icon i {
    color: #ff006e;
}

#characterImagePreviewModal .character-preview-actions .heart-btn.liked {
    background: rgba(255, 0, 110, 0.2);
}

/* Chat button */
#characterImagePreviewModal .character-preview-actions .chat-btn {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

#characterImagePreviewModal .character-preview-actions .chat-btn:hover {
    background: rgba(99, 102, 241, 0.25);
}

/* ===== Image Preview Modal Full Screen on Mobile ===== */
@media (max-width: 768px) {
    #characterImagePreviewModal .modal-dialog {
        max-width: 100%;
        height: 100vh;
        margin: 0;
    }
    
    #characterImagePreviewModal .modal-content {
        height: 100vh;
        border-radius: 0;
    }
    
    #characterImagePreviewModal .modal-body {
        height: 100vh !important;
        padding: 0 !important;
    }
    
    /* Hide pagination on small screens */
    #characterImagePreviewModal .swiper-pagination {
        display: none !important;
    }
    
    /* Adjust close button for mobile */
    #characterImagePreviewModal .modal-header {
        top: 0 !important;
    }
    
    #characterImagePreviewModal .btn-close {
        background-color: rgba(0, 0, 0, 0.5);
    }
}

/* SFW/NSFW Content Type Toggle */
.content-type-toggle {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--ig-bg);
    border-bottom: 1px solid var(--ig-border);
}

/* Toggle Switch (match profile/posts) */
.ig-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.ig-toggle input {
    display: none;
}

.ig-toggle-slider {
    width: 36px;
    height: 20px;
    background: var(--ig-border);
    border-radius: 20px;
    position: relative;
    transition: background 0.2s ease;
}

.ig-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.ig-toggle input:checked + .ig-toggle-slider {
    background: var(--ig-purple);
}

.ig-toggle input:checked + .ig-toggle-slider::after {
    transform: translateX(16px);
}

.ig-toggle-label {
    font-size: 0.85rem;
    color: var(--ig-text-secondary);
}

.content-type-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--ig-border);
    border-radius: 8px;
    color: var(--ig-text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.content-type-btn i {
    font-size: 16px;
}

.content-type-btn:hover {
    background: var(--ig-surface);
    border-color: var(--ig-text-secondary);
}

.content-type-btn.active {
    background: var(--ig-purple);
    border-color: var(--ig-purple);
    color: white;
}

.content-type-btn.active:hover {
    background: var(--ig-purple);
    opacity: 0.9;
}

@media (max-width: 480px) {
    .content-type-toggle {
        padding: 10px 12px;
    }
    
    .content-type-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .content-type-btn i {
        font-size: 14px;
    }
    
    .content-type-btn span {
        display: inline;
    }
}

@media (max-width: 480px) {
    #characterImagePreviewModal .character-preview-actions {
        right: 12px;
        bottom: 80px;
        gap: 12px;
    }
    
    #characterImagePreviewModal .character-preview-actions .tiktok-action-btn {
        width: 44px;
        height: 44px;
    }
    
    #characterImagePreviewModal .character-preview-actions .tiktok-action-btn .action-icon {
        font-size: 20px;
    }
}

/* ==========================================
   Image Gallery Grid - Masonry Layout
   ========================================== */
.image-gallery-grid {
    position: relative;
    width: 100%;
    padding: 4px;
    background: var(--ig-bg, #000);
    min-height: 200px;
}

/* Gallery Card Item */
.gallery-card-item {
    position: absolute;
    overflow: hidden;
    border-radius: 6px;
    background: var(--ig-surface, #1a1a2e);
    transition: transform 0.3s ease, opacity 0.3s ease;
    will-change: transform;
}

@media (max-width: 479px) {
    .gallery-card-item {
        border-radius: 12px;
    }
}

.gallery-card-inner {
    position: relative;
    width: 100%;
}

/* Image container */
.gallery-card-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: pointer;
}

.gallery-card-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center top;
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
                filter 0.3s ease;
    display: block;
}

.gallery-card-item:hover .gallery-card-image img:not(.img-blur) {
    transform: scale(1.04);
    filter: brightness(1.05);
}

.gallery-card-image img.img-blur {
    filter: blur(18px) brightness(0.7);
    transform: scale(1.1);
}

/* NSFW Blur Wrapper with Premium Unlock CTA */
.gallery-nsfw-blur-wrapper {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.gallery-premium-unlock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
}

.gallery-premium-unlock-overlay i {
    font-size: 1.5rem;
    color: #fff;
    opacity: 0.9;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.gallery-premium-unlock-text {
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    padding: 0 8px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Overlay Actions Container */
.gallery-card-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 10;
    pointer-events: none;
}

.gallery-card-item:hover .gallery-card-actions,
.gallery-card-item:focus-within .gallery-card-actions {
    opacity: 1;
}

/* On mobile, always show actions */
@media (hover: none) {
    .gallery-card-actions {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0) 100%);
    }
}

.gallery-actions-left,
.gallery-actions-right {
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: auto;
}

/* Overlay Buttons - Shared */
.gallery-overlay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    outline: none;
}

.gallery-overlay-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.1);
}

.gallery-overlay-btn:active {
    transform: scale(0.95);
}

/* Like Button */
.gallery-like-btn.liked {
    color: #ff3b5c;
    background: rgba(255, 59, 92, 0.2);
}

.gallery-like-btn.liked:hover {
    background: rgba(255, 59, 92, 0.35);
}

.gallery-like-btn.liked i {
    animation: likePopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes likePopIn {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Add to Chat Button */
.gallery-addchat-btn {
    background: rgba(99, 102, 241, 0.5);
}

.gallery-addchat-btn:hover {
    background: rgba(99, 102, 241, 0.8);
}

/* ==========================================
   Admin Dropdown Menu (on images)
   ========================================== */
.gallery-admin-menu {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 11;
    pointer-events: auto;
}

.gallery-admin-toggle {
    background: rgba(0, 0, 0, 0.5);
    color: #fbbf24;
    opacity: 0;
    transition: opacity 0.25s ease, background 0.2s ease, transform 0.2s ease;
}

.gallery-card-item:hover .gallery-admin-toggle,
.gallery-card-item:focus-within .gallery-admin-toggle,
.gallery-admin-menu.open .gallery-admin-toggle {
    opacity: 1;
}

@media (hover: none) {
    .gallery-admin-toggle {
        opacity: 1;
    }
}

.gallery-admin-toggle:hover {
    background: rgba(0, 0, 0, 0.75);
    color: #fcd34d;
}

.gallery-admin-dropdown {
    position: fixed;
    min-width: 140px;
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px;
    display: none;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: adminDropdownIn 0.2s ease;
}

@keyframes adminDropdownIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gallery-admin-menu.open .gallery-admin-dropdown {
    display: block;
}

.gallery-admin-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #e0e0e0;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.gallery-admin-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.gallery-admin-item i {
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.gallery-admin-item.nsfw i {
    color: #f87171;
}

.gallery-admin-item.sfw i {
    color: #34d399;
}

/* Close admin dropdown when clicking outside */
.gallery-card-item .gallery-admin-menu.open::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
}

/* ========================================
   GALLERY IMAGE PREVIEW MODAL (Instagram-style with comments)
   ======================================== */

.gallery-preview-dialog {
    max-width: 1100px;
    width: 95vw;
    margin: 1rem auto;
}

.gallery-preview-content {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    max-height: 90vh;
}

.gallery-preview-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    opacity: 0.8;
    filter: invert(1);
    transition: opacity 0.2s;
}

.gallery-preview-close:hover {
    opacity: 1;
}

.gallery-preview-layout {
    display: flex;
    flex-direction: row;
    height: 85vh;
    max-height: 85vh;
}

/* Media side */
.gallery-preview-media {
    flex: 1 1 55%;
    min-width: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Character link overlay */
.gallery-preview-character-link {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 6px 12px 6px 6px;
    border-radius: 24px;
    text-decoration: none;
    color: #fff;
    transition: background 0.2s ease, transform 0.15s ease;
    z-index: 5;
}

.gallery-preview-character-link:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.03);
    color: #fff;
    text-decoration: none;
}

.gallery-preview-character-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.gallery-preview-character-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.gallery-preview-media-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-preview-media-inner img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Details side */
.gallery-preview-details {
    flex: 0 0 380px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    background: #1a1a1a;
    overflow: hidden;
}

.gallery-preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.gallery-preview-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(130, 64, 255, 0.4);
}

.gallery-preview-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gallery-preview-author-name {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.gallery-preview-date {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

.gallery-preview-caption-area {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    max-height: 100px;
    overflow-y: auto;
}

.gallery-preview-caption {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    word-break: break-word;
}

.gallery-preview-caption:empty {
    display: none;
}

.gallery-preview-caption-area:has(.gallery-preview-caption:empty) {
    display: none;
}

/* Comments */
.gallery-preview-comments {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.gallery-preview-comments::-webkit-scrollbar {
    width: 4px;
}

.gallery-preview-comments::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.gallery-preview-comment-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
}

.gallery-preview-comment-item + .gallery-preview-comment-item {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.gallery-preview-comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.gallery-preview-comment-body {
    flex: 1;
    min-width: 0;
}

.gallery-preview-comment-author {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    margin-right: 6px;
}

.gallery-preview-comment-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
}

.gallery-preview-comment-time {
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    margin-top: 4px;
}

.gallery-preview-no-comments {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    gap: 8px;
}

.gallery-preview-no-comments i {
    font-size: 28px;
}

/* Actions */
.gallery-preview-actions {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.gallery-preview-action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.gallery-preview-action-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s, transform 0.15s;
    line-height: 1;
}

.gallery-preview-action-btn:hover {
    color: #8240FF;
    transform: scale(1.1);
}

.gallery-preview-action-btn.liked {
    color: #ef4444;
}

.gallery-preview-action-btn.liked:hover {
    color: #dc2626;
}

.gallery-preview-likes-count {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

/* Add Comment */
.gallery-preview-add-comment {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    gap: 8px;
    flex-shrink: 0;
}

.gallery-preview-comment-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    outline: none;
    padding: 4px 0;
}

.gallery-preview-comment-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.gallery-preview-comment-submit {
    background: none;
    border: none;
    color: #8240FF;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    transition: opacity 0.2s;
}

.gallery-preview-comment-submit:disabled {
    opacity: 0.35;
    cursor: default;
}

.gallery-preview-comment-submit:not(:disabled):hover {
    opacity: 0.8;
}

/* Loading state */
.gallery-preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.5);
}

.gallery-preview-loading .spinner-border {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

/* ========================================
   GALLERY PREVIEW MODAL - RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .gallery-preview-dialog {
        max-width: 100%;
        width: 100%;
        margin: 0;
        height: 100%;
    }

    .gallery-preview-content {
        border-radius: 0;
        height: 100%;
        max-height: 100vh;
    }

    .gallery-preview-layout {
        flex-direction: column;
        height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
    }

    .gallery-preview-media {
        flex: 0 0 auto;
        max-height: 50vh;
        min-height: 250px;
    }

    .gallery-preview-details {
        flex: 1 1 auto;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        overflow: visible;
    }

    .gallery-preview-comments {
        max-height: 200px;
        overflow-y: auto;
    }

    .gallery-preview-close {
        top: 8px;
        right: 8px;
        z-index: 20;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 50%;
        padding: 8px;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .gallery-preview-details {
        flex: 0 0 320px;
    }
}
