/* ==========================================================================
   Profile Page — Cover, Header, Highlights, Grid & Modals
   ========================================================================== */

/* --- Profile Gradient Themes --- */
.theme-default, .theme-highlights {
    --profile-cover-gradient: linear-gradient(135deg, #FF2D55 0%, #8B5CF6 50%, #3B82F6 100%);
    --profile-accent: #FF2D55;
    --profile-accent-rgb: 255, 45, 85;
    --profile-badge-bg: rgba(255, 45, 85, 0.12);
    --profile-glow: 0 8px 30px rgba(255, 45, 85, 0.22);
    --profile-header-border: rgba(255, 45, 85, 0.25);
}

.theme-travel, .theme-aurora {
    --profile-cover-gradient: linear-gradient(135deg, #00C9FF 0%, #0077B6 50%, #92FE9D 100%);
    --profile-accent: #0096C7;
    --profile-accent-rgb: 0, 150, 199;
    --profile-badge-bg: rgba(0, 150, 199, 0.15);
    --profile-glow: 0 8px 30px rgba(0, 150, 199, 0.25);
    --profile-header-border: rgba(0, 150, 199, 0.3);
}

.theme-coffee, .theme-sunset {
    --profile-cover-gradient: linear-gradient(135deg, #FF512F 0%, #DD2476 50%, #FF8E53 100%);
    --profile-accent: #FF5E36;
    --profile-accent-rgb: 255, 94, 54;
    --profile-badge-bg: rgba(255, 94, 54, 0.15);
    --profile-glow: 0 8px 30px rgba(255, 94, 54, 0.25);
    --profile-header-border: rgba(255, 94, 54, 0.3);
}

.theme-cyberpunk {
    --profile-cover-gradient: linear-gradient(135deg, #F72585 0%, #7209B7 50%, #4CC9F0 100%);
    --profile-accent: #E01E78;
    --profile-accent-rgb: 224, 30, 120;
    --profile-badge-bg: rgba(247, 37, 133, 0.18);
    --profile-glow: 0 8px 30px rgba(247, 37, 133, 0.3);
    --profile-header-border: rgba(247, 37, 133, 0.35);
}

.theme-emerald {
    --profile-cover-gradient: linear-gradient(135deg, #0BA360 0%, #3CBA92 50%, #30DD8A 100%);
    --profile-accent: #0BA360;
    --profile-accent-rgb: 11, 163, 96;
    --profile-badge-bg: rgba(11, 163, 96, 0.15);
    --profile-glow: 0 8px 30px rgba(11, 163, 96, 0.25);
    --profile-header-border: rgba(11, 163, 96, 0.3);
}

.theme-midnight {
    --profile-cover-gradient: linear-gradient(135deg, #0F2027 0%, #203A43 50%, #2C5364 100%);
    --profile-accent: #7C3AED;
    --profile-accent-rgb: 124, 58, 237;
    --profile-badge-bg: rgba(124, 58, 237, 0.18);
    --profile-glow: 0 8px 30px rgba(124, 58, 237, 0.28);
    --profile-header-border: rgba(124, 58, 237, 0.35);
}

/* --- Container --- */
.profile-container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding-bottom: 40px;
    transition: all 0.35s ease;
    min-width: 0;
    box-sizing: border-box;
}

/* Dynamic theme elements */
.profile-container .btn-primary {
    background: var(--profile-accent, var(--primary)) !important;
    border-color: var(--profile-accent, var(--primary)) !important;
    box-shadow: 0 4px 15px rgba(var(--profile-accent-rgb, 255, 45, 85), 0.35) !important;
}
.profile-container .btn-primary:hover {
    filter: brightness(1.08);
}
.profile-container .profile-badge-pill {
    background: var(--profile-badge-bg, var(--primary-light)) !important;
    color: var(--profile-accent, var(--primary)) !important;
    border-color: var(--profile-header-border, rgba(255, 45, 85, 0.25)) !important;
}
.profile-container .badge-verified {
    color: var(--profile-accent, var(--primary)) !important;
}
.profile-container .story-ring-active {
    background: var(--profile-cover-gradient, var(--primary-gradient)) !important;
}
.profile-container .tab-nav-item.active {
    color: var(--profile-accent, var(--primary)) !important;
    border-bottom-color: var(--profile-accent, var(--primary)) !important;
}
.profile-container .profile-meta-item i {
    color: var(--profile-accent, var(--primary)) !important;
}
.profile-container .profile-meta-item a {
    color: var(--profile-accent, var(--primary)) !important;
}

/* --- Cover Banner --- */
.profile-cover-container {
    position: relative;
    width: 100%;
    height: 240px;
    border-radius: var(--radius-2xl);
    background: var(--profile-cover-gradient, linear-gradient(135deg, #FF2D55 0%, #8B5CF6 50%, #3B82F6 100%));
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: background 0.4s ease;
    animation: slideUpFade 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.profile-cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0.35) 100%);
}
.cover-action-btns {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 5;
}
.cover-edit-btn {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #FFF;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-full);
    padding: 8px 15px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}
.cover-edit-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: translateY(-2px);
}

/* --- Header Card --- */
.profile-header-card {
    background: var(--bg-glass-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--profile-header-border, var(--border-color));
    border-radius: var(--radius-2xl);
    padding: 0 32px 30px 32px;
    margin-top: -50px;
    position: relative;
    box-shadow: var(--profile-glow, var(--shadow-sm));
    z-index: 2;
    transition: all 0.35s ease;
    animation: slideUpFade 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.profile-main-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}
.avatar-edit-wrapper {
    position: relative;
    margin-top: -65px;
    width: 128px;
    height: 128px;
    border-radius: 50%;
}
.avatar-edit-wrapper .avatar-xl {
    width: 128px;
    height: 128px;
    border: 5px solid var(--bg-surface);
    box-shadow: var(--shadow-lg);
    object-fit: cover;
    background: var(--bg-surface);
}
.avatar-upload-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #FFF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    border: 5px solid transparent;
}
.avatar-edit-wrapper:hover .avatar-upload-overlay {
    opacity: 1;
}

/* --- Profile Badge & Tagline --- */
.profile-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12.5px;
    font-weight: 700;
    border: 1px solid var(--profile-header-border, rgba(255, 45, 85, 0.25));
}

/* --- Bio & Meta details --- */
.profile-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 14px;
    font-size: 13.5px;
    color: var(--text-muted);
}
.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-meta-item a {
    font-weight: 600;
    text-decoration: none;
}
.profile-meta-item a:hover {
    text-decoration: underline;
}

/* Bio truncation */
#profile-bio {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
    margin-top: 14px;
    white-space: pre-line;
}
#profile-bio.bio-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bio-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    margin-top: 2px;
    font-size: 13px;
    font-weight: 700;
    color: var(--profile-accent, var(--primary));
    cursor: pointer;
    display: none;
}

/* --- Stats Counter Row --- */
.profile-stats-row {
    display: flex;
    gap: 36px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-subtle);
}
.stat-counter-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    display: flex;
    gap: 6px;
    align-items: baseline;
    font-family: inherit;
    transition: transform var(--transition-fast);
}
.stat-counter-btn:hover {
    transform: translateY(-2px);
}
.stat-num {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
}
.stat-title {
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Story Highlights / Theme Selector Row --- */
.highlights-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 14px 6px 14px 6px;
    margin-bottom: 24px;
    scrollbar-width: none;
    align-items: flex-start;
}
.highlights-container::-webkit-scrollbar {
    display: none;
}
.highlight-circle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-shrink: 0;
    width: 82px;
    transition: all var(--transition-fast);
}
.highlight-circle-item:hover {
    transform: translateY(-4px);
}
.highlight-circle-thumb {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    padding: 3px;
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all var(--transition-fast);
}
.highlight-circle-item.active-filter .highlight-circle-thumb {
    border: 3px solid var(--profile-accent, var(--primary));
    box-shadow: 0 0 0 3px rgba(var(--profile-accent-rgb, 255, 45, 85), 0.35);
    transform: scale(1.08);
}
.highlight-circle-thumb span {
    transition: transform var(--transition-fast);
}
.highlight-circle-item:hover .highlight-circle-thumb span {
    transform: scale(1.18);
}
.highlight-circle-add {
    background: var(--bg-surface);
    border: 2px dashed var(--border-color);
}
.highlight-circle-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* --- Tabs --- */
.tab-nav-container {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    gap: 32px;
    justify-content: center;
}
.tab-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.tab-nav-item:hover {
    color: var(--text-main);
}
.tab-nav-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* --- Grid Items --- */
.profile-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    min-height: 200px;
}
.profile-grid-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
    animation: slideUpFade 0.4s ease both;
}
.profile-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.profile-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.profile-grid-item:hover img {
    transform: scale(1.05);
}
.grid-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    color: #FFF;
    border-radius: var(--radius-sm);
    padding: 3px 6px;
    font-size: 13px;
}
.grid-multi-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #FFF;
    font-size: 15px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.profile-grid-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    color: #FFF;
    font-size: 15px;
    font-weight: 700;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.profile-grid-item:hover .profile-grid-overlay {
    opacity: 1;
}

/* --- Empty states --- */
.profile-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 56px 20px;
    color: var(--text-muted);
    animation: slideUpFade 0.4s ease both;
}
.profile-empty-state .empty-icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    margin: 0 auto 16px;
    background: var(--bg-surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--profile-accent, var(--primary));
    box-shadow: inset 0 0 0 1px var(--border-color);
}
.profile-empty-state h4 {
    margin-top: 12px;
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
}
.profile-empty-state p {
    font-size: 13.5px;
    margin-top: 4px;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Loading skeleton --- */
.profile-skeleton {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding-bottom: 40px;
}
.sk-cover {
    height: 240px;
    border-radius: var(--radius-2xl);
}
.sk-header {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 0 32px 30px;
    margin-top: -50px;
    position: relative;
    box-shadow: var(--shadow-sm);
}
.sk-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    margin-top: -65px;
    border: 5px solid var(--bg-surface);
    box-shadow: var(--shadow-md);
}
.sk-line {
    height: 14px;
    border-radius: var(--radius-full);
    margin-top: 12px;
}
.sk-line.w-40 { width: 40%; }
.sk-line.w-25 { width: 25%; }
.sk-line.w-60 { width: 60%; }
.sk-stats {
    display: flex;
    gap: 36px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-subtle);
}
.sk-stat {
    width: 72px;
    height: 18px;
    border-radius: var(--radius-full);
}
.sk-highlights {
    display: flex;
    gap: 16px;
    padding: 14px 6px;
    overflow: hidden;
}
.sk-hl {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.sk-hl-circle {
    width: 68px;
    height: 68px;
    border-radius: 50%;
}
.sk-hl-title {
    width: 56px;
    height: 12px;
    border-radius: var(--radius-full);
}
.sk-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}
.sk-grid-item {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-lg);
}

/* --- Sticky compact action bar (mobile, after scroll) --- */
.profile-sticky-bar {
    display: none;
    position: fixed;
    top: var(--safe-top, 0px);
    left: 0;
    right: 0;
    z-index: 300;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-110%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding-top: calc(var(--safe-top, 0px) + 8px);
    padding-bottom: 8px;
    padding-left: max(var(--safe-left, 0px), 12px);
    padding-right: max(var(--safe-right, 0px), 12px);
}
.profile-sticky-bar.show {
    transform: translateY(0);
}
.profile-sticky-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 960px;
    margin: 0 auto;
}
.profile-sticky-inner .avatar {
    width: 40px;
    height: 40px;
    border: 2px solid var(--profile-accent, var(--primary));
}
.profile-sticky-info {
    flex: 1;
    min-width: 0;
}
.profile-sticky-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-sticky-sub {
    font-size: 12px;
    color: var(--text-muted);
}
.profile-sticky-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.profile-sticky-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* --- Pull to refresh --- */
.profile-ptr {
    position: relative;
    overflow: hidden;
}
.profile-ptr-indicator {
    display: none;
    justify-content: center;
    align-items: center;
    height: 48px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}
.profile-ptr-indicator.show {
    display: flex;
}
.profile-ptr-indicator .ptr-spinner {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* --- Theme Option Cards in Modal --- */
.theme-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 8px;
}
.theme-option-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    background: var(--bg-surface);
}
.theme-option-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.theme-option-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px var(--primary);
}
.theme-color-preview {
    width: 100%;
    height: 36px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}
.theme-option-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}

/* --- User List Item in Modal --- */
.user-follow-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.user-follow-item:hover {
    background: var(--bg-surface-hover);
}

/* --- User list search --- */
.user-list-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    z-index: 2;
}
.user-list-search input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    font-size: 13.5px;
    color: var(--text-main);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.user-list-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.user-list-search .search-pos {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

/* --- Mobile responsive --- */
@media (max-width: 767px) {
    .profile-container {
        padding-bottom: calc(90px + var(--safe-bottom, 0px));
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    .profile-cover-container {
        height: 180px;
        border-radius: 0 0 20px 20px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        box-shadow: var(--shadow-sm);
    }
    .cover-action-btns {
        top: calc(var(--safe-top, 0px) + 12px);
        right: 12px;
    }
    .cover-edit-btn {
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.25);
        padding: 6px 14px;
        font-size: 11.5px;
        border-radius: var(--radius-full);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
    .profile-header-card {
        margin: -38px 8px 0 8px;
        padding: 0 14px 18px 14px;
        border-radius: 20px;
        background: var(--bg-glass-card);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--border-color);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
        box-sizing: border-box !important;
    }
    .profile-main-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        gap: 10px;
        margin-bottom: 12px;
        flex-wrap: wrap;
        width: 100%;
    }
    .avatar-edit-wrapper {
        width: 86px;
        height: 86px;
        margin-top: -43px;
        flex-shrink: 0;
    }
    .avatar-edit-wrapper .avatar-xl {
        width: 86px;
        height: 86px;
        border: 3.5px solid var(--bg-surface);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    }
    .avatar-upload-overlay {
        border-width: 3.5px;
    }
    #profile-action-btn-container {
        display: flex;
        gap: 8px;
        align-items: center;
        width: 100%;
        margin-top: 10px;
    }
    #profile-action-btn-container .btn {
        padding: 8px 12px;
        font-size: 13px;
        font-weight: 700;
        border-radius: var(--radius-full);
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        white-space: nowrap;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #profile-action-btn-container .btn-icon {
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
        min-width: 38px;
        padding: 0;
        border-radius: var(--radius-full);
    }
    #profile-fullname {
        font-size: 21px;
        font-weight: 800;
        letter-spacing: -0.3px;
        line-height: 1.25;
    }
    #profile-username {
        font-size: 13.5px;
    }
    #profile-bio {
        font-size: 13.5px;
        line-height: 1.5;
        margin-top: 6px;
        color: var(--text-secondary);
    }
    .profile-meta-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 10px;
    }
    .profile-meta-item {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        background: var(--bg-hover);
        padding: 4px 10px;
        border-radius: var(--radius-full);
        font-size: 12px;
        color: var(--text-secondary);
        border: 1px solid var(--border-subtle);
    }
    .profile-stats-row {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        background: var(--bg-hover);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 12px 6px;
        margin-top: 16px;
        gap: 4px;
    }
    .stat-counter-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        border: none;
        background: none;
        padding: 2px;
        text-align: center;
    }
    .stat-counter-btn:not(:last-child) {
        border-right: 1px solid var(--border-subtle);
    }
    .stat-num {
        font-size: 17px;
        font-weight: 800;
        color: var(--text-primary);
    }
    .stat-title {
        font-size: 11.5px;
        font-weight: 600;
        color: var(--text-tertiary);
        margin-top: 2px;
    }
    .highlights-container {
        gap: 12px;
        padding: 12px 8px;
        margin-bottom: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .highlight-circle-item {
        width: 70px;
        gap: 6px;
        flex-shrink: 0;
    }
    .highlight-circle-thumb {
        width: 60px;
        height: 60px;
    }
    .highlight-circle-title {
        font-size: 11px;
    }
    .tab-nav-container {
        display: flex;
        width: 100%;
        gap: 0;
        margin-bottom: 12px;
        border-bottom: 1px solid var(--border-default);
        box-sizing: border-box;
        padding: 0 8px;
    }
    .tab-nav-item {
        flex: 1;
        padding: 12px 2px;
        font-size: 12.5px;
        font-weight: 700;
        gap: 4px;
        justify-content: center;
        text-align: center;
    }
    .profile-posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5px;
        padding: 0 8px;
        width: 100%;
        box-sizing: border-box;
    }
    .profile-grid-item {
        aspect-ratio: 1 / 1;
        border-radius: 4px;
        overflow: hidden;
        border: none;
    }
    .grid-type-badge {
        top: 6px;
        right: 6px;
        font-size: 11px;
        padding: 3px 6px;
        border-radius: 4px;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
    }
    .grid-multi-badge {
        top: 6px;
        left: 6px;
        font-size: 12px;
    }
    .sk-cover {
        height: 180px;
        border-radius: 0 0 24px 24px;
    }
    .sk-header {
        padding: 0 16px 20px;
        margin-top: -38px;
    }
    .sk-avatar {
        width: 86px;
        height: 86px;
        margin-top: -43px;
        border-width: 3.5px;
    }
    .sk-grid {
        gap: 2.5px;
        margin-top: 14px;
    }
    .sk-grid-item {
        border-radius: 4px;
        aspect-ratio: 1 / 1;
    }
    .profile-sticky-bar {
        display: block;
    }

    /* Mobile Sheet Modals */
    #edit-profile-modal .modal-dialog,
    #user-list-modal .modal-dialog {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0;
        border-radius: 24px 24px 0 0;
        max-height: 88vh;
        border-bottom: none;
        animation: slideUpSheet 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
}

@keyframes slideUpSheet {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ==========================================================================
   PART 10 — Profile Experience Enhancements
   Cover parallax, gradient animation, entrance reveal, tab underline,
   grid performance + overlay pills, follow pop, reduced-motion guard.
   ========================================================================== */

/* --- Cover: parallax + animated gradient --- */
.profile-cover-container {
    will-change: transform;
}
.profile-cover-container.has-gradient-anim::before {
    content: '';
    position: absolute;
    inset: -30% 0;
    background: var(--profile-cover-gradient, var(--gradient-primary));
    background-size: 200% 200%;
    animation: profileGradientShift 14s ease-in-out infinite;
}
.profile-cover-overlay {
    position: relative;
    z-index: 1;
}

/* Entrance reveal (header children + highlights + tabs)
   .profile-reveal  = hidden resting state; the entrance animation only runs
   once .profile-reveal-active is added (with the stagger --reveal-delay). */
.profile-reveal {
    opacity: 0;
    transform: translateY(18px);
}
.profile-reveal-active {
    animation: profileRevealIn 0.55s var(--ease-emphasized) forwards;
    animation-delay: var(--reveal-delay, 0ms);
}

/* Grid item: content-visibility + entrance stagger + hover overlay polish */
.profile-grid-item {
    content-visibility: auto;
    contain-intrinsic-size: 100% 100%;
    will-change: transform;
}
.profile-grid-item.revealed {
    animation: profileGridIn 0.5s var(--ease-emphasized) both;
    animation-delay: var(--reveal-delay, 0ms);
}
.profile-grid-item:hover .profile-grid-overlay {
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.profile-grid-overlay .stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-full);
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 700;
    color: #FFF;
    transition: transform var(--transition-fast);
}
.profile-grid-item:hover .profile-grid-overlay .stat-chip {
    transform: translateY(-2px);
}

/* --- Tabs: sliding underline indicator --- */
.tab-nav-container {
    position: relative;
}
.tab-nav-indicator {
    position: absolute;
    bottom: -1px;
    left: 0;
    height: 3px;
    border-radius: var(--radius-full);
    background: var(--profile-accent, var(--primary));
    box-shadow: 0 0 10px rgba(var(--profile-accent-rgb, 255, 45, 85), 0.5);
    opacity: 0;
    transition: left 0.3s var(--ease-emphasized),
                width 0.3s var(--ease-emphasized);
    pointer-events: none;
    z-index: 2;
}
.tab-nav-item.active {
    border-bottom-color: transparent;
}

/* --- Follow / action pop --- */
.profile-action-pop {
    animation: profileActionPop 0.55s var(--ease-emphasized);
}

/* --- Grid tab transition --- */
.profile-posts-grid.tab-transitioning {
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

/* --- Keyframes --- */
@keyframes profileGradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
@keyframes profileRevealIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes profileGridIn {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes profileActionPop {
    0% { transform: scale(1); }
    40% { transform: scale(0.94); }
    100% { transform: scale(1); }
}

/* --- Reduced motion: disable parallax, gradient pan, reveals --- */
@media (prefers-reduced-motion: reduce) {
    .profile-cover-container.has-gradient-anim::before {
        animation: none;
    }
    .profile-reveal,
    .profile-reveal-active {
        opacity: 1;
        transform: none;
        animation: none;
    }
    .profile-grid-item.revealed {
        opacity: 1;
        transform: none;
        animation: none;
    }
    .tab-nav-indicator {
        transition: none;
    }
    .profile-action-pop {
        animation: none;
    }
}
